Bug 27846: clubs, course_reserves, errors and ill folders
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / clubs / templates-add-modify.tt
1 [% USE Branches %]
2 [% USE AuthorisedValues %]
3 [% SET footerjs = 1 %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha &rsaquo; Tools &rsaquo; Patron clubs &rsaquo;
6     [% IF club_template %]
7         Modify club template [% club_template.name | html %]
8     [% ELSE %]
9         Create a new club template
10     [% END %]
11 </title>
12 [% INCLUDE 'doc-head-close.inc' %]
13 <style>
14     .club-field,
15     .enrollment-field {
16         border-top: 1px solid #DDD;
17     }
18 </style>
19 </head>
20
21 <body id="clubs_templates_add_modify" class="clubs">
22 [% INCLUDE 'header.inc' %]
23 [% INCLUDE 'cat-search.inc' %]
24
25 <nav aria-label="Breadcrumb" class="breadcrumb">
26     <ol>
27         <li>
28             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
29         </li>
30         <li>
31             <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
32         </li>
33         <li>
34             <a href="clubs.pl">Patron clubs</a>
35         </li>
36         <li>
37             <a href="#" aria-current="page">
38                 [% IF club_template %]
39                     Modify club template <em>[% club_template.name | html %]</em>
40                 [% ELSE %]
41                     Create a new club template
42                 [% END %]
43             </a>
44         </li>
45     </ol>
46 </nav>
47
48 <div class="main container-fluid">
49     <div class="row">
50         <div class="col-md-8 col-md-offset-2">
51
52             <form method="post" class="validated">
53                 <input type="hidden" name="id" value="[% club_template.id | html %]" />
54
55                 <h2>
56                     [% IF club_template %]
57                         Modify club template <em>[% club_template.name | html %]</em>
58                     [% ELSE %]
59                         Create a new club template
60                     [% END %]
61                 </h2>
62
63
64                 <fieldset class="rows">
65                     <ol>
66                         <li>
67                             <label class="required" for="name">Name:</label>
68                             <input id="club-template-name" name="name" type="text" value="[% club_template.name | html %]" required="required"/>
69                             <span class="required">Required</span>
70                         </li>
71
72                         <li>
73                             <label for="club-template-description">Description:</label>
74                             <input id="club-template-description" name="description" type="text" value="[% club_template.description | html %]" />
75                         </li>
76
77                         <li>
78                             <label for="club-template-is-enrollable-from-opac">Allow public enrollment:</label>
79                             [% IF club_template.is_enrollable_from_opac %]
80                                 <input type="checkbox" id="club-template-is-enrollable-from-opac" name="is_enrollable_from_opac" checked="checked" />
81                             [% ELSE %]
82                                 <input type="checkbox" id="club-template-is-enrollable-from-opac" name="is_enrollable_from_opac" />
83                             [% END %]
84                             <span class="hint">If a template allows public enrollment, patrons can enroll in a club based on this template from the public catalog.</span>
85                         </li>
86
87                         <li>
88                             <label for="club-template-is-email-required">Require valid email address:</label>
89                             [% IF club_template.is_email_required %]
90                                 <input type="checkbox" id="club-template-is-email-required" name="is_email_required" checked="checked" />
91                             [% ELSE %]
92                                 <input type="checkbox" id="club-template-is-email-required" name="is_email_required" />
93                             [% END %]
94                             <span class="hint">If set, a club based on this template can only be enrolled in by patrons with a valid email address.</span>
95                         </li>
96
97                         <li>
98                             <label for="club-template-branchcode">Library:</label>
99                             <select name="branchcode" id="club-template-branchcode">
100                                 <option value=""></option>
101                                 [% PROCESS options_for_libraries libraries => Branches.all( selected => club_template.branchcode ) %]
102                             </select>
103                             <div class="hint">If set, only librarians logged in with this branch will be able to modify this club template.</div>
104                         </li>
105
106                     </ol>
107                 </fieldset>
108
109                 <fieldset class="rows">
110                     <legend>Club fields:</legend>
111                     <p><span class="hint">These fields will be used in the creation of clubs based on this template</span></p>
112                     <div id="club-template-fields">
113                         [% FOREACH f IN club_template.club_template_fields %]
114                             <div class="club-field">
115                                 <ol class="clearfix">
116                                     <input type="hidden" name="club_template_field_id" value="[% f.id | html %]" />
117                                     <li>
118                                         <label for="field-name-[% f.id | html %]">Name:</label>
119                                         <input type="text" name="club_template_field_name" id="field-name-[% f.id | html %]" value="[% f.name | html %]" />
120                                     </li>
121
122                                     <li>
123                                         <label for="field-description-[% f.id | html %]">Description:</label>
124                                         <input type="text" name="club_template_field_description" id="field-description-[% f.id | html %]" value="[% f.description | html %]" />
125                                     </li>
126
127                                     <li>
128                                         <label for="field-authorised-value-category-[% f.id | html %]">Authorised value category:</label>
129                                         <select name="club_template_field_authorised_value_category" id="field-authorised-value-category-[% f.id | html %]">
130                                             <option value=""></option>
131                                             [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => f.authorised_value_category) %]
132                                         </select>
133                                     </li>
134
135                                     <li>
136                                         <label for="field-delete-[% f.id | html %]">Delete field:</label>
137                                         <input type="checkbox" name="club_template_field_delete" id="field-delete-[% f.id | html %]" value="[% f.id | html %]" />
138                                     </li>
139                                 </ol>
140                             </div>
141                         [% END %]
142                     </div>
143                     <fieldset class="action">
144                         <a href="#" class="add_club_field">
145                             <i class="fa fa-plus"></i> Add new field
146                         </a>
147                     </fieldset>
148                 </fieldset>
149
150                 <fieldset class="rows">
151                     <legend>Enrollment fields</legend>
152                     <p><span class="hint">These fields will be used when enrolling a patron in a club based on this template</span></p>
153                     <div id="club-template-enrollment-fields">
154                         [% FOREACH f IN club_template.club_template_enrollment_fields %]
155                             <div class="enrollment-field">
156                                 <ol class="clearfix">
157                                     <li>
158                                         <span class="label">&nbsp;</span>
159                                         <strong>Enrollment field</strong>
160                                     </li>
161                                     <li>
162                                         <input type="hidden" name="club_template_enrollment_field_id" value="[% f.id | html %]" />
163                                         <label for="enrollment-field-name-[% f.id | html %]">Name:</label>
164                                         <input type="text" name="club_template_enrollment_field_name" id="enrollment-field-name-[% f.id | html %]" value="[% f.name | html %]" size="40" />
165                                     </li>
166
167                                     <li>
168                                         <label for="enrollment-field-description-[% f.id | html %]">Description:</label>
169                                         <input type="text" name="club_template_enrollment_field_description" id="enrollment-field-description-[% f.id | html %]" value="[% f.description | html %]" size="40" />
170                                     </li>
171
172                                     <li>
173                                         <label for="enrollment-field-authorised-value-category-[% f.id | html %]">Authorised value category:</label>
174                                         <select name="club_template_enrollment_field_authorised_value_category" id="enrollment-field-authorised-value-category-[% f.id | html %]">
175                                             <option value=""></option>
176                                             [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => f.authorised_value_category) %]
177                                         </select>
178                                     </li>
179
180                                     <li>
181                                         <label for="enrollment-field-delete-[% f.id | html %]">Delete field:</label>
182                                         <input type="checkbox" name="club_template_enrollment_field_delete" id="enrollment-field-delete-[% f.id | html %]" value="[% f.id | html %]" />
183                                     </li>
184                                 </ol>
185                             </div>
186                         [% END %]
187                     </div>
188                     <fieldset class="action">
189                         <a href="#" class="add_enrollment_field">
190                             <i class="fa fa-plus"></i> Add new field
191                         </a>
192                     </fieldset>
193                 </fieldset>
194
195                 <fieldset class="action">
196                     <input type="hidden" name="id" value="[% club_template.id | html %]" />
197                     <input type="submit" value="Save" />
198                     <a href="clubs.pl" class="cancel">Cancel</a>
199                 </fieldset>
200             </form>
201
202         </div> <!-- /.col-md-8 .col-md-offset-2 -->
203     </div> <!-- /.row -->
204
205
206 <div id="new-field-template" class="club-field" style="display:none">
207     <h4 style="margin-left:1em;">New club field</h4>
208     <input type="hidden" name="club_template_field_id" value="" />
209     <ol class="clearfix">
210
211         <li>
212             <label for="club_template_field_name">Name:</label>
213             <input type="text" name="club_template_field_name" />
214         </li>
215
216         <li>
217             <label for="club_template_field_description">Description:</label>
218             <input type="text" name="club_template_field_description" />
219         </li>
220
221         <li>
222             <label for="club_template_field_authorised_value_category">Authorised value category:</label>
223             <select name="club_template_field_authorised_value_category">
224                 <option value=""></option>
225                 [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories() %]
226             </select>
227         </li>
228     </ol>
229     <fieldset class="action"><a href="#" class="delete_club_field"><i class="fa fa-trash"></i> Delete field</a></fieldset>
230     <hr/>
231 </div>
232
233 <div id="new-enrollment-field-template" class="enrollment-field" style="display:none">
234     <h4 style="margin-left:1em;">New enrollment field</h4>
235     <input type="hidden" name="club_template_enrollment_field_id" value="" />
236     <ol class="clearfix">
237
238         <li>
239             <label for="club_template_enrollment_field_name">Name:</label>
240             <input type="text" name="club_template_enrollment_field_name" />
241         </li>
242
243         <li>
244             <label for="club_template_enrollment_field_description">Description:</label>
245             <input type="text" name="club_template_enrollment_field_description" />
246         </li>
247
248         <li>
249             <label for="club_template_enrollment_field_authorised_value_category">Authorised value category:</label>
250             <select name="club_template_enrollment_field_authorised_value_category">
251                 <option value=""></option>
252                 [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories() %]
253             </select>
254         </li>
255     </ol>
256     <fieldset class="action"><a href="#" class="delete_enrollment_field"><i class="fa fa-trash"></i> Delete field</a></fieldset>
257 </div>
258
259
260 [% MACRO jsinclude BLOCK %]
261     <script>
262         $("body").on("click", ".add_club_field", function(e){
263             e.preventDefault();
264             $("#new-field-template").clone().attr("id","").show().appendTo("#club-template-fields");
265         });
266
267         $("body").on("click", ".delete_club_field", function(e){
268             e.preventDefault();
269             $(this).parent().parent().remove();
270         });
271
272         $("body").on("click", ".delete_enrollment_field", function(e){
273             e.preventDefault();
274             $(this).parent().parent().remove();
275         });
276
277         $("body").on("click", ".add_enrollment_field", function(e){
278             e.preventDefault();
279             $('#new-enrollment-field-template').clone().attr('id','').show().appendTo('#club-template-enrollment-fields');
280         });
281     </script>
282 [% END %]
283
284 [% INCLUDE 'intranet-bottom.inc' %]