-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclients.tpl
178 lines (158 loc) · 9.14 KB
/
clients.tpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
{$view_context = 'wgm.freshbooks.contexts.client'}
{$view_fields = $view->getColumnsAvailable()}
{$results = $view->getData()}
{$total = $results[1]}
{$data = $results[0]}
<table cellpadding="0" cellspacing="0" border="0" class="worklist" width="100%" {if $view->options.header_color}style="background-color:{$view->options.header_color};"{/if}>
<tr>
<td nowrap="nowrap"><span class="title">{$view->name}</span></td>
<td nowrap="nowrap" align="right" class="title-toolbar">
<a href="javascript:;" title="{'common.search'|devblocks_translate|capitalize}" class="minimal" onclick="genericAjaxPopup('search','c=internal&a=viewShowQuickSearchPopup&view_id={$view->id}',null,false,'400');"><span class="glyphicons glyphicons-search"></span></a>
<a href="javascript:;" title="{'common.customize'|devblocks_translate|capitalize}" class="minimal" onclick="genericAjaxGet('customize{$view->id}','c=internal&a=viewCustomize&id={$view->id}');toggleDiv('customize{$view->id}','block');"><span class="glyphicons glyphicons-cogwheel"></span></a>
{if $active_worker->hasPriv("contexts.{$view_context}.export")}<a href="javascript:;" title="{'common.export'|devblocks_translate|capitalize}" class="minimal" onclick="genericAjaxGet('{$view->id}_tips','c=internal&a=viewShowExport&id={$view->id}');toggleDiv('{$view->id}_tips','block');"><span class="glyphicons glyphicons-file-export"></span></a>{/if}
<a href="javascript:;" title="{'common.copy'|devblocks_translate|capitalize}" onclick="genericAjaxGet('{$view->id}_tips','c=internal&a=viewShowCopy&view_id={$view->id}');toggleDiv('{$view->id}_tips','block');"><span class="glyphicons glyphicons-duplicate"></span></a>
<a href="javascript:;" title="{'common.refresh'|devblocks_translate|capitalize}" class="minimal" onclick="genericAjaxGet('view{$view->id}','c=internal&a=viewRefresh&id={$view->id}');"><span class="glyphicons glyphicons-refresh"></span></a>
<input type="checkbox" class="select-all">
</td>
</tr>
</table>
<div id="{$view->id}_tips" class="block" style="display:none;margin:10px;padding:5px;">Loading...</div>
<form id="customize{$view->id}" name="customize{$view->id}" action="#" onsubmit="return false;" style="display:none;"></form>
<form id="viewForm{$view->id}" name="viewForm{$view->id}" action="{devblocks_url}{/devblocks_url}" method="post">
<input type="hidden" name="view_id" value="{$view->id}">
<input type="hidden" name="context_id" value="wgm.freshbooks.contexts.client">
<input type="hidden" name="c" value="wgm.freshbooks">
<input type="hidden" name="a" value="">
<input type="hidden" name="explore_from" value="0">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<table cellpadding="3" cellspacing="0" border="0" width="100%" class="worklistBody">
{* Column Headers *}
<thead>
<tr>
{foreach from=$view->view_columns item=header name=headers}
{* start table header, insert column title and link *}
<th class="{if $view->options.disable_sorting}no-sort{/if}">
{if !$view->options.disable_sorting && !empty($view_fields.$header->db_column)}
<a href="javascript:;" onclick="genericAjaxGet('view{$view->id}','c=internal&a=viewSortBy&id={$view->id}&sortBy={$header}');">{$view_fields.$header->db_label|capitalize}</a>
{else}
<a href="javascript:;" style="text-decoration:none;">{$view_fields.$header->db_label|capitalize}</a>
{/if}
{* add arrow if sorting by this column, finish table header tag *}
{if $header==$view->renderSortBy}
<span class="glyphicons {if $view->renderSortAsc}glyphicons-sort-by-attributes{else}glyphicons-sort-by-attributes-alt{/if}" style="font-size:14px;{if $view->options.disable_sorting}color:rgb(80,80,80);{else}color:rgb(39,123,213);{/if}"></span>
{/if}
</th>
{/foreach}
</tr>
</thead>
{* Column Data *}
{foreach from=$data item=result key=idx name=results}
{if $smarty.foreach.results.iteration % 2}
{$tableRowClass = "even"}
{else}
{$tableRowClass = "odd"}
{/if}
<tbody style="cursor:pointer;">
<tr class="{$tableRowClass}">
<td data-column="label" colspan="{$smarty.foreach.headers.total}">
<input type="checkbox" name="row_id[]" value="{$result.w_id}" style="display:none;">
<b class="subject">{$result.w_account_name}</b>
{*<a href="{devblocks_url}c=example.objects&p=profile&id={$result.w_id}{/devblocks_url}" class="subject">{$result.w_name}</a>*}
{*<a href="javascript:;" onclick="genericAjaxPopup('peek','c=example.objects&a=showEntryPopup&id={$result.w_id}&view_id={$view->id}',null,false,'50%');"><span class="ui-icon ui-icon-newwin" style="display:inline-block;vertical-align:middle;" title="{'views.peek'|devblocks_translate}"></span></a>*}
</td>
</tr>
<tr class="{$tableRowClass}">
{foreach from=$view->view_columns item=column name=columns}
{if substr($column,0,3)=="cf_"}
{include file="devblocks:cerberusweb.core::internal/custom_fields/view/cell_renderer.tpl"}
{elseif $column=="w_updated" || $column=="w_synchronized"}
<td data-column="{$column}" title="{$result.$column|devblocks_date}">
{if !empty($result.$column)}
{$result.$column|devblocks_prettytime}
{/if}
</td>
{elseif $column=="a_email"}
<td data-column="{$column}"><a href="javascript:;" onclick="genericAjaxPopup('peek','c=internal&a=showPeekPopup&context={CerberusContexts::CONTEXT_ADDRESS}&context_id={$result.w_email_id}&view_id={$view->id}',null,false,'50%');">{$result.$column}</a></td>
{elseif $column=="o_name"}
<td data-column="{$column}">
{if empty($result.$column)}
{if !empty($result.a_email_contact_org_id)}
{$org = DAO_ContactOrg::get($result.a_email_contact_org_id)}
{else}
{$org = null}
{/if}
<span style="background-color:rgb(242,222,105);">set org:</span>
<input type="hidden" name="client_id[]" value="{$result.w_id}">
<input type="text" name="org_lookup[]" size="32" value="{if !empty($org)}{$org->name}{/if}" class="autocomplete_org input_search">
<div class="badge badge-lightgray"><a href="javascript:;" style="text-decoration:none;" onclick="$(this).parent().siblings('INPUT.autocomplete_org').val('{$result.w_account_name|replace:"'":"\\'"}');">Add new organization</a></div>
{else}
<a href="javascript:;" onclick="genericAjaxPopup('peek','c=internal&a=showPeekPopup&context={CerberusContexts::CONTEXT_ORG}&context_id={$result.w_org_id}&view_id={$view->id}',null,false,'50%');">{$result.$column}</a>
{/if}
</td>
{else}
<td data-column="{$column}">{$result.$column}</td>
{/if}
{/foreach}
</tr>
</tbody>
{/foreach}
</table>
<div style="padding-top:5px;">
<div style="float:right;">
{math assign=fromRow equation="(x*y)+1" x=$view->renderPage y=$view->renderLimit}
{math assign=toRow equation="(x-1)+y" x=$fromRow y=$view->renderLimit}
{math assign=nextPage equation="x+1" x=$view->renderPage}
{math assign=prevPage equation="x-1" x=$view->renderPage}
{math assign=lastPage equation="ceil(x/y)-1" x=$total y=$view->renderLimit}
{* Sanity checks *}
{if $toRow > $total}{assign var=toRow value=$total}{/if}
{if $fromRow > $toRow}{assign var=fromRow value=$toRow}{/if}
{if $view->renderPage > 0}
<a href="javascript:;" onclick="genericAjaxGet('view{$view->id}','c=internal&a=viewPage&id={$view->id}&page=0');"><<</a>
<a href="javascript:;" onclick="genericAjaxGet('view{$view->id}','c=internal&a=viewPage&id={$view->id}&page={$prevPage}');"><{'common.previous_short'|devblocks_translate|capitalize}</a>
{/if}
({'views.showing_from_to'|devblocks_translate:$fromRow:$toRow:$total})
{if $toRow < $total}
<a href="javascript:;" onclick="genericAjaxGet('view{$view->id}','c=internal&a=viewPage&id={$view->id}&page={$nextPage}');">{'common.next'|devblocks_translate|capitalize}></a>
<a href="javascript:;" onclick="genericAjaxGet('view{$view->id}','c=internal&a=viewPage&id={$view->id}&page={$lastPage}');">>></a>
{/if}
</div>
{if $total}
<div style="float:left;" id="{$view->id}_actions">
<button type="button" class="action-always-show action-linkorgs" style="display:none;"><span class="glyphicons glyphicons-circle-ok" style="color:rgb(0,180,0);"></span> Update Organizations</button>
</div>
{/if}
</div>
<div style="clear:both;"></div>
</form>
<script type="text/javascript">
if($('#view{$view->id} INPUT.autocomplete_org').length > 0) {
ajax.orgAutoComplete('#view{$view->id} INPUT.autocomplete_org');
$('#{$view->id}_actions BUTTON.action-linkorgs')
.click(function() {
genericAjaxPost('viewForm{$view->id}','','c=wgm.freshbooks&a=viewSetOrgs',function() {
genericAjaxGet('view{$view->id}','c=internal&a=viewRefresh&id={$view->id}');
});
})
.show()
;
}
</script>
{include file="devblocks:cerberusweb.core::internal/views/view_common_jquery_ui.tpl"}
<script type="text/javascript">
$frm = $('#viewForm{$view->id}');
{if $pref_keyboard_shortcuts}
$frm.bind('keyboard_shortcut',function(event) {
//console.log("{$view->id} received " + (indirect ? 'indirect' : 'direct') + " keyboard event for: " + event.keypress_event.which);
$view_actions = $('#{$view->id}_actions');
hotkey_activated = true;
switch(event.keypress_event.which) {
default:
hotkey_activated = false;
break;
}
if(hotkey_activated)
event.preventDefault();
});
{/if}
</script>