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