Bug 23681: Add Management UI
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / restrictions.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Administration &rsaquo; Patron restrictions &rsaquo; [% IF op == 'add_form' %][% IF ( restriction ) %]Modify restriction '[% restriction.display_text | html %]'[% ELSE %]New restriction[% END %][% END %]
7 [% IF op == 'delete_confirm' %]Confirm deletion of restriction '[% restriction.display_text | html %]'[% END %]
8 </title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 </head>
11
12 <body id="admin_restrictions" class="admin">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'patrons-admin-search.inc' %]
15
16 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; [% IF op == 'add_form' %] <a href="/cgi-bin/koha/admin/restrictions.pl">Patron restrictions</a> &rsaquo; [% IF ( restriction ) %]Modify restriction '[% restriction.display_text | html %]'[% ELSE %]New restriction[% END %][% END %]
17 [% IF op == 'delete_confirm' %] <a href="/cgi-bin/koha/admin/restrictions.pl">Patron restrictions</a> &rsaquo; Confirm deletion of restriction '[% restriction.display_text | html %]'[% END %]
18 [% IF op == 'delete_confirmed' %] <a href="/cgi-bin/koha/admin/categories.pl">Patron restrictions</a> &rsaquo; Restriction deleted[% END %]
19 [% IF op == 'list' %]Patron restrictions[% END %]</div>
20
21 <div class="main container-fluid">
22     <div class="row">
23         <div class="col-sm-10 col-sm-push-2">
24             <main>
25
26 [% FOR m IN messages %]
27     <div class="dialog [% m.type | html %]">
28         [% SWITCH m.code %]
29         [% CASE 'duplicate_display_text' %]
30             Another restriction already has this label
31         [% CASE 'duplicate_code' %]
32             Another restriction already has this code
33         [% CASE %]
34             [% m.code | html %]
35         [% END %]
36     </div>
37 [% END %]
38
39 [% IF op == 'add_form' %]
40     <form id="restriction_form" action="/cgi-bin/koha/admin/restrictions.pl" method="post">
41         <input type="hidden" name="op" value="add_validate" />
42         <input type="hidden" name="checked" value="0" />
43         [% IF restriction %]
44             <h1>Modify restriction [% restriction.display_text | html %]</h1>
45             <input type="hidden" name="is_a_modif" value="1" />
46         [% ELSE %]
47             <h1>New restriction</h1>
48         [% END %]
49         <fieldset class="rows">
50             <ol>
51                 [% IF restriction %]
52                     <li>
53                         <span class="label">Code: </span>[% restriction.code | html %]
54                         <input type="hidden" name="code" value="[% restriction.code | html %]" />
55                     </li>
56                     <li>
57                         <label for="display_text" class="required">Label: </label>
58                         <input type="text" value="[% restriction.display_text | html %]" name="display_text" id="display_text" size="50" maxlength="50" class="required" required="required" />
59                         <span class="required">Required</span>
60                     </li>
61                 [% ELSE %]
62                     <li>
63                         <label for="code" class="required">Code: </label>
64                         <input type="text" name="code" id="code" size="50" maxlength="50" class="required type_input " required="required" />
65                         <span class="required">Required</span>
66                     </li>
67                     <li>
68                         <label for="display_text" class="required">Label: </label>
69                         <input type="text" name="display_text" id="display_text" size="50" maxlength="50" class="required" required="required" />
70                         <span class="required">Required</span>
71                     </li>
72                 [% END %]
73             </ol>
74         </fieldset>
75
76         <fieldset class="action">
77             <input type="submit" value="Save" />
78             <a href="/cgi-bin/koha/admin/restrictions.pl" class="cancel">Cancel</a>
79         </fieldset>
80     </form>
81 [% END %]
82
83 [% IF op == 'delete_confirm' %]
84     <form action="/cgi-bin/koha/admin/restrictions.pl" method="post">
85         <fieldset>
86             <legend>
87                 Confirm restriction deletion
88             </legend>
89
90             <p>Are you sure you want to delete &quot;[% restriction.display_text | html %]&quot;</p>
91
92             <fieldset class="action">
93                 <input type="hidden" name="op" value="delete_confirmed" />
94                 <input type="hidden" name="code" value="[% restriction.code | html %]" />
95                 <input type="submit" value="Delete this restriction" />
96                 <a class="cancel" href="/cgi-bin/koha/admin/restrictions.pl">Cancel</a>
97             </fieldset>
98         </fieldset>
99     </form>
100 [% END %]
101
102 [% IF op == 'list' %]
103
104     <div id="toolbar" class="btn-toolbar">
105         <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>
106     </div>
107
108     <h2>Patron restrictions</h2>
109     [% IF searchfield %]
110         You Searched for [% searchfield | html %]</span>
111     [% END %]
112     [% IF restrictions %]
113         <table id="restriction_types">
114             <thead>
115                 <tr>
116                     <th scope="col">Code</th>
117                     <th scope="col">Label</th>
118                     <th scope="col">Default</th>
119                     <th scope="col">Actions</th>
120                 </tr>
121             </thead>
122             <tbody>
123                 [% FOREACH restriction IN restrictions %]
124                     <tr>
125                         <td>
126                             [% restriction.code | html %]
127                         </td>
128                         <td>
129                             [% restriction.display_text | html %]
130                         </td>
131                         <td>
132                             [% IF restriction.dflt %]Yes[% END %]
133                         </td>
134                         <td class="actions">
135                             <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>
136                             [% IF !restriction.ronly %]
137                                 <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>
138                             [% END %]
139                         </td>
140                     </tr>
141                 [% END %]
142             </tbody>
143         </table>
144     [% ELSE %]
145         <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>
146     [% END %]
147 [% END %]
148
149             </main>
150         </div> <!-- /.col-sm-10.col-sm-push-2 -->
151
152         <div class="col-sm-2 col-sm-pull-10">
153             <aside>
154                 [% INCLUDE 'admin-menu.inc' %]
155             </aside>
156         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
157      </div> <!-- /.row -->
158
159 [% MACRO jsinclude BLOCK %]
160     [% Asset.js("js/admin-menu.js") | $raw %]
161     [% INCLUDE 'datatables.inc' %]
162     [% INCLUDE 'columns_settings.inc' %]
163     <script>
164         var MSG_DUPLICATE_CODE = _("Restriction code is already in use");
165         var MSG_DUPLICATE_DISPLAY_TEXT = _("Label is already in use");
166         var existing = {
167         [% FOREACH ex IN existing %]
168             [% ex.code | $raw %]: '[% ex.display_text | $raw %]',
169         [% END %]
170         };
171     </script>
172     [% Asset.js("js/restrictiontypes.js") | $raw %]
173 [% END %]
174 [% INCLUDE 'intranet-bottom.inc' %]