summaryrefslogtreecommitdiff
path: root/plugins/Timetrackingeditor/Template
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Timetrackingeditor/Template')
-rw-r--r--plugins/Timetrackingeditor/Template/create.php41
-rw-r--r--plugins/Timetrackingeditor/Template/edit.php41
-rw-r--r--plugins/Timetrackingeditor/Template/menu.php23
-rw-r--r--plugins/Timetrackingeditor/Template/remove.php20
-rw-r--r--plugins/Timetrackingeditor/Template/start.php23
-rw-r--r--plugins/Timetrackingeditor/Template/stop.php23
-rw-r--r--plugins/Timetrackingeditor/Template/subtask/table.php89
-rw-r--r--plugins/Timetrackingeditor/Template/time_tracking_editor.php53
8 files changed, 313 insertions, 0 deletions
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 @@
+<div class="page-header">
+ <h2><?= t('Add a new Time Tracking Event') ?></h2>
+</div>
+<form class="popover-form" method="post" action="<?= $this->url->href('TimeTrackingEditorController', 'save', array('plugin' => 'timetrackingeditor', 'project_id' => $values['project_id'], 'task_id' => $values['task_id'])) ?>" autocomplete="off">
+
+ <?= $this->form->csrf() ?>
+
+ <?= $this->form->hidden('project_id', $values) ?>
+ <?= $this->form->hidden('task_id', $values) ?>
+ <?= $this->form->hidden('opposite_subtask_id', $values) ?>
+
+ <?= $this->form->label(t('Subtask'), 'subtask') ?>
+ <?= $this->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') ?>
+
+ <?= $this->form->label(t('Time spent'), 'time_spent') ?>
+ <?= $this->form->numeric('time_spent', $values, $errors, array('maxlength="10"', 'required', (isset($autofocus) && $autofocus == "time_spent" ? 'autofocus' : '')), 'form-numeric') ?> hours
+
+ <?= $this->form->label(t('Start Date'), 'start') ?>
+ <?= $this->form->text('start', $values, $errors, array('maxlength="10"', 'required'), 'form-date') ?>
+
+ <?= $this->form->label(t('Comment'), 'comment') ?>
+ <?= $this->form->textarea('comment', $values, $errors, array(), 'markdown-editor') ?>
+
+ <?= $this->form->checkbox('is_billable', t('Billable?'), 1, isset($values['is_billable']) && $values['is_billable'] == 1) ?>
+ <?= $this->form->checkbox('add_another', t('Add another event'), 1, isset($values['add_another']) && $values['add_another'] == 1) ?>
+
+ <?= $this->modal->submitButtons(); ?>
+
+</form>
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 @@
+<div class="page-header">
+ <h2><?= t('Edit a Time Tracking Event') ?></h2>
+</div>
+<form class="popover-form" method="post" action="<?= $this->url->href('TimeTrackingEditorController', 'update', array('plugin' => 'timetrackingeditor', 'project_id' => $values['project_id'], 'task_id' => $values['task_id'])) ?>" autocomplete="off">
+
+ <?= $this->form->csrf() ?>
+
+ <?= $this->form->hidden('project_id', $values) ?>
+ <?= $this->form->hidden('task_id', $values) ?>
+ <?= $this->form->hidden('opposite_subtask_id', $values) ?>
+ <?= $this->form->hidden('id', $values) ?>
+
+
+ <?= $this->form->label(t('Subtask'), 'subtask') ?>
+ <?= $this->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') ?>
+
+ <?= $this->form->label(t('Start Date'), 'start') ?>
+ <?= $this->form->text('start', $values, $errors, array('maxlength="10"', 'required'), 'form-date') ?>
+
+ <?= $this->form->label(t('Time spent'), 'time_spent') ?>
+ <?= $this->form->numeric('time_spent', $values, $errors, array('maxlength="10"', 'required'), 'form-numeric') ?> hours
+
+ <?= $this->form->label(t('Comment'), 'comment') ?>
+ <?= $this->form->textarea('comment', $values, $errors, array(), 'markdown-editor') ?>
+
+ <?= $this->form->checkbox('is_billable', t('Billable?'), 1, $values['is_billable'] == 1) ?>
+
+ <?= $this->modal->submitButtons(); ?>
+</form>
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 @@
+<div class="dropdown">
+ <a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a>
+ <ul>
+ <li>
+ <?= $this->modal->medium("pencil-square-o", t('Edit'),
+ 'TimeTrackingEditorController', 'edit',
+ array('plugin' => 'timetrackingeditor',
+ 'task_id' => $task['id'],
+ 'project_id' => $task['project_id'],
+ 'subtask_id' => $subtask_id,
+ 'id' => $id)) ?>
+ </li>
+ <li>
+ <?= $this->modal->medium("trash-o", t('Remove'),
+ 'TimeTrackingEditorController', 'confirm',
+ array('plugin' => 'timetrackingeditor',
+ 'task_id' => $task['id'],
+ 'project_id' => $task['project_id'],
+ 'subtask_id' => $subtask_id,
+ 'id' => $id)) ?>
+ </li>
+ </ul>
+</div>
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 @@
+<div class="page-header">
+ <h2><?= t('Remove a time tracking entry') ?></h2>
+</div>
+
+<div class="confirm">
+ <div class="alert alert-info">
+ <?= t('Do you really want to remove this entry?') ?>
+ <ul>
+ <li>
+ <strong><?= $this->text->e($timetracking['subtask_title']) ?></strong>
+ </li>
+ </ul>
+ </div>
+
+ <div class="form-actions">
+ <?= $this->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') ?>
+ <?= t('or') ?>
+ <?= $this->url->link(t('cancel'), 'TimeTrackingEditorController', 'show', array('plugin' => 'timetrackingeditor','id' => $timetracking['id'], 'project_id' => $timetracking['project_id']), false, 'close-popover') ?>
+ </div>
+</div>
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 @@
+<div class="page-header">
+ <h2><?= t('Start a new Timer') ?></h2>
+</div>
+<form class="popover-form" method="post" action="<?= $this->url->href('TimeTrackingEditorController', 'startsave', array('plugin' => 'timetrackingeditor', 'project_id' => $values['project_id'], 'task_id' => $values['task_id'])) ?>" autocomplete="off">
+
+ <?= $this->form->csrf() ?>
+
+ <?= $this->form->hidden('project_id', $values) ?>
+ <?= $this->form->hidden('task_id', $values) ?>
+ <?= $this->form->hidden('subtask_id', $values) ?>
+
+ <?= t('Subtask') ?>
+ <?= $values['subtask']['title'] ?>
+
+ <?= $this->form->label(t('Comment'), 'comment') ?>
+ <?= $this->form->textarea('comment', $values, $errors, array(), 'markdown-editor') ?>
+
+ <?= $this->form->checkbox('is_billable', t('Billable?'), 1, isset($values['is_billable']) && $values['is_billable'] == 1) ?>
+
+ <div class="form-actions">
+ <?= $this->modal->submitButtons() ?>
+ </div>
+</form>
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 @@
+<div class="page-header">
+ <h2><?= t('Stop a Timer') ?></h2>
+</div>
+<form class="popover-form" method="post" action="<?= $this->url->href('TimeTrackingEditorController', 'stopsave', array('plugin' => 'timetrackingeditor', 'project_id' => $values['project_id'], 'task_id' => $values['task_id'])) ?>" autocomplete="off">
+
+ <?= $this->form->csrf() ?>
+
+ <?= $this->form->hidden('project_id', $values) ?>
+ <?= $this->form->hidden('task_id', $values) ?>
+ <?= $this->form->hidden('subtask_id', $values) ?>
+
+ <?= t('Subtask') ?>
+ <?= $values['subtask']['title'] ?>
+
+ <?= $this->form->label(t('Comment'), 'comment') ?>
+ <?= $this->form->textarea('comment', $values, $errors, array(), 'markdown-editor') ?>
+
+ <?= $this->form->checkbox('is_billable', t('Billable?'), 1, isset($values['is_billable']) && $values['is_billable'] == 1) ?>
+
+ <div class="form-actions">
+ <?= $this->modal->submitButtons() ?>
+ </div>
+</form>
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 @@
+<?php if (! empty($subtasks)): ?>
+ <table
+ class="subtasks-table table-stripped"
+ data-save-position-url="<?= $this->url->href('SubtaskController', 'movePosition', array('project_id' => $task['project_id'], 'task_id' => $task['id'])) ?>"
+ >
+ <thead>
+ <tr>
+ <th class="column-40"><?= t('Title') ?></th>
+ <th><?= t('Assignee') ?></th>
+ <th><?= t('Time tracking') ?></th>
+ <?php if ($editable): ?>
+ <th class="column-5"></th>
+ <th class="column-5"></th>
+ <?php endif ?>
+ </tr>
+ </thead>
+ <tbody>
+ <?php foreach ($subtasks as $subtask): ?>
+ <tr data-subtask-id="<?= $subtask['id'] ?>">
+ <td>
+ <?php if ($editable): ?>
+ <i class="fa fa-arrows-alt draggable-row-handle" title="<?= t('Change subtask position') ?>"></i>
+ <?= $this->subtask->renderToggleStatus($task, $subtask, "table") ?>
+ <?php else: ?>
+ <?= $this->subtask->getTitle($subtask) ?>
+ <?php endif ?>
+ </td>
+ <td>
+ <?php if (! empty($subtask['username'])): ?>
+ <?= $this->text->e($subtask['name'] ?: $subtask['username']) ?>
+ <?php endif ?>
+ </td>
+ <td>
+ <ul class="no-bullet">
+ <li>
+ <?php if (! empty($subtask['time_spent'])): ?>
+ <strong><?= $this->text->e($subtask['time_spent']).'h' ?></strong> <?= t('spent') ?>
+ <?php endif ?>
+
+ <?php if (! empty($subtask['time_estimated'])): ?>
+ <strong><?= $this->text->e($subtask['time_estimated']).'h' ?></strong> <?= t('estimated') ?>
+ <?php endif ?>
+ <?php if (! empty($subtask['time_billable'])): ?>
+ <strong><?= $this->text->e($subtask['time_billable']).'h' ?></strong> <?= t('billable') ?>
+ <?php endif ?>
+
+ </li>
+ <?php if ($editable && $subtask['user_id'] == $this->user->getId()): ?>
+ <li>
+ <?php if ($subtask['is_timer_started']): ?>
+ <?= $this->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'])) ?>
+ (<?= $this->dt->age($subtask['timer_start_date']) ?>)
+ <?php else: ?>
+ <?= $this->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'])) ?>
+ <?php endif ?>
+ </li>
+ <?php endif ?>
+ </ul>
+ </td>
+ <?php if ($editable): ?>
+ <td>
+ <?= $this->render('subtask/menu', array(
+ 'task' => $task,
+ 'subtask' => $subtask,
+ )) ?>
+ </td>
+ <td>
+ <?= $this->modal->medium("clock-o", t('New'), 'TimeTrackingEditorController',
+ 'create', array(
+ 'plugin' => 'Timetrackingeditor',
+ 'task_id' => $task['id'],
+ 'project_id' => $task['project_id'],
+ 'subtask_id' => $subtask['id'])) ?>
+ </td>
+
+ <?php endif ?>
+ </tr>
+ <?php endforeach ?>
+ </tbody>
+ </table>
+<?php endif ?>
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 @@
+<div class="task-show-title color-<?= $task['color_id'] ?>">
+ <h2><?= $this->text->e($task['title']) ?></h2>
+</div>
+
+<?= $this->render('task/time_tracking_summary', array('task' => $task)) ?>
+
+<h3><?= t('Subtask timesheet') ?></h3>
+
+<?= $this->modal->medium("plus",t('Add a new timetracking entry'), 'TimeTrackingEditorController',
+ 'create', array(
+ 'plugin' => 'timetrackingeditor',
+ 'task_id' => $task['id'],
+ 'project_id' => $task['project_id'])) ?>
+
+<?php if ($subtask_paginator->isEmpty()): ?>
+ <p class="alert"><?= t('There is nothing to show.') ?></p>
+<?php else: ?>
+ <table class="table-fixed">
+ <tr>
+ <th class="column-15"><?= $subtask_paginator->order(t('User'), 'username') ?></th>
+ <th><?= $subtask_paginator->order(t('Subtask'), 'subtask_title') ?></th>
+ <th class="column-20"><?= $subtask_paginator->order(t('Start'), 'start') ?></th>
+ <th class="column-20"><?= $subtask_paginator->order(t('End'), 'end') ?></th>
+ <th class="column-10 right"><?= $subtask_paginator->order(t('Time spent'), \Kanboard\Model\SubtaskTimeTrackingModel::TABLE.'.time_spent') ?></th>
+ <th class="column-10"></th>
+ </tr>
+ <?php foreach ($subtask_paginator->getCollection() as $record): ?>
+ <tr>
+ <td><?= $this->url->link($this->text->e($record['user_fullname'] ?: $record['username']), 'UserViewController', 'show', array('user_id' => $record['user_id'])) ?>
+ <?php if ($record['is_billable']): ?>
+ <i class='fa fa-cart-plus'></i>
+ <?php endif ?>
+ <?= $this->app->tooltipMarkdown($record['comment']) ?>
+ </td>
+ <td><?= t($record['subtask_title']) ?></td>
+ <td><?= $this->dt->datetime($record['start']) ?></td>
+ <td><?= $this->dt->datetime($record['end']) ?></td>
+ <td class="right"><?= n($record['time_spent']).' '.t('hours') ?></td>
+ <td>
+ <?php if ($this->user->isCurrentUser($record['user_id'])) { ?>
+ <?= $this->render('timetrackingeditor:menu', array(
+ 'task' => $task,
+ 'subtask_id' => $record['subtask_id'],
+ 'id' => $record['id']
+ )) ?>
+ <?php } ?>
+ </td>
+ </tr>
+ <?php endforeach ?>
+ </table>
+
+ <?= $subtask_paginator ?>
+<?php endif ?>