Added a template selector on time.php.
[timetracker.git] / WEB-INF / templates / time.tpl
1 {include file="time_script.tpl"}
2
3 {if $template_dropdown}
4 <script>
5 var templates = new Array();
6 {foreach $templates as $template}
7   templates[{$template.id}] = "{$template.content|escape:'javascript'}";
8 {/foreach}
9
10 // The fillNote function populates the Note field with a selected template body.
11 function fillNote(id) {
12   if (!id) return; // Do nothing.
13   var template_body = templates[id];
14   var note = document.getElementById("note");
15   note.value = template_body;
16 }
17 </script>
18 {/if}
19
20 <style>
21 .not_billable td {
22   color: #ff6666;
23 }
24 </style>
25
26 {$forms.timeRecordForm.open}
27 <table cellspacing="4" cellpadding="0" border="0">
28 {if $user->isPluginEnabled('wv')}
29   <tr>
30     <td align="center" colspan=2">
31       <a href="time.php?date={$selected_date->toString()}">{$i18n.label.day_view}</a>&nbsp;/&nbsp;<a href="week.php?date={$selected_date->toString()}">{$i18n.label.week_view}</a>
32     </td>
33   </tr>
34 {/if}
35   <tr>
36     <td valign="top">
37       <table>
38 {if $user_dropdown}
39         <tr>
40           <td align="right">{$i18n.label.user}:</td>
41           <td>{$forms.timeRecordForm.user.control}</td>
42         </tr>
43 {/if}
44 {if $user->isPluginEnabled('cl')}
45         <tr>
46           <td align="right">{$i18n.label.client}{if $user->isPluginEnabled('cm')} (*){/if}:</td>
47           <td>{$forms.timeRecordForm.client.control}</td>
48         </tr>
49 {/if}
50 {if $user->isPluginEnabled('iv')}
51         <tr>
52           <td align="right">&nbsp;</td>
53           <td><label>{$forms.timeRecordForm.billable.control}{$i18n.form.time.billable}</label></td>
54         </tr>
55 {/if}
56 {if ($custom_fields && $custom_fields->fields[0])}
57         <tr>
58           <td align="right">{$custom_fields->fields[0]['label']|escape}{if $custom_fields->fields[0]['required']} (*){/if}:</td><td>{$forms.timeRecordForm.cf_1.control}</td>
59         </tr>
60 {/if}
61 {if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
62         <tr>
63           <td align="right">{$i18n.label.project} (*):</td>
64           <td>{$forms.timeRecordForm.project.control}</td>
65         </tr>
66 {/if}
67 {if ($smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
68         <tr>
69           <td align="right">{$i18n.label.task}{if $user->task_required} (*){/if}:</td>
70           <td>{$forms.timeRecordForm.task.control}</td>
71         </tr>
72 {/if}
73 {if (($smarty.const.TYPE_START_FINISH == $user->record_type) || ($smarty.const.TYPE_ALL == $user->record_type))}
74         <tr>
75           <td align="right">{$i18n.label.start}:</td>
76           <td>{$forms.timeRecordForm.start.control}&nbsp;<input onclick="setNow('start');" type="button" tabindex="-1" value="{$i18n.button.now}"></td>
77         </tr>
78         <tr>
79           <td align="right">{$i18n.label.finish}:</td>
80           <td>{$forms.timeRecordForm.finish.control}&nbsp;<input onclick="setNow('finish');" type="button" tabindex="-1" value="{$i18n.button.now}"></td>
81         </tr>
82 {/if}
83 {if (($smarty.const.TYPE_DURATION == $user->record_type) || ($smarty.const.TYPE_ALL == $user->record_type))}
84         <tr>
85           <td align="right">{$i18n.label.duration}:</td>
86           <td>{$forms.timeRecordForm.duration.control}&nbsp;{if $user->getDecimalMark() == ','}{str_replace('.', ',', $i18n.form.time.duration_format)}{else}{$i18n.form.time.duration_format}{/if}</td>
87         </tr>
88 {/if}
89 {if $template_dropdown}
90         <tr>
91           <td align="right">{$i18n.label.template}:</td>
92           <td>{$forms.timeRecordForm.template.control}</td>
93         </tr>
94 {/if}
95       </table>
96     </td>
97     <td valign="top">
98       <table>
99         <tr><td>{$forms.timeRecordForm.date.control}</td></tr>
100       </table>
101     </td>
102   </tr>
103 </table>
104
105 <table>
106   <tr>
107     <td align="right">{$i18n.label.note}:</td>
108     <td align="left">{$forms.timeRecordForm.note.control}</td>
109   </tr>
110   <tr>
111     <td align="center" colspan="2">{$forms.timeRecordForm.btn_submit.control}</td>
112   </tr>
113 </table>
114
115 <table width="720">
116 <tr>
117   <td valign="top">
118 {if $time_records}
119       <table border="0" cellpadding="3" cellspacing="1" width="100%">
120       <tr>
121   {if $user->isPluginEnabled('cl')}
122         <td width="20%" class="tableHeader">{$i18n.label.client}</td>
123   {/if}
124   {if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
125         <td class="tableHeader">{$i18n.label.project}</td>
126   {/if}
127   {if ($smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
128         <td class="tableHeader">{$i18n.label.task}</td>
129   {/if}
130   {if (($smarty.const.TYPE_START_FINISH == $user->record_type) || ($smarty.const.TYPE_ALL == $user->record_type))}
131         <td width="5%" class="tableHeader" align="right">{$i18n.label.start}</td>
132         <td width="5%" class="tableHeader" align="right">{$i18n.label.finish}</td>
133   {/if}
134         <td width="5%" class="tableHeader">{$i18n.label.duration}</td>
135         <td class="tableHeader">{$i18n.label.note}</td>
136         <td width="5%" class="tableHeader">{$i18n.label.edit}</td>
137       </tr>
138   {foreach $time_records as $record}
139       <tr bgcolor="{cycle values="#f5f5f5,#ffffff"}" {if !$record.billable} class="not_billable" {/if}>
140     {if $user->isPluginEnabled('cl')}
141         <td valign="top">{$record.client|escape}</td>
142     {/if}
143     {if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
144         <td valign="top">{$record.project|escape}</td>
145     {/if}
146     {if ($smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
147         <td valign="top">{$record.task|escape}</td>
148     {/if}
149     {if (($smarty.const.TYPE_START_FINISH == $user->record_type) || ($smarty.const.TYPE_ALL == $user->record_type))}
150         <td nowrap align="right" valign="top">{if $record.start}{$record.start}{else}&nbsp;{/if}</td>
151         <td nowrap align="right" valign="top">{if $record.finish}{$record.finish}{else}&nbsp;{/if}</td>
152     {/if}
153         <td align="right" valign="top">{if ($record.duration == '0:00' && $record.start <> '')}<font color="#ff0000">{$i18n.form.time.uncompleted}</font>{else}{$record.duration}{/if}</td>
154         <td valign="top">{if $record.comment}{$record.comment|escape}{else}&nbsp;{/if}</td>
155         <td valign="top" align="center">
156     {if $record.approved || $record.timesheet_id || $record.invoice_id}
157           &nbsp;
158     {else}
159           <a href="time_edit.php?id={$record.id}">{$i18n.label.edit}</a>
160       {if ($record.duration == '0:00' && $record.start <> '')}
161           <input type="hidden" name="record_id" value="{$record.id}">
162           <input type="hidden" name="browser_date" value="">
163           <input type="hidden" name="browser_time" value="">
164           <input type="submit" id="btn_stop" name="btn_stop" onclick="browser_date.value=get_date();browser_time.value=get_time()" value="{$i18n.button.stop}">
165       {/if}
166     {/if}
167         </td>
168       </tr>
169   {/foreach}
170     </table>
171 {/if}
172   </td>
173 </tr>
174 </table>
175
176 <table cellpadding="3" cellspacing="1" width="720">
177   <tr>
178     <td align="left">{$i18n.label.week_total}: {$week_total}</td>
179     <td align="right">{$i18n.label.day_total}: {$day_total}</td>
180   </tr>
181   {if $user->isPluginEnabled('mq')}
182   <tr>
183     <td align="left">{$i18n.label.month_total}: {$month_total}</td>
184     {if $over_balance}
185     <td align="right">{$i18n.form.time.over_balance}: <span style="color: green;">{$balance_remaining}</span></td>
186     {else}
187     <td align="right">{$i18n.form.time.remaining_balance}: <span style="color: red;">{$balance_remaining}</span></td>
188     {/if}
189   </tr>
190   <tr>
191     <td align="left">{$i18n.label.quota}: {$month_quota}</td>
192     {if $over_quota}
193     <td align="right">{$i18n.form.time.over_quota}: <span style="color: green;">{$quota_remaining}</span></td>
194     {else}
195     <td align="right">{$i18n.form.time.remaining_quota}: <span style="color: red;">{$quota_remaining}</span></td>
196     {/if}
197   </tr>
198   {/if}
199 </table>
200
201 {$forms.timeRecordForm.close}