]> git.koha-community.org Git - koha.git/blob - koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt
Bug 23538: (QA follow-up) Group system preferences into one entry
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / restrictions.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% PROCESS 'patron_restrictions.inc' %]
5 [% SET footerjs = 1 %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>[% IF op == 'add_form' %][% IF ( restriction ) %]Modify restriction '[% PROCESS restriction_type_description %]'[% ELSE %]New restriction[% END %][% END %]
8 [% IF op == 'delete_confirm' %]Confirm deletion of restriction '[% PROCESS restriction_type_description %]'[% END %] &rsaquo; Patron restrictions &rsaquo; Administration &rsaquo; Koha
9 </title>
10 [% INCLUDE 'doc-head-close.inc' %]
11 </head>
12
13 <body id="admin_restrictions" class="admin">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'patrons-admin-search.inc' %]
16
17 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
18     <ol>
19     <li>
20         <a href="/cgi-bin/koha/mainpage.pl">Home</a>
21     </li>
22     <li>
23         <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
24     </li>
25
26     [% IF op == 'list' %]
27         <li>
28             <a href="#" aria-current="page">
29                 Patron restrictions
30             </a>
31         </li>
32     [% END %]
33
34     [% IF op == 'add_form' %]
35         <li>
36             <a href="/cgi-bin/koha/admin/restrictions.pl">Patron restrictions</a>
37         </li>
38         [% IF restriction %]
39             <li>
40                 <a href="#" aria-current="page">
41                     Modify restriction '[% PROCESS restriction_type_description %]'
42                 </a>
43             </li>
44         [% ELSE %]
45             <li>
46                 <a href="#" aria-current="page">
47                     New restriction
48                 </a>
49             </li>
50         [% END %]
51     [% END %]
52
53     [% IF op == 'delete_confirm' %]
54         <li>
55             <a href="/cgi-bin/koha/admin/restrictions.pl">Patron restrictions</a>
56         </li>
57         <li>
58             <a href="#" aria-current="page">
59                 Delete restriction?
60             </a>
61         </li>
62     [% END %]
63     </ol>
64 </nav>
65
66 <div class="main container-fluid">
67     <div class="row">
68         <div class="col-sm-10 col-sm-push-2">
69             <main>
70
71 [% FOR m IN messages %]
72     <div class="dialog [% m.type | html %]">
73         [% SWITCH m.code %]
74         [% CASE 'add_success' %]
75             Type added
76         [% CASE 'update_success' %]
77             Type updated
78         [% CASE 'duplicate_display_text' %]
79             Another restriction already has this label
80         [% CASE 'duplicate_code' %]
81             Another restriction already has this code
82         [% CASE 'delete_success' %]
83             Type deleted
84         [% CASE 'delete_default' %]
85             Cannot delete the default type
86         [% CASE 'delete_system' %]
87             Cannot delete a system type
88         [% CASE %]
89             [% m.code | html %]
90         [% END %]
91     </div>
92 [% END %]
93
94 [% IF op == 'add_form' %]
95     <form id="restriction_form" action="/cgi-bin/koha/admin/restrictions.pl" method="post">
96         <input type="hidden" name="op" value="add_validate" />
97         <input type="hidden" name="checked" value="0" />
98         [% IF restriction %]
99             <h1>Modify restriction [% PROCESS restriction_type_description %]</h1>
100             <input type="hidden" name="is_a_modif" value="1" />
101         [% ELSE %]
102             <h1>New restriction</h1>
103         [% END %]
104         <fieldset class="rows">
105             <ol>
106                 [% IF restriction %]
107                     <li>
108                         <span class="label">Code: </span>[% restriction.code | html %]
109                         <input type="hidden" name="code" value="[% restriction.code | html %]" />
110                     </li>
111                     <li>
112                         <label for="display_text" class="required">Label: </label>
113                         <input type="text" value="[% restriction.display_text | html %]" name="display_text" id="display_text" size="50" maxlength="50" class="required" required="required" />
114                         <span class="required">Required</span>
115                     </li>
116                 [% ELSE %]
117                     <li>
118                         <label for="code" class="required">Code: </label>
119                         <input type="text" name="code" id="code" size="50" maxlength="50" class="required type_input " required="required" />
120                         <span class="required">Required</span>
121                     </li>
122                     <li>
123                         <label for="display_text" class="required">Label: </label>
124                         <input type="text" name="display_text" id="display_text" size="50" maxlength="50" class="required" required="required" />
125                         <span class="required">Required</span>
126                     </li>
127                 [% END %]
128             </ol>
129         </fieldset>
130
131         <fieldset class="action">
132             <input type="submit" value="Save" />
133             <a href="/cgi-bin/koha/admin/restrictions.pl" class="cancel">Cancel</a>
134         </fieldset>
135     </form>
136 [% END %]
137
138 [% IF op == 'delete_confirm' %]
139     <form action="/cgi-bin/koha/admin/restrictions.pl" method="post">
140         <fieldset>
141             <legend>
142                 Confirm restriction deletion
143             </legend>
144
145             <p>Are you sure you want to delete "[% PROCESS restriction_type_description %]"?</p>
146
147             <fieldset class="action">
148                 <input type="hidden" name="op" value="delete_confirmed" />
149                 <input type="hidden" name="code" value="[% restriction.code | html %]" />
150                 <input type="submit" value="Delete this restriction" />
151                 <a class="cancel" href="/cgi-bin/koha/admin/restrictions.pl">Cancel</a>
152             </fieldset>
153         </fieldset>
154     </form>
155 [% END %]
156
157 [% IF op == 'list' %]
158
159     <div id="toolbar" class="btn-toolbar">
160         <a class="btn btn-default" id="newrestriction" href="/cgi-bin/koha/admin/restrictions.pl?op=add_form"><i class="fa fa-plus"></i> New restriction</a>
161     </div>
162
163     <h2>Patron restrictions</h2>
164     [% IF searchfield %]
165         You Searched for [% searchfield | html %]</span>
166     [% END %]
167     [% IF restrictions %]
168         <table id="restriction_types">
169             <thead>
170                 <tr>
171                     <th scope="col">Code</th>
172                     <th scope="col">Label</th>
173                     <th scope="col">Default</th>
174                     <th scope="col">Actions</th>
175                 </tr>
176             </thead>
177             <tbody>
178                 [% FOREACH restriction IN restrictions %]
179                     <tr>
180                         <td>
181                             [% restriction.code | html %]
182                         </td>
183                         <td>
184                             [% PROCESS restriction_type_description %]
185                         </td>
186                         <td>
187                             [% IF restriction.is_default %]Yes[% END %]
188                         </td>
189                         <td class="actions">
190                             <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/restrictions.pl?op=add_form&amp;code=[% restriction.code | uri %]"><i class="fa fa-pencil"></i> Edit</a>
191                             [% IF !restriction.is_system && !restriction.is_default %]
192                                 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/restrictions.pl?op=delete_confirm&amp;code=[% restriction.code | uri %]"><i class="fa fa-trash"></i> Delete</a>
193                             [% END %]
194                             [% IF !restriction.is_system && !restriction.is_default %]
195                                 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/restrictions.pl?op=make_default&amp;code=[% restriction.code | uri %]"><i class="fa fa-archive"></i> Make default</a>
196                             [% END %]
197                         </td>
198                     </tr>
199                 [% END %]
200             </tbody>
201         </table>
202     [% ELSE %]
203         <div class="dialog alert">No restrictions have been defined. <a href="/cgi-bin/koha/admin/restrictions.pl?op=add_form">Create a new restriction</a>.</div>
204     [% END %]
205 [% END %]
206
207             </main>
208         </div> <!-- /.col-sm-10.col-sm-push-2 -->
209
210         <div class="col-sm-2 col-sm-pull-10">
211             <aside>
212                 [% INCLUDE 'admin-menu.inc' %]
213             </aside>
214         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
215      </div> <!-- /.row -->
216
217 [% MACRO jsinclude BLOCK %]
218     [% Asset.js("js/admin-menu.js") | $raw %]
219     [% INCLUDE 'datatables.inc' %]
220     [% INCLUDE 'columns_settings.inc' %]
221     <script>
222         var MSG_DUPLICATE_CODE = _("Restriction code is already in use");
223         var MSG_DUPLICATE_DISPLAY_TEXT = _("Label is already in use");
224         var existing = {
225         [% FOREACH ex IN existing %]
226             [% ex.code | $raw %]: '[% ex.display_text | $raw %]',
227         [% END %]
228         };
229     </script>
230     [% Asset.js("js/restrictiontypes.js") | $raw %]
231 [% END %]
232 [% INCLUDE 'intranet-bottom.inc' %]