4 [% USE TablesSettings %]
5 [% PROCESS 'i18n.inc' %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>[% FILTER collapse %]
8 [% IF op =='add_form' %]
10 [% tx("Modify city '{city}'", { city = city.city_name }) | html %]
12 [% t("New city") | html %]
15 [% IF op == 'delete_confirm' %]
16 [% tx("Confirm deletion of city '{city}'", { city = city.city_name }) | html %] ›
19 [% t("Cities") | html %] › [% t("Administration") | html %] › [% t("Koha") | html %]
21 [% INCLUDE 'doc-head-close.inc' %]
24 <body id="admin_cities" class="admin">
25 [% WRAPPER 'header.inc' %]
26 [% INCLUDE 'cities-admin-search.inc' %]
29 [% WRAPPER 'sub-header.inc' %]
30 [% WRAPPER breadcrumbs %]
31 [% WRAPPER breadcrumb_item %]
32 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
35 [% IF op == 'add_form' %]
36 [% WRAPPER breadcrumb_item %]
37 <a href="/cgi-bin/koha/admin/cities.pl">Cities</a>
39 [% WRAPPER breadcrumb_item bc_active = 1 %]
41 [% tx("Modify city '{city}'", { city = city.city_name }) | html %]
47 [% ELSIF op == 'delete_confirm' %]
48 [% WRAPPER breadcrumb_item %]
49 <a href="/cgi-bin/koha/admin/cities.pl">Cities</a>
51 [% WRAPPER breadcrumb_item bc_active = 1 %]
52 [% tx("Confirm deletion of city '{city}'", { city = city.city_name }) | html %]
56 [% WRAPPER breadcrumb_item bc_active = 1 %]
59 [% END #/IF op = add_form %]
61 [% END #/ WRAPPER breadcrumbs %]
62 [% END #/ WRAPPER sub-header.inc %]
64 <div class="main container-fluid">
66 <div class="col-sm-10 col-sm-push-2">
69 [% FOR m IN messages %]
70 <div class="dialog [% m.type | html %]">
72 [% CASE 'error_on_update' %]
73 <span>An error occurred when updating this city. Perhaps it already exists.</span>
74 [% CASE 'error_on_insert' %]
75 <span>An error occurred when adding this city. The city ID might already exist.</span>
76 [% CASE 'error_on_delete' %]
77 <span>An error occurred when deleting this city. Check the logs.</span>
78 [% CASE 'success_on_update' %]
79 <span>City updated successfully.</span>
80 [% CASE 'success_on_insert' %]
81 <span>City added successfully.</span>
82 [% CASE 'success_on_delete' %]
83 <span>City deleted successfully.</span>
84 [% CASE 'already_exists' %]
85 <span>This city already exists.</span>
87 <span>[% m.code | html %]</span>
92 [% IF op == 'add_form' %]
95 [% tx("Modify city '{city}'", { city = city.city_name }) | html %]
101 <form action="/cgi-bin/koha/admin/cities.pl" name="Aform" method="post" class="validated">
102 <input type="hidden" name="op" value="add_validate" />
103 <input type="hidden" name="cityid" value="[% city.cityid | html %]" />
105 <fieldset class="rows">
108 <li><span class="label">City ID: </span>[% city.cityid | html %]</li>
111 <label for="city_name" class="required">City: </label>
112 <input type="text" name="city_name" id="city_name" size="80" maxlength="100" value="[% city.city_name | html %]" required="required" class="required focus" /> <span class="required">Required</span>
115 <label for="city_state">State: </label>
116 <input type="text" name="city_state" id="city_state" size="80" maxlength="100" value="[% city.city_state | html %]" />
119 <label for="city_zipcode" class="required">ZIP/Postal code: </label>
120 <input type="text" name="city_zipcode" id="city_zipcode" size="20" maxlength="20" value="[% city.city_zipcode | html %]" required="required" class="required" /> <span class="required">Required</span>
123 <label for="city_country">Country: </label>
124 <input type="text" name="city_country" id="city_country" size="80" maxlength="100" value="[% city.city_country | html %]" />
129 <fieldset class="action">
130 <input type="submit" class="btn btn-primary" value="Submit" />
131 <a class="cancel" href="/cgi-bin/koha/admin/cities.pl">Cancel</a>
136 [% IF op == 'delete_confirm' %]
137 <div class="dialog alert">
139 [% tx("Confirm deletion of city '{city}'", { city = city.city_name }) | html %]
143 <td>[% city.cityid | html %]</td>
146 <td>[% city.city_name | html %]</td>
149 <td>[% city.city_state | html %]</td>
151 <tr><th>ZIP/Postal code</th>
152 <td>[% city.city_zipcode | html %]</td>
155 <td>[% city.city_country | html %]</td>
158 <form action="/cgi-bin/koha/admin/cities.pl" method="post">
159 <input type="hidden" name="op" value="delete_confirmed" />
160 <input type="hidden" name="cityid" value="[% city.cityid | html %]" />
161 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
163 <form action="/cgi-bin/koha/admin/cities.pl" method="get">
164 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
169 [% IF op == 'list' %]
171 <div id="toolbar" class="btn-toolbar">
172 <a class="btn btn-default" id="newcity" href="/cgi-bin/koha/admin/cities.pl?op=add_form"><i class="fa fa-plus"></i> New city</a>
176 [% IF city_name_filter %]
177 <span>Searching: [% city_name_filter | html %]</span>
180 [% IF cities_count > 0 %]
181 <div class="page-section">
182 <div class="table_cities_table_controls"></div>
183 <table id="table_cities">
189 <th>ZIP/Postal code</th>
191 <th data-class-name="actions noExport">Actions</th>
195 </div><!-- /.page-section -->
197 <div class="dialog message">
198 There are no cities defined. <a href="/cgi-bin/koha/admin/cities.pl?op=add_form">Create a new city</a>.
204 </div> <!-- /.col-sm-10.col-sm-push-2 -->
206 <div class="col-sm-2 col-sm-pull-10">
208 [% INCLUDE 'admin-menu.inc' %]
210 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
211 </div> <!-- /.row -->
213 [% MACRO jsinclude BLOCK %]
214 [% Asset.js("js/admin-menu.js") | $raw %]
215 [% INCLUDE 'datatables.inc' %]
216 [% INCLUDE 'columns_settings.inc' %]
219 var table_settings = [% TablesSettings.GetTableSettings( 'admin', 'cities', 'table_cities', 'json' ) | $raw %];
220 $(document).ready(function() {
221 var cities_table_url = '/api/v1/cities?';
223 [% IF city_name_filter %]
224 var city_name_filter = {
226 "like": '%[%- city_name_filter | html -%]%'
229 cities_table_url += 'q='+ encodeURIComponent(JSON.stringify(city_name_filter));
232 var cities_table = $("#table_cities").kohaTable({
234 "url": cities_table_url
236 "order": [[ 1, "asc" ]],
238 "targets": [0,1,2,3,4],
239 "render": function (data, type, row, meta) {
240 if ( type == 'display' ) {
241 return data.escapeHtml();
263 "data": "postal_code",
273 "data": function( row, type, val, meta ) {
275 var result = '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/cities.pl?op=add_form&cityid='+ encodeURIComponent(row.city_id) +'"><i class="fa fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>'+"\n";
276 result += '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/cities.pl?op=delete_confirm&cityid='+ encodeURIComponent(row.city_id) +'"><i class="fa fa-trash" aria-hidden="true"></i> '+_("Delete")+'</a>';
284 }, table_settings, 1);
289 [% INCLUDE 'intranet-bottom.inc' %]