LP1670457 Action Menu Grid Selection Change
[Evergreen.git] / Open-ILS / src / templates / staff / share / t_autogrid.tt2
1
2 <!-- 
3   Actions row.
4   This sits above the grid and contains the column picker, etc.
5 -->
6
7 <div class="eg-grid-row eg-grid-action-row">
8
9   <div class="eg-grid-primary-label">{{mainLabel}}</div>
10
11   <div class="btn-group" style="margin-top: 4px"
12     is-open="gridMenuIsOpen" ng-if="menuLabel && showMenu" uib-dropdown>
13     <button type="button" class="btn btn-default eg-grid-menu-item" uib-dropdown-toggle>
14       {{menuLabel}}<span class="caret"></span>
15     </button>
16     <ul class="scrollable-menu" uib-dropdown-menu>
17       <li ng-repeat="item in menuItems | filter : { standalone : 'false' }" ng-if="!item.checkbox && !item.hidden()" ng-class="{divider: item.divider}">
18         <a ng-if="!item.divider" href a-disabled="item.disabled()"
19           ng-click="item.handler()">{{item.label}}</a>
20       </li>
21     </ul>
22     <button ng-if="!item.checkbox && !item.hidden()"
23       class="btn btn-default eg-grid-menu-item"
24       ng-disabled="item.disabled()"
25       ng-repeat="item in menuItems | filter : { standalone : 'true' }"
26       ng-click="item.handler()">{{item.label}}</button>
27   </div>
28
29   <!-- if no menu label is present, present menu-items as a 
30        horizontal row of buttons -->
31   <div class="btn-group" ng-if="!menuLabel && showMenu">
32     <button ng-if="!item.checkbox && !item.hidden()"
33       class="btn btn-default eg-grid-menu-item"
34       ng-repeat="item in menuItems"
35       ng-disabled="item.disabled()"
36       ng-click="item.handler(item, item.handlerData)">
37         {{item.label}}
38     </button>
39   </div>
40
41   <!-- Always show checkbox items as a
42        horizontal row of buttons -->
43   <div class="btn-group" ng-if="showMenu">
44     <div ng-if="item.checkbox"
45       class="btn btn-default eg-grid-menu-item"
46       ng-repeat="item in menuItems">
47         <label for="{{item.checkbox}}">{{item.label}}</label>
48         <input style="padding-left: 5px"
49                type="checkbox"
50                id="{{item.checkbox}}"
51                ng-disabled="item.disabled()"
52                ng-model="item.checked"
53                ng-checked="item.checked"
54                ng-change="item.handler(item)"/>
55     </div>
56   </div>
57
58   <!-- putting a flex div here forces the remaining content to float right -->
59   <div class="flex-cell"></div>
60
61   <!-- column picker, pager, etc. -->
62   <div class="btn-group column-picker" ng-show="showPagination || showActions || showPicker">
63
64     <!-- first page -->
65     <button type="button" class="btn btn-default" 
66       ng-show="showPagination"
67       ng-class="{disabled : onFirstPage()}" 
68       ng-click="offset(0);collect()"
69       title="[% l('Start') %]">
70         <span class="glyphicon glyphicon-fast-backward"></span>
71     </button>
72
73     <!-- previous page -->
74     <button type="button" class="btn btn-default" 
75       ng-show="showPagination"
76       ng-class="{disabled : onFirstPage()}"
77       ng-click="decrementPage()"
78       title="[% l('Previous Page') %]">
79         <span class="glyphicon glyphicon-backward"></span>
80     </button>
81
82     <!-- next page -->
83     <!-- todo: paging needs a total count value to be fully functional -->
84     <button type="button" class="btn btn-default" 
85       ng-show="showPagination"
86       ng-class="{disabled : !hasNextPage()}"
87       ng-disabled="!hasNextPage()"
88       ng-click="incrementPage()"
89       title="[% l('Next Page') %]">
90         <span class="glyphicon glyphicon-forward"></span>
91     </button>
92
93     <!-- actions drop-down menu -->
94     <div class="btn-group" ng-show="showActions" ng-if="actionGroups.length > 1 || actionGroups[0].actions.length" uib-dropdown>                                                  
95       <button type="button" class="btn btn-default" uib-dropdown-toggle>
96         [% l('Actions') %] <span class="caret"></span>                       
97       </button>                                                              
98       <ul class="pull-right grid-action-dropdown scrollable-menu" uib-dropdown-menu>
99         <li ng-repeat-start="group in actionGroups">
100           <span style="padding-left: 1em;" ng-if="group.label"><strong><u>{{group.label}}</u></strong></span>
101         </li>
102         <li ng-repeat="action in group.actions" ng-class="{divider: action.divider, disabled: actionDisable(action)}" ng-hide="actionHide(action)">
103           <a ng-if="!action.divider" href
104             ng-click="!actionDisable(action) && actionLauncher(action)">{{action.label}}</a>
105         </li>
106         <span ng-repeat-end></span>
107       </ul>
108     </div>
109
110     <div class="btn-group" uib-dropdown is-open="gridRowCountIsOpen" ng-show="showPagination">
111       <button type="button" title="[% l('Select Row Count') %]"
112         class="btn btn-default" uib-dropdown-toggle>
113         [% l('Rows [_1]', '{{limit()}}') %]
114         <span class="caret"></span>
115       </button>
116       <ul uib-dropdown-menu>
117         <li ng-repeat="t in [5,10,25,50,100]">
118           <a href ng-click='offset(0);limit(t);collect()'>
119             {{t}}
120           </a>
121         </li>
122         <li ng-if="allowAll" ng-repeat="t in [500,1000]">
123           <a href ng-click='offset(0);limit(t);collect()'>
124             {{t}}
125           </a>
126         </li>
127         <li ng-if="allowAll" >
128           <a href ng-click='confirmAllowAllAndCollect();'>[% l('All') %]</a>
129         </li>
130       </ul>
131     </div>
132
133     <div class="btn-group" uib-dropdown is-open="gridPageSelectIsOpen" ng-show="showPagination">
134       <button type="button" title="[% l('Select Page') %]"
135         class="btn btn-default" uib-dropdown-toggle>
136         [% l('Page [_1]', '{{page()}}') %]
137         <span class="caret"></span>
138       </button>
139       <ul uib-dropdown-menu>
140         <li>
141           <div class="input-group">
142             <input type="text" class="form-control"
143               ng-model="pageFromUI"
144               ng-click="$event.stopPropagation()"/>
145             <span class="input-group-btn">
146               <button class="btn btn-default" type="button"
147                 ng-click="goToPage(pageFromUI);pageFromUI='';">
148                 [% l('Go To...') %]
149               </button>
150             </span>
151           </div>
152         </li>
153         <li role="presentation" class="divider"></li>
154         <li ng-repeat="t in [1,2,3,4,5,10,25,50,100]">
155           <a href ng-click='goToPage(t);gridPageSelectIsOpen=false;'>{{t}}</a>
156         </li>
157       </ul>
158     </div>
159
160     <div class="btn-group" uib-dropdown is-open="gridColumnPickerIsOpen" ng-show="showPicker">
161       <button type="button" 
162         class="btn btn-default" uib-dropdown-toggle>
163         <span class="caret"></span>
164       </button>
165       <ul class="pull-right eg-grid-column-picker" uib-dropdown-menu>
166         <li>
167           <a href ng-click="showColumnDialog()">
168             <span class="glyphicon glyphicon-wrench"></span>
169             [% l('Manage Columns') %]
170           </a>
171         </li>
172         <li><a href ng-click="toggleConfDisplay()">
173           <span class="glyphicon glyphicon-resize-horizontal"></span>
174           [% l('Manage Column Widths') %]
175         </a></li>
176         <li><a href ng-click="saveConfig()">
177           <span class="glyphicon glyphicon-floppy-save"></span>
178           [% l('Save Columns') %]
179         </a></li>
180 <!--
181         <li><a href ng-click="showAllColumns()">
182           <span class="glyphicon glyphicon-resize-full"></span>
183           [% l('Show All Columns') %]
184         </a></li>
185         <li><a href ng-click="hideAllColumns()">
186           <span class="glyphicon glyphicon-resize-small"></span>
187           [% l('Hide All Columns') %]
188         </a></li>
189 -->
190         <li><a href ng-click="resetColumns()">
191           <span class="glyphicon glyphicon-refresh"></span>
192           [% l('Reset Columns') %]
193         </a></li>
194         <li><a ng-click="generateCSVExportURL($event)" 
195           download="{{csvExportFileName}}.csv" ng-href="{{csvExportURL}}">
196           <span class="glyphicon glyphicon-download"></span>
197           [% l('Download Full CSV') %]
198         </a></li>
199         <li><a href ng-click="printHTML()">
200           <span class="glyphicon glyphicon-print"></span>
201           [% l('Print Full Grid') %]
202         </a></li>
203         <li role="presentation" class="divider"></li>
204         <li ng-repeat="col in columns">
205           <a href title="{{col.idlclass}}" ng-click="toggleColumnVisibility(col)">
206               <span ng-if="col.visible" 
207                 class="label label-success">&#x2713;</span>
208               <span ng-if="!col.visible" 
209                 class="label label-warning">&#x2717;</span>
210               <span>{{col.label}}</span>
211           </a>
212         </li>
213       </ul>
214     </div>
215   </div>
216 </div>
217
218 <!-- Grid -->
219 <div class="eg-grid" ng-class="{'eg-grid-as-conf' : showGridConf}">
220
221   <!-- import our eg-grid-field defs -->
222   <div style="display: none;" ng-transclude></div>
223
224   <div class="eg-grid-row eg-grid-header-row">
225     <div class="eg-grid-cell eg-grid-cell-stock" ng-show="showIndex">
226       <div title="[% l('Row Number Column') %]">[% l('#') %]</div>
227     </div>
228     <div class="eg-grid-cell eg-grid-cell-stock" ng-show="canMultiSelect">
229       <div>
230         <input aria-label="[% l('All rows') %]"
231           focus-me="gridControls.focusRowSelector"
232           type='checkbox' ng-model="selectAll"/> 
233       </div>
234     </div>
235     <div class="eg-grid-cell eg-grid-cell-stock-status" ng-show="statusColumn.isEnabled">
236       <div title="[% l('Status Icon Column') %]">[% l('Status') %]</div>
237     </div>
238     <div class="eg-grid-cell"
239         eg-grid-column-drag-dest
240         ng-class="{'eg-grid-column-last-mod' : isLastModifiedColumn(col)}"
241         column="{{col.name}}"
242         eg-right-click="onContextMenu($event)"
243         ng-repeat="col in columns"
244         style="flex:{{col.flex}}"
245         ng-show="col.visible">
246
247         <div style="display:flex">
248           <div style="flex:1" class="eg-grid-column-move-handle">
249             <div ng-if="col.sortable">
250               <a column="{{col.name}}" href
251                 eg-grid-column-drag-source
252                 ng-click="quickSort(col.name)">{{col.label}}</a>
253             </div>
254             <div ng-if="!col.sortable">
255               <div column="{{col.name}}" eg-grid-column-drag-source>{{col.label}}</div>
256             </div>
257           </div>
258           <div eg-grid-column-drag-source 
259             drag-type="resize" column="{{col.name}}" 
260             class="eg-grid-column-resize-handle">&nbsp;</div>
261         </div>
262     </div>
263   </div>
264
265   <!-- Inline grid configuration row -->
266   <div class="eg-grid-row eg-grid-conf-row" ng-show="showGridConf">
267     <div class="eg-grid-cell"
268       ng-class="statusColumn.isEnabled ? 'eg-grid-cell-conf-header-status' : 'eg-grid-cell-conf-header'">
269       <div class="eg-grid-conf-cell-entry">[% l('Expand') %]</div>
270       <div class="eg-grid-conf-cell-entry">[% l('Shrink') %]</div>
271     </div>
272     <div class="eg-grid-cell"
273       ng-repeat="col in columns"
274       style="flex:{{col.flex}}"
275       ng-show="col.visible">
276       <div class="eg-grid-conf-cell-entry">
277         <a href="" title="[% l('Make column wider') %]"
278           ng-click="modifyColumnFlex(col,1)">
279           <span class="glyphicon glyphicon-resize-full"></span>
280         </a>
281       </div>
282       <div class="eg-grid-conf-cell-entry">
283         <a href="" title="[% l('Make column narrower') %]"
284           ng-click="modifyColumnFlex(col,-1)">
285           <span class="glyphicon glyphicon-resize-small"></span>
286         </a>
287       </div>
288     </div>
289   </div>
290
291   <div class="eg-grid-content-body">
292     <div ng-show="items.length == 0" 
293       class="alert alert-info">[% l('No Items To Display') %]</div>
294
295     <div class="eg-grid-row" 
296         id="eg-grid-row-{{$index + 1}}"
297         ng-repeat="item in items"
298         ng-show="items.length > 0"
299         ng-class="[{'eg-grid-row-selected' : selected[indexValue(item)]}, rowClass.apply(item)]">
300       <div class="eg-grid-cell eg-grid-cell-stock" ng-show="showIndex"
301         ng-click="handleRowClick($event, item)" title="[% l('Row Index') %]">
302         <a href ng-show="gridControls.activateItem" 
303           ng-click="gridControls.activateItem(item)" style="font-weight:bold">
304           {{$index + offset() + 1}}
305         </a>
306         <div ng-hide="gridControls.activateItem">{{$index + offset() + 1}}</div>
307       </div>
308       <div class="eg-grid-cell eg-grid-cell-stock" ng-show="canMultiSelect">
309         <!-- ng-click=handleRowClick here has unintended 
310              consequences and is unnecessary, avoid it -->
311         <div>
312           <input type='checkbox' aria-label="[% l('Row [_1]','{{$index + offset() + 1}}') %]"
313             ng-change="updateSelected()"
314             ng-model="selected[indexValue(item)]"/>
315         </div>
316       </div>
317       <div class="eg-grid-cell eg-grid-cell-stock-status" ng-show="statusColumn.isEnabled">
318           <span ng-bind-html="statusColumn.template(item)"></span>
319       </div>
320       <div class="eg-grid-cell eg-grid-cell-content"
321           ng-click="handleRowClick($event, item)"
322           ng-dblclick="gridControls.activateItem(item)"
323           ng-repeat="col in columns"
324           ng-class="col.cssSelector"
325           style="text-align:{{col.align}}; flex:{{col.flex}}"
326           ng-if="col.visible">
327
328           <!-- if the cell comes with its own template,
329                translate that content into HTML and insert it here -->
330           <span ng-if="col.template && !col.compiled" 
331             style="padding-left:5px; padding-right:10px;">
332             <span tooltip-class="eg-grid-tooltip"
333               tooltip-class="eg-grid-tooltip"
334               tooltip-placement="top-left"
335               uib-tooltip-html="getHtmlTooltip(col, item)">
336               <span ng-bind-html="translateCellTemplate(col, item)"></span>
337             </span>
338           </span>
339
340           <span ng-if="col.template && col.compiled" style="padding-left:5px; padding-right:10px;"
341             compile="col.template">
342           </span>
343
344           <!-- otherwise, simply display the item value, which may 
345                pass through datatype-specific filtering. -->
346           <span ng-if="!col.template" 
347             uib-tooltip="{{itemFieldValue(item, col) | egGridValueFilter:col:item}}"
348             tooltip-placement="top-left"
349             tooltip-class="eg-grid-tooltip"
350             style="padding-left:5px; padding-right:10px;">
351             {{itemFieldValue(item, col) | egGridValueFilter:col:item}}
352           </span>
353       </div>
354     </div>
355   </div>
356
357
358 </div>
359