1<?php /* @var \dokuwiki\plugin\bez\meta\Tpl $tpl */ ?>
2
3<div id="z<?php echo $tpl->get('task')->id ?>"
4	class="bez_task
5    <?php
6        if($tpl->get('task')->state == 'opened') {
7            echo 'priority_' . $tpl->get('task')->priority;
8        }
9    ?>">
10
11<div class="timebox">
12    <span>
13        <strong><?php echo $tpl->getLang('open') ?>:</strong>
14        <?php echo $tpl->date($tpl->get('task')->create_date) ?>
15    </span>
16
17	<?php if ($tpl->get('task')->state != 'opened'): ?>
18
19        <span>
20            <strong><?php echo $tpl->getLang('task_' . $tpl->get('task')->state) ?>:</strong>
21            <?php echo $tpl->date($tpl->get('task')->close_date) ?>
22        </span>
23
24		<span>
25			<strong><?php echo $tpl->getLang('report_priority') ?>: </strong>
26            <?php echo $tpl->date_diff_days($tpl->get('task')->create_date, $tpl->get('task')->close_date, '%a'); ?>
27		</span>
28	<?php endif ?>
29</div>
30
31<h2>
32	<a href="<?php echo $tpl->url('task', 'tid', $tpl->get('task')->id) ?>">
33		#z<?php echo $tpl->get('task')->id ?>
34	</a>
35    <?php if ($tpl->get('task')->thread_id == '' || $tpl->get('task')->thread->type != 'project'): ?>
36	    <?php echo lcfirst($tpl->getLang('task_type_' . $tpl->get('task')->type)) ?>
37    <?php endif ?>
38	(<?php echo lcfirst($tpl->getLang('task_' . $tpl->get('task')->state)) ?>)
39
40    <?php if ($tpl->get('task')->private == '1'): ?>
41        <?php echo inlineSVG(DOKU_PLUGIN . 'bez/images/lock.svg') ?>
42    <?php endif ?>
43</h2>
44
45<table class="data">
46<tr>
47    <th><?php echo $tpl->getLang('reporter') ?>:</th>
48    <td>
49        <?php echo $tpl->user_name($tpl->get('task')->original_poster) ?>
50    </td>
51
52    <th><?php echo $tpl->getLang('executor') ?>:</th>
53    <td><?php echo $tpl->user_name($tpl->get('task')->assignee) ?></td>
54</tr>
55
56<tr>
57    <th style="white-space: nowrap;"><?php echo $tpl->getLang('plan_date') ?>:</th>
58    <td>
59        <?php echo $tpl->get('task')->plan_date ?><?php if ($tpl->get('task')->all_day_event == '0'): ?>,
60            <?php echo $tpl->get('task')->start_time ?> - <?php echo $tpl->get('task')->finish_time ?>
61        <?php endif ?>
62    </td>
63
64    <th><?php echo $tpl->getLang('task_type') ?>:</th>
65    <td>
66    <?php if ($tpl->get('task')->task_program_id == ''): ?>
67        ---
68    <?php else: ?>
69        <?php echo $tpl->get('task')->task_program_name ?>
70    <?php endif ?>
71    </td>
72</tr>
73
74<tr>
75    <th><?php echo $tpl->getLang('cost') ?>:</th>
76    <td colspan="3">
77    <?php if ($tpl->get('task')->cost == ''): ?>
78        ---
79    <?php else: ?>
80        <?php echo $tpl->get('task')->cost ?>
81    <?php endif ?>
82    </td>
83</tr>
84
85</table>
86
87<?php echo $tpl->get('task')->content_html ?>
88<?php if (!$tpl->get('no_actions')): ?>
89    <?php if ($tpl->action() == 'thread'): ?>
90        <a style="display:block; position: absolute"
91           href="<?php echo $tpl->url('task', 'tid', $tpl->get('task')->id) ?>">
92            <?php echo $tpl->getLang('comments') ?>:
93            <?php echo $tpl->factory('task_comment')->count(array('task_id' => $tpl->get('task')->id)) ?>
94        </a>
95    <?php endif ?>
96
97    <div class="bez_buttons">
98        <?php if ($tpl->get('task')->acl_of('thread_id') >= BEZ_PERMISSION_CHANGE): ?>
99            <?php if ($tpl->get('task')->thread_id == ''): ?>
100                <form   id="plugin__bez_task_pin_form"
101                        action="<?php echo $tpl->url('task', 'tid', $tpl->get('task')->id, 'action', 'pin') ?>"
102                        method="post">
103                    <label>
104                        <?php echo $tpl->getLang('thread_id') ?>:
105                        <input name="thread_id" type="number" style="width: 50px"
106                               value="<?php echo $tpl->value('thread_id') ?>" />
107                        <button style="display:none">
108                            <?php echo $tpl->getLang('pin_button') ?>
109                        </button>
110                    </label>
111                    <button id="plugin__bez_pin_to_the_issue" class="bds_inline_button"
112                       href="<?php echo $tpl->url('task', 'tid', $tpl->get('task')->id) ?>#zk_">
113                        <span class="bez_awesome">&#xf0c6;</span>
114                        <?php echo $tpl->getLang('pin_to_the_issue') ?>
115                    </button>
116                </form>
117            <?php else: ?>
118                <a class="bds_inline_button"
119                   href="<?php echo $tpl->url('task', 'tid', $tpl->get('task')->id, 'action', 'unpin') ?>"
120                   onclick="return confirm('<?php echo $tpl->getLang('confirm_unpin_task') ?>')">
121                    <span class="bez_awesome">&#xf0c6;</span>
122                    <?php echo $tpl->getLang('unpin_from_the_issue') ?>
123                </a>
124            <?php endif ?>
125        <?php endif ?>
126
127        <?php if ($tpl->get('task')->acl_of('state') >= BEZ_PERMISSION_CHANGE): ?>
128            <a class="bds_inline_button"
129               id="plugin__bez_do_task_button"
130               href="<?php echo $tpl->url('task', 'tid', $tpl->get('task')->id) ?>#zk_">
131                <?php if ($tpl->get('task')->state == 'opened'): ?>
132<?php echo $tpl->getLang('js')['do_task'] ?>
133                <?php else: ?>
134<?php echo $tpl->getLang('js')['reopen_task'] ?>
135                <?php endif?>
136            </a>
137        <?php endif ?>
138
139        <?php if (count($tpl->get('task')->changable_fields(
140                array('content', 'plan_date', 'all_day_event', 'start_time', 'finish_time', 'task_program_id', 'cost')
141            )) > 0): ?>
142                <a class="bds_inline_button"
143                    href="<?php
144                        if ($tpl->action() == 'thread') {
145                            echo $tpl->url('thread', 'id', $tpl->get('thread')->id, 'tid', $tpl->get('task')->id, 'action', 'task_edit');
146                        } else {
147                            echo $tpl->url('task', 'tid', $tpl->get('task')->id, 'action', 'task_edit');
148                        }
149                    ?>#z_">
150<?php echo $tpl->getLang('edit') ?>
151                </a>
152        <?php endif ?>
153
154        <?php if ($tpl->get('task')->acl_of('id') >= BEZ_PERMISSION_DELETE): ?>
155            <a class="bds_inline_button bez_commcause_delete_prompt"
156               href="<?php
157               if ($tpl->action() == 'thread') {
158                   echo $tpl->url('thread', 'id', $tpl->get('thread')->id, 'tid', $tpl->get('task')->id, 'action', 'task_delete');
159               } else {
160                   echo $tpl->url('task', 'tid', $tpl->get('task')->id, 'action', 'task_delete');
161               }
162               ?>#z_">
163<?php echo $tpl->getLang('delete') ?>
164            </a>
165        <?php endif ?>
166
167        <a class="bds_inline_button" href="
168        <?php echo $tpl->mailto($tpl->user_email($tpl->get('task')->assignee),
169        '#z'.$tpl->get('task')->id,
170        $tpl->url('task', 'tid', $tpl->get('task')->id)) ?>">
171<?php echo $tpl->getLang('send_mail') ?>
172        </a>
173
174        <?php if ($tpl->get('task')->task_program_id != '' &&
175                  $tpl->factory('task')->permission() >= BEZ_TABLE_PERMISSION_INSERT): ?>
176            <a class="bds_inline_button"
177                    href="<?php echo $tpl->url('task_form', 'duplicate', $tpl->get('task')->id, 'task_program_id', $tpl->get('task')->task_program_id) ?>">
178<?php echo $tpl->getLang('duplicate') ?>
179            </a>
180        <?php endif ?>
181	</div>
182<?php endif ?>
183
184</div>
185