2 // We need a few arrays to populate project dropdown.
3 // When client selection changes, the project dropdown must be re-populated with only relevant projects.
5 // project_ids[143] = "325,370,390,400"; // Comma-separated list of project ids for client.
6 // project_names[325] = "Time Tracker"; // Project name.
8 // Prepare an array of project ids for clients.
9 project_ids = new Array();
10 {foreach $client_list as $client}
11 project_ids[{$client.id}] = "{$client.projects}";
13 // Prepare an array of project names.
14 project_names = new Array();
15 {foreach $project_list as $project}
16 project_names[{$project.id}] = "{$project.name|escape:'javascript'}";
18 // We'll use this array to populate project dropdown when client is not selected.
20 projects = new Array();
21 {foreach $project_list as $project}
22 projects[idx] = new Array("{$project.id}", "{$project.name|escape:'javascript'}");
26 // Mandatory top option for project dropdown.
27 empty_label_project = '{$i18n.dropdown.select|escape:'javascript'}';
29 // The fillProjectDropdown function populates the project combo box with
30 // projects associated with a selected client (client id is passed here as id).
31 function fillProjectDropdown(id) {
32 var str_ids = project_ids[id];
33 var dropdown = document.getElementById("project");
34 // Determine previously selected item.
35 var selected_item = dropdown.options[dropdown.selectedIndex].value;
37 // Remove existing content.
39 // Add mandatory top option.
40 dropdown.options[0] = new Option(empty_label_project, '', true);
42 // Populate project dropdown.
44 // If we are here, client is not selected.
45 var len = projects.length;
46 for (var i = 0; i < len; i++) {
47 dropdown.options[i+1] = new Option(projects[i][1], projects[i][0]);
48 if (dropdown.options[i+1].value == selected_item)
49 dropdown.options[i+1].selected = true;
52 var ids = new Array();
53 ids = str_ids.split(",");
56 for (var i = 0; i < len; i++) {
58 dropdown.options[i+1] = new Option(project_names[p_id], p_id);
59 if (dropdown.options[i+1].value == selected_item)
60 dropdown.options[i+1].selected = true;
66 var date = new Date();
67 return date.strftime("%Y-%m-%d");
71 <!-- Inserted from time.tpl -->
72 <table cellspacing="3" cellpadding="0" border="0" width="100%">
74 <td class="sectionHeaderNoBorder" align="right"><a href="expenses.php?date={$prev_date}"><<</a></td>
75 <td class="sectionHeaderNoBorder" align="center">{$timestring}</td>
76 <td class="sectionHeaderNoBorder" align="left"><a href="expenses.php?date={$next_date}">>></a></td>
80 {$forms.expensesForm.open}
81 <table cellspacing="4" cellpadding="0" border="0">
85 {if $on_behalf_control}
87 <td align="right">{$i18n.label.user}:</td>
88 <td>{$forms.expensesForm.onBehalfUser.control}</td>
91 {if $user->isPluginEnabled('cl')}
93 <td align="right">{$i18n.label.client}{if $user->isPluginEnabled('cm')} (*){/if}:</td>
94 <td>{$forms.expensesForm.client.control}</td>
97 {if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
99 <td align="right">{$i18n.label.project} (*):</td>
100 <td>{$forms.expensesForm.project.control}</td>
104 <td align="right">{$i18n.label.item} (*):</td>
105 <td>{$forms.expensesForm.item_name.control}</td>
108 <td align="right">{$i18n.label.cost} (*):</td>
109 <td>{$forms.expensesForm.cost.control} {$user->currency|escape}</td>
116 <tr><td>{$forms.expensesForm.date.control}</td></tr>
125 <td align="center" colspan="2">{$forms.expensesForm.btn_submit.control}</td>
129 <table class="mobile-table">
133 <table class="mobile-table-details">
135 {if $user->isPluginEnabled('cl')}
136 <td width="20%" class="tableHeader">{$i18n.label.client}</td>
138 {if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
139 <td class="tableHeader">{$i18n.label.project}</td>
141 <td class="tableHeader">{$i18n.label.item}</td>
142 <td width="5%" class="tableHeaderCentered">{$i18n.label.cost}</td>
144 {foreach $expense_items as $item}
145 <tr bgcolor="{cycle values="#f5f5f5,#ccccce"}">
146 {if $user->isPluginEnabled('cl')}
147 <td valign="top">{$item.client|escape}</td>
149 {if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
150 <td valign="top">{$item.project|escape}</td>
152 <td valign="top">{if $item.invoice_id} {$item.item|escape} {else}<a href="expense_edit.php?id={$item.id}">{$item.item|escape}</a>{/if}</td>
153 <td valign="top" align="right">{$item.cost}</td>
157 <table border="0" cellpadding="3" cellspacing="1" width="100%">
159 <td nowrap align="right">{$i18n.label.day_total}: {$user->currency|escape} {$day_total}</td>
166 {$forms.expensesForm.close}