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