Lines 133-171
Link Here
|
133 |
Searching: [% searchfield | html %] |
133 |
Searching: [% searchfield | html %] |
134 |
[% END %] |
134 |
[% END %] |
135 |
|
135 |
|
136 |
[% IF cities.count %] |
136 |
<table id="table_cities"> |
137 |
<table id="table_cities"> |
137 |
<thead> |
138 |
<thead> |
138 |
<tr> |
139 |
<tr> |
139 |
<th>City ID</th> |
140 |
<th>City ID</th> |
140 |
<th>City</th> |
141 |
<th>City</th> |
141 |
<th>State</th> |
142 |
<th>State</th> |
142 |
<th>ZIP/Postal code</th> |
143 |
<th>ZIP/Postal code</th> |
143 |
<th>Country</th> |
144 |
<th>Country</th> |
144 |
<th>Actions</th> |
145 |
<th>Actions</th> |
145 |
</tr> |
146 |
</tr> |
146 |
</thead> |
147 |
</thead> |
147 |
</table> |
148 |
<tbody> |
|
|
149 |
[% FOREACH city IN cities %] |
150 |
<tr> |
151 |
<td>[% city.cityid | html %]</td> |
152 |
<td>[% city.city_name | html %]</td> |
153 |
<td>[% city.city_state | html %]</td> |
154 |
<td>[% city.city_zipcode | html %]</td> |
155 |
<td>[% city.city_country | html %]</td> |
156 |
<td class="actions"> |
157 |
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/cities.pl?op=add_form&cityid=[% city.cityid | html %]"><i class="fa fa-pencil"></i> Edit</a> |
158 |
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/cities.pl?op=delete_confirm&cityid=[% city.cityid | html %]"><i class="fa fa-trash"></i> Delete</a> |
159 |
</td> |
160 |
</tr> |
161 |
[% END %] |
162 |
</tbody> |
163 |
</table> |
164 |
[% ELSE %] |
165 |
<div class="dialog message"> |
166 |
There are no cities defined. <a href="/cgi-bin/koha/admin/cities.pl?op=add_form">Create a new city</a>. |
167 |
</div> |
168 |
[% END %] |
169 |
[% END %] |
148 |
[% END %] |
170 |
|
149 |
|
171 |
</main> |
150 |
</main> |
Lines 183-196
Link Here
|
183 |
[% INCLUDE 'datatables.inc' %] |
162 |
[% INCLUDE 'datatables.inc' %] |
184 |
<script> |
163 |
<script> |
185 |
$(document).ready(function() { |
164 |
$(document).ready(function() { |
186 |
$("#table_cities").dataTable($.extend(true, {}, dataTablesDefaults, { |
165 |
var cities_table_url = '/api/v1/cities'; |
187 |
"aoColumnDefs": [ |
166 |
var cities_table = $("#table_cities").api({ |
188 |
{ "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false }, |
167 |
"ajax": { |
189 |
], |
168 |
"url": cities_table_url |
190 |
"aaSorting": [[ 1, "asc" ]], |
169 |
}, |
191 |
"iDisplayLength": 10, |
170 |
'dom': 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', |
192 |
"sPaginationType": "full_numbers" |
171 |
"columns": [ |
193 |
})); |
172 |
{ |
|
|
173 |
"data": "city_id", |
174 |
"searchable": true, |
175 |
"orderable": true |
176 |
}, |
177 |
{ |
178 |
"data": "name", |
179 |
"searchable": true, |
180 |
"orderable": true |
181 |
}, |
182 |
{ |
183 |
"data": "state", |
184 |
"searchable": true, |
185 |
"orderable": true |
186 |
}, |
187 |
{ |
188 |
"data": "postal_code", |
189 |
"searchable": true, |
190 |
"orderable": true |
191 |
}, |
192 |
{ |
193 |
"data": "country", |
194 |
"searchable": true, |
195 |
"orderable": true |
196 |
}, |
197 |
{ |
198 |
"data": function( row, type, val, meta ) { |
199 |
|
200 |
var result = '<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/cities.pl?op=add_form&cityid='+ row.id +'"><i class="fa fa-pencil"></i> Edit</a>'; |
201 |
result += '<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/cities.pl?op=delete_confirm&cityid='+ row.id +'"><i class="fa fa-trash"></i> Delete</a>'; |
202 |
return result; |
203 |
|
204 |
}, |
205 |
"searchable": false, |
206 |
"orderable": false |
207 |
} |
208 |
] |
209 |
}); |
194 |
}); |
210 |
}); |
195 |
</script> |
211 |
</script> |
196 |
[% END %] |
212 |
[% END %] |
197 |
- |
|
|