Bug 22102: Markup fixes for OPAC article request page
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-request-article.tt
blob25af23ee21a8057678e5f781aa5e2d5110e9b141
1 [% USE Koha %]
2 [% USE Branches %]
3 [% USE ItemTypes %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; Request article</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% BLOCK cssinclude %][% END %]
8 </head>
10 [% INCLUDE 'bodytag.inc' bodyid='opac-request-article' %]
11 [% INCLUDE 'masthead.inc' %]
13 <div class="main">
14     <ul class="breadcrumb">
15         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
16         <li><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | uri %]">Details for: [% biblio.title | html %]</a> <span class="divider">&rsaquo;</span></li>
17         <li><a href="#">Request article</a></li>
18     </ul>
20     <div class="container">
21         [% IF biblio.can_article_request( patron ) %]
22             [% SET article_request_type = biblio.article_request_type( patron ) %]
24             [% IF article_request_type == 'yes' %]       [% SET mandatory_fields = Koha.Preference('ArticleRequestsMandatoryFields') %]           [% END %]
25             [% IF article_request_type == 'bib_only' %]  [% SET mandatory_fields = Koha.Preference('ArticleRequestsMandatoryFieldsRecordOnly') %] [% END %]
26             [% IF article_request_type == 'item_only' %] [% SET mandatory_fields = Koha.Preference('ArticleRequestsMandatoryFieldsItemOnly') %]   [% END %]
28             <h3>Place article request for [% biblio.title | html %]</h3>
30             <form id="place-article-request" method="post" action="/cgi-bin/koha/opac-request-article.pl">
31                 <input type="hidden" name="action" value="create" />
32                 <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblio.biblionumber | html %]" />
34                 <fieldset class="rows">
35                     <ul>
36                         <li>
37                             [% IF mandatory_fields.search('title') %]
38                                 <label for="title" class="required">Title:</label>
39                             [% ELSE %]
40                                 <label for="title">Title:</label>
41                             [% END %]
42                             <input type="text" name="title" id="title" size="50"/>
43                         </li>
45                         <li>
46                             [% IF mandatory_fields.search('author') %]
47                                 <label for="author" class="required">Author:</label>
48                             [% ELSE %]
49                                 <label for="author">Author:</label>
50                             [% END %]
51                             <input type="text" name="author" id="author" size="50"/>
52                         </li>
54                         <li>
55                             [% IF mandatory_fields.search('volume') %]
56                                 <label for="volume" class="required">Volume:</label>
57                             [% ELSE %]
58                                 <label for="volume">Volume:</label>
59                             [% END %]
60                             <input type="text" name="volume" id="volume" size="50"/>
61                         </li>
63                         <li>
64                             [% IF mandatory_fields.search('issue') %]
65                                 <label for="issue" class="required">Issue:</label>
66                             [% ELSE %]
67                                 <label for="issue">Issue:</label>
68                             [% END %]
69                             <input type="text" name="issue" id="issue" size="50"/>
70                         </li>
72                         <li>
73                             [% IF mandatory_fields.search('date') %]
74                                 <label for="date" class="required">Date:</label>
75                             [% ELSE %]
76                                 <label for="date">Date:</label>
77                             [% END %]
78                             <input type="text" name="date" id="date" size="50"/>
79                         </li>
81                         <li>
82                             [% IF mandatory_fields.search('pages') %]
83                                 <label for="pages" class="required">Pages:</label>
84                             [% ELSE %]
85                                 <label for="pages">Pages:</label>
86                             [% END %]
87                             <input type="text" name="pages" id="pages" size="50"/>
88                         </li>
90                         <li>
91                             [% IF mandatory_fields.search('chapters') %]
92                                 <label for="chapters" class="required">Chapters:</label>
93                             [% ELSE %]
94                                 <label for="chapters">Chapters:</label>
95                             [% END %]
96                             <input type="text" name="chapters" id="chapters" size="50"/>
97                         </li>
99                         <li>
100                             <label for="patron_notes">Notes:</label>
101                             <input type="text" name="patron_notes" id="patron_notes" size="50"/>
102                         </li>
104                         <li>
105                             <label for="branchcode">Pickup library:</label>
106                             <select name="branchcode" id="branchcode">
107                                 [% FOREACH b IN Branches.all %]
108                                     [% IF b.branchcode == Branches.GetLoggedInBranchcode %]
109                                         <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
110                                     [% ELSE %]
111                                         <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
112                                     [% END %]
113                                 [% END %]
114                             </select>
115                         </li>
116                     </ul>
117                 </fieldset>
119                 [% IF article_request_type != 'bib_only' %]
120                     <table class="copiesrow table table-bordered table-striped">
121                         <caption>Select a specific item:</caption>
122                         <thead>
123                             <tr>
124                                 <th>&nbsp;</th>
125                                 <th>Item type</th>
126                                 <th>Barcode</th>
127                                 <th>Home library</th>
128                                 <th>Call number</th>
129                                 <th>Enumeration</th>
130                             </tr>
131                         </thead>
133                         <tbody>
134                             [% FOREACH item IN biblio.items %]
135                                 [% IF item.can_article_request( patron ) %]
136                                     <tr>
137                                         <td>
138                                             [% IF article_request_type == 'item_only' && !checked %]
139                                                 [% SET checked = 1 %]
140                                                 <input type="radio" name="itemnumber" value="[% item.itemnumber | html %]" checked="checked" />
141                                             [% ELSE %]
142                                                 <input type="radio" name="itemnumber" value="[% item.itemnumber | html %]" />
143                                             [% END %]
144                                         </td>
145                                         <td>
146                                             [% ItemTypes.GetDescription( item.itype ) | html %]
147                                         </td>
148                                         <td>
149                                             [% item.barcode | html %]
150                                         </td>
151                                         <td>
152                                             [% Branches.GetName( item.homebranch ) | html %]
153                                         </td>
154                                         <td>
155                                             [% item.itemcallnumber | html %]
156                                         </td>
157                                         <td>
158                                             [% item.enumchron | html %]
159                                         </td>
160                                     </tr>
161                                 [% END %]
162                             [% END %]
164                             [% IF article_request_type != 'item_only' %]
165                                 <tr>
166                                     <td>
167                                         <input type="radio" name="itemnumber" value="" checked="checked"/>
168                                     </td>
169                                     <td colspan="6">
170                                         Any item
171                                     </td>
172                                 </tr>
173                             [% END %]
174                         </tbody>
175                     </table>
176                 [% END %]
178                 <input type="submit" class="btn" value="Place request" />
179             </form>
180         [% ELSE %]
181             <h1 class="title">[% biblio.title | html %]</h1>
182             <div class="alert alert-info">
183                 No article requests can be made for this record.
184             </div>
185         [% END %]
187     </div> <!-- / .container -->
188 </div> <!-- / .main -->
190 [% INCLUDE 'opac-bottom.inc' %]
192 [% BLOCK jsinclude %]
193 <script>
194     allow_submit = false;
195     $('#place-article-request').on('submit', function( event ){
196         if ( ! allow_submit ) {
197             event.preventDefault();
199             [% IF article_request_type == 'item_only' %]
200                 if ( ! $("input:radio[name='itemnumber']").is(":checked") ) {
201                     alert( _("Please select a specific item for this article request.") );
202                     return 0;
203                 }
204             [% END %]
206             var mandatory_fields = "[% mandatory_fields | html %]";
207             var m = new Array();
208             if ( mandatory_fields ) m = mandatory_fields.split(",");
209             var f = new Array();
211             for (i = 0; i < m.length; i++) {
212                 if ( ! $("#" + m[i]).val() ) {
213                     f.push( m[i] );
214                 }
215             }
217             if ( f.length ) {
218                 alert( _("The following fields are required and not filled in: ") + f.join(", ") );
219                 return 0;
220             }
222             allow_submit = true;
223             $('#place-article-request').submit();
224         }
225     });
226 </script>
227 [% END %]