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