4 [% USE TablesSettings %]
5 [% INCLUDE 'doc-head-open.inc' %]
7 [% IF op =='add_form' %]
12 [% END %] › [% ELSE %]
13 [% IF op == 'delete_confirm' %]
14 Confirm deletion of city › [% END %]
16 Cities › Administration › Koha
18 [% INCLUDE 'doc-head-close.inc' %]
21 <body id="admin_cities" class="admin">
22 [% WRAPPER 'header.inc' %]
23 [% INCLUDE 'cities-admin-search.inc' %]
26 [% WRAPPER 'sub-header.inc' %]
27 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
30 <a href="/cgi-bin/koha/mainpage.pl"><i class="fa fa-home"></i></a>
33 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
36 [% IF op == 'add_form' %]
38 <a href="/cgi-bin/koha/admin/cities.pl">Cities</a>
41 <a href="#" aria-current="page">
43 <span>Modify city</span>
50 [% ELSIF op == 'delete_confirm' %]
52 <a href="/cgi-bin/koha/admin/cities.pl">Cities</a>
55 <a href="#" aria-current="page">
56 Confirm deletion of city
62 <a href="#" aria-current="page">
71 <div class="main container-fluid">
73 <div class="col-sm-10 col-sm-push-2">
76 [% FOR m IN messages %]
77 <div class="dialog [% m.type | html %]">
79 [% CASE 'error_on_update' %]
80 <span>An error occurred when updating this city. Perhaps it already exists.</span>
81 [% CASE 'error_on_insert' %]
82 <span>An error occurred when adding this city. The city id might already exist.</span>
83 [% CASE 'error_on_delete' %]
84 <span>An error occurred when deleting this city. Check the logs.</span>
85 [% CASE 'success_on_update' %]
86 <span>City updated successfully.</span>
87 [% CASE 'success_on_insert' %]
88 <span>City added successfully.</span>
89 [% CASE 'success_on_delete' %]
90 <span>City deleted successfully.</span>
91 [% CASE 'already_exists' %]
92 <span>This city already exists.</span>
94 <span>[% m.code | html %]</span>
99 [% IF op == 'add_form' %]
101 <h1>Modify a city</h1>
106 <form action="/cgi-bin/koha/admin/cities.pl" name="Aform" method="post" class="validated">
107 <input type="hidden" name="op" value="add_validate" />
108 <input type="hidden" name="cityid" value="[% city.cityid | html %]" />
110 <fieldset class="rows">
113 <li><span class="label">City ID: </span>[% city.cityid | html %]</li>
116 <label for="city_name" class="required">City: </label>
117 <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>
120 <label for="city_state">State: </label>
121 <input type="text" name="city_state" id="city_state" size="80" maxlength="100" value="[% city.city_state | html %]" />
124 <label for="city_zipcode" class="required">ZIP/Postal code: </label>
125 <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>
128 <label for="city_country">Country: </label>
129 <input type="text" name="city_country" id="city_country" size="80" maxlength="100" value="[% city.city_country | html %]" />
134 <fieldset class="action">
135 <input type="submit" value="Submit" />
136 <a class="cancel" href="/cgi-bin/koha/admin/cities.pl">Cancel</a>
141 [% IF op == 'delete_confirm' %]
142 <div class="dialog alert">
143 <h1>Delete city "[% city.city_name | html %]?"</h1>
146 <td>[% city.cityid | html %]</td>
149 <td>[% city.city_name | html %]</td>
152 <td>[% city.city_state | html %]</td>
154 <tr><th>ZIP/Postal code</th>
155 <td>[% city.city_zipcode | html %]</td>
158 <td>[% city.city_country | html %]</td>
161 <form action="/cgi-bin/koha/admin/cities.pl" method="post">
162 <input type="hidden" name="op" value="delete_confirmed" />
163 <input type="hidden" name="cityid" value="[% city.cityid | html %]" />
164 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
166 <form action="/cgi-bin/koha/admin/cities.pl" method="get">
167 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
172 [% IF op == 'list' %]
174 <div id="toolbar" class="btn-toolbar">
175 <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>
179 [% IF city_name_filter %]
180 Searching: [% city_name_filter | html %]
183 [% IF cities_count > 0 %]
184 <div class="table_cities_table_controls"></div>
185 <table id="table_cities">
191 <th>ZIP/Postal code</th>
193 <th data-class-name="actions noExport">Actions</th>
198 <div class="dialog message">
199 There are no cities defined. <a href="/cgi-bin/koha/admin/cities.pl?op=add_form">Create a new city</a>.
205 </div> <!-- /.col-sm-10.col-sm-push-2 -->
207 <div class="col-sm-2 col-sm-pull-10">
209 [% INCLUDE 'admin-menu.inc' %]
211 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
212 </div> <!-- /.row -->
214 [% MACRO jsinclude BLOCK %]
215 [% Asset.js("js/admin-menu.js") | $raw %]
216 [% INCLUDE 'datatables.inc' %]
217 [% INCLUDE 'columns_settings.inc' %]
220 var table_settings = [% TablesSettings.GetTableSettings( 'admin', 'cities', 'table_cities', 'json' ) | $raw %];
221 $(document).ready(function() {
222 var cities_table_url = '/api/v1/cities?';
224 [% IF city_name_filter %]
225 var city_name_filter = {
227 "like": '%[%- city_name_filter | html -%]%'
230 cities_table_url += 'q='+ encodeURIComponent(JSON.stringify(city_name_filter));
233 var cities_table = $("#table_cities").kohaTable({
235 "url": cities_table_url
237 "order": [[ 1, "asc" ]],
239 "targets": [0,1,2,3,4],
240 "render": function (data, type, row, meta) {
241 if ( type == 'display' ) {
242 return data.escapeHtml();
264 "data": "postal_code",
274 "data": function( row, type, val, meta ) {
276 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";
277 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>';
285 }, table_settings, 1);
290 [% INCLUDE 'intranet-bottom.inc' %]