Bug 29240: Centralise from/to handling
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / clubs / clubs-add-modify.tt
1 [% USE KohaDates %]
2 [% USE Branches %]
3 [% USE AuthorisedValues %]
4 [% SET AuthorisedValuesCategories = AuthorisedValues.GetCategories %]
5 [% SET footerjs = 1 %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>
8     [% IF club %]
9         Modify club [% club.name | html %]
10     [% ELSE %]
11         Create a new [% club_template.name | html %] club
12     [% END %] &rsaquo; Patron clubs &rsaquo; Tools &rsaquo; Koha
13 </title>
14 [% INCLUDE 'doc-head-close.inc' %]
15 </head>
16
17 <body id="clubs_add_modify" class="clubs">
18 [% INCLUDE 'header.inc' %]
19 [% INCLUDE 'cat-search.inc' %]
20
21 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
22     <ol>
23         <li>
24             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
25         </li>
26         <li>
27             <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
28         </li>
29         <li>
30             <a href="clubs.pl">Patron clubs</a>
31         </li>
32         <li>
33             <a href="#" aria-current="page">
34                 [% IF club %]
35                     Modify club <em>[% club.name | html %]</em>
36                 [% ELSE %]
37                     Create a new <em>[% club_template.name | html %]</em> club
38                 [% END %]
39             </a>
40         </li>
41     </ol>
42 </nav>
43
44 <div class="main container-fluid">
45     <div class="row">
46         <div class="col-md-8 col-md-offset-2">
47
48             <form method="post" class="validated">
49                 <input type="hidden" name="id" value="[% club.id | html %]" />
50                 <input type="hidden" name="club_template_id" value="[% club_template.id | html %]" />
51
52                 <fieldset class="rows">
53
54                     <legend>
55                         [% IF club %]
56                             Modify club <em>[% club.name | html %]</em>
57                         [% ELSE %]
58                             Create a new <em>[% club_template.name | html %]</em> club
59                         [% END %]
60                     </legend>
61
62                     <ol>
63                         <li>
64                             <label class="required" for="club-name">Name:</label>
65                             <input id="club-name" name="name" type="text" value="[% club.name | html %]" required="required"/>
66                             <span class="required">Required</span>
67                         </li>
68
69                         <li>
70                             <label for="club-template-name">Description:</label>
71                             <input id="club-template-name" name="description" type="text" value="[% club.description | html %]" size="40" />
72                         </li>
73
74                         <li>
75                             <label for="from">Start date:</label>
76                             <input name="date_start" id="from" size="10" class="flatpickr" data-start_for="to" value="[% club.date_start | $KohaDates %]">
77                         </li>
78
79                         <li>
80                             <label for="to">End date:</label>
81                             <input name="date_end" id="to" size="10" class="flatpickr" value="[% club.date_end | $KohaDates %]" >
82                         </li>
83
84                         <li>
85                             <label for="club-template-branchcode">Library:</label>
86                             <select name="branchcode" id="club-template-branchcode">
87                                 <option value=""></option>
88                                 [% PROCESS options_for_libraries libraries => Branches.all( selected => club.branch.branchcode ) %]
89                             </select>
90                         </li>
91
92                         [% IF club %]
93                             [% FOREACH f IN club.club_fields %]
94                                 <li>
95                                     <input type="hidden" name="club_template_field_id" value="[% f.club_template_field.id | html %]" />
96                                     <input type="hidden" name="club_field_id" value="[% f.id | html %]" />
97
98                                     <label for="club_field_[% f.club_template_field_id | html %]">[% f.club_template_field.name | html %]</label>
99                                     [% IF f.club_template_field.authorised_value_category %]
100                                         <select name="club_field" id="club_field_[% f.club_template_field_id | html %]">
101                                             [% FOREACH a IN AuthorisedValues.Get( f.club_template_field.authorised_value_category ) %]
102                                                 [% IF a.authorised_value == f.value %]
103                                                     <option value="[% a.authorised_value | html %]" selected="selected">[% a.lib | html %]</option>
104                                                 [% ELSE %]
105                                                     <option value="[% a.authorised_value | html %]">[% a.lib | html %]</option>
106                                                 [% END %]
107                                             [% END %]
108                                         </select>
109                                     [% ELSE %]
110                                         <input type="text" name="club_field" id="club_field_[% f.club_template_field_id | html %]" value="[% f.value | html %]" size="40" />
111                                     [% END %]
112                                 </li>
113                             [% END %]
114                         [% ELSE %]
115                             [% FOREACH f IN club_template.club_template_fields %]
116                                 <li>
117                                     <input type="hidden" name="club_template_field_id" value="[% f.id | html %]" />
118
119                                     <label for="club_template_field_[% f.id | html %]">[% f.name | html %]</label>
120                                     [% IF f.authorised_value_category %]
121                                         <select name="club_field" id="club_template_field_[% f.id | html %]">
122                                             [% FOREACH a IN AuthorisedValues.Get( f.authorised_value_category ) %]
123                                                 <option value="[% a.authorised_value | html %]">[% a.lib | html %]</option>
124                                             [% END %]
125                                         </select>
126                                     [% ELSE %]
127                                         <input type="text" name="club_field" id="club_template_field_[% f.id | html %]" size="40" />
128                                     [% END %]
129                                 </li>
130                             [% END %]
131                         [% END %]
132
133                     </ol>
134
135                 </fieldset>
136
137                 <fieldset class="action">
138                     <input type="submit" value="Save" />
139                     <a href="clubs.pl" class="cancel">Cancel</a>
140                 </fieldset>
141             </form>
142         </div>
143     </div>
144
145 [% MACRO jsinclude BLOCK %]
146     [% INCLUDE 'calendar.inc' %]
147 [% END %]
148
149 [% INCLUDE 'intranet-bottom.inc' %]