Bug 20538: Remove the need of writing [% KOHA_VERSION %] everywhere
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / cities.tt
1 [% USE Asset %]
2 [% SET footerjs = 1 %]
3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha &rsaquo; Administration &rsaquo; [% IF op =='add_form' %]Cities &rsaquo; [% IF city.cityid %] Modify city[% ELSE %] New city[% END %][% ELSE %][% IF op == 'delete_confirm' %]Cities &rsaquo; Confirm deletion of city[% ELSE %] Cities[% END %][% END %]</title>
5 [% INCLUDE 'doc-head-close.inc' %]
6 [% Asset.css("css/datatables.css") %]
7 </head>
8
9 <body id="admin_cities" class="admin">
10 [% INCLUDE 'header.inc' %]
11 [% INCLUDE 'cities-admin-search.inc' %]
12
13 <div id="breadcrumbs">
14     <a href="/cgi-bin/koha/mainpage.pl">Home</a>
15     &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
16     &rsaquo; <a href="/cgi-bin/koha/admin/cities.pl">Cities</a>
17     [% IF op == 'add_form' %]
18     &rsaquo; [% IF city.cityid %]Modify[% ELSE %]New[% END %] City
19     [% ELSIF op == 'delete_confirm' %]
20     &rsaquo; Confirm deletion of city
21     [% END %]
22 </div>
23
24 <div id="doc3" class="yui-t2">
25
26    <div id="bd">
27     <div id="yui-main">
28     <div class="yui-b">
29
30 [% FOR m IN messages %]
31     <div class="dialog [% m.type %]">
32         [% SWITCH m.code %]
33         [% CASE 'error_on_update' %]
34             An error occurred when updating this city. Perhaps it already exists.
35         [% CASE 'error_on_insert' %]
36             An error occurred when adding this city. The city id might already exist.
37         [% CASE 'error_on_delete' %]
38             An error occurred when deleting this city. Check the logs.
39         [% CASE 'success_on_update' %]
40             City updated successfully.
41         [% CASE 'success_on_insert' %]
42             City added successfully.
43         [% CASE 'success_on_delete' %]
44             City deleted successfully.
45         [% CASE 'already_exists' %]
46             This city already exists.
47         [% CASE %]
48             [% m.code %]
49         [% END %]
50     </div>
51 [% END %]
52
53 [% IF op == 'add_form' %]
54     [% IF city %]
55         <h1>Modify a city</h1>
56     [% ELSE %]
57         <h1>New city</h1>
58     [% END %]
59
60     <form action="/cgi-bin/koha/admin/cities.pl" name="Aform" method="post" class="validated">
61         <input type="hidden" name="op" value="add_validate" />
62         <input type="hidden" name="cityid" value="[% city.cityid %]" />
63
64         <fieldset class="rows">
65             <ol>
66                 [% IF city %]
67                     <li><span class="label">City ID: </span>[% city.cityid %]</li>
68                 [% END %]
69                 <li>
70                     <label for="city_name" class="required">City: </label>
71                     <input type="text" name="city_name" id="city_name" size="80" maxlength="100" value="[% city.city_name |html %]" required="required" class="required" /> <span class="required">Required</span>
72                 </li>
73                 <li>
74                     <label for="city_state">State: </label>
75                     <input type="text" name="city_state" id="city_state" size="80" maxlength="100" value="[% city.city_state |html %]" />
76                 </li>
77                 <li>
78                     <label for="city_zipcode" class="required">ZIP/Postal code: </label>
79                     <input type="text" name="city_zipcode" id="city_zipcode" size="20" maxlength="20" value="[% city.city_zipcode %]" required="required" class="required" /> <span class="required">Required</span>
80                 </li>
81                 <li>
82                     <label for="city_country">Country: </label>
83                     <input type="text" name="city_country" id="city_country" size="80" maxlength="100" value="[% city.city_country |html %]" />
84                 </li>
85             </ol>
86         </fieldset>
87
88         <fieldset class="action">
89             <input type="submit" value="Submit" />
90             <a class="cancel" href="/cgi-bin/koha/admin/cities.pl">Cancel</a>
91         </fieldset>
92     </form>
93 [% END %]
94
95 [% IF op == 'delete_confirm' %]
96     <div class="dialog alert">
97         <h3>Delete city "[% city.city_name %]?"</h3>
98         <table>
99             <tr><th>City id</th>
100                 <td>[% city.cityid %]</td>
101             </tr>
102             <tr><th>City</th>
103                 <td>[% city.city_name %]</td>
104             </tr>
105             <tr><th>State</th>
106                 <td>[% city.city_state %]</td>
107             </tr>
108             <tr><th>ZIP/Postal code</th>
109                 <td>[% city.city_zipcode %]</td>
110             </tr>
111             <tr><th>Country</th>
112                 <td>[% city.city_country %]</td>
113             </tr>
114         </table>
115         <form action="/cgi-bin/koha/admin/cities.pl" method="post">
116             <input type="hidden" name="op" value="delete_confirmed" />
117             <input type="hidden" name="cityid" value="[% city.cityid %]" />
118             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
119         </form>
120         <form action="/cgi-bin/koha/admin/cities.pl" method="get">
121             <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
122         </form>
123     </div>
124 [% END %]
125
126 [% IF op == 'list' %]
127
128     <div id="toolbar" class="btn-toolbar">
129         <a class="btn btn-default btn-sm" id="newcity" href="/cgi-bin/koha/admin/cities.pl?op=add_form"><i class="fa fa-plus"></i> New city</a>
130     </div>
131
132     <h2>Cities</h2>
133     [% IF searchfield %]
134         Searching: [% searchfield |html %]
135     [% END %]
136
137     [% IF cities.count %]
138         <table id="table_cities">
139             <thead>
140                 <th>City ID</th>
141                 <th>City</th>
142                 <th>State</th>
143                 <th>ZIP/Postal code</th>
144                 <th>Country</th>
145                 <th>Actions</th>
146             </thead>
147             <tbody>
148                 [% FOREACH city IN cities %]
149                 <tr>
150                     <td>[% city.cityid %]</td>
151                     <td>[% city.city_name %]</td>
152                     <td>[% city.city_state %]</td>
153                     <td>[% city.city_zipcode %]</td>
154                     <td>[% city.city_country %]</td>
155                     <td class="actions">
156                         <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/cities.pl?op=add_form&amp;cityid=[% city.cityid %]"><i class="fa fa-pencil"></i> Edit</a>
157                         <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/cities.pl?op=delete_confirm&amp;cityid=[% city.cityid %]"><i class="fa fa-trash"></i> Delete</a>
158                     </td>
159                 </tr>
160                 [% END %]
161             </tbody>
162         </table>
163     [% ELSE %]
164         <div class="dialog message">
165             There are no cities defined. <a href="/cgi-bin/koha/admin/cities.pl?op=add_form">Create a new city</a>.
166         </div>
167     [% END %]
168 [% END %]
169
170 </div>
171 </div>
172 <div class="yui-b">
173 [% INCLUDE 'admin-menu.inc' %]
174 </div>
175 </div>
176
177 [% MACRO jsinclude BLOCK %]
178     [% Asset.js("js/admin-menu.js") %]
179     [% INCLUDE 'datatables.inc' %]
180     <script type="text/javascript">
181         $(document).ready(function() {
182             $("#table_cities").dataTable($.extend(true, {}, dataTablesDefaults, {
183                 "aoColumnDefs": [
184                     { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
185                 ],
186                 "aaSorting": [[ 1, "asc" ]],
187                 "iDisplayLength": 10,
188                 "sPaginationType": "full_numbers"
189             }));
190         });
191     </script>
192 [% END %]
193 [% INCLUDE 'intranet-bottom.inc' %]