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