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