Bug 30735: Fix filtering by patron attribute with AV in overdues report
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / course_reserves / course.tt
1 [% PROCESS 'i18n.inc' %]
2 [% SET footerjs = 1 %]
3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>[% IF course_name %] Edit [% course_name | html %] [% ELSE %] New course [% END %] &rsaquo; Course reserves &rsaquo; Koha</title>
5 [% INCLUDE 'doc-head-close.inc' %]
6 <style>
7     #course_instructors {
8         float: left;
9     }
10     .instructor_line {
11         padding: .3em;
12     }
13 </style>
14 </head>
15
16 <body id="courses_course" class="course">
17
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/course_reserves/course-reserves.pl">Course reserves</a>
28         </li>
29         <li>
30             <a href="#" aria-current="page">
31                 [% IF course_name %] Edit <em>[% course_name | html %]</em> [% ELSE %] New course [% END %]
32             </a>
33         </li>
34     </ol>
35 </nav>
36
37 [% IF ( departments ) %]
38
39     <div class="main container-fluid">
40         <div class="row">
41             <div class="col-md-8 col-md-offset-2">
42                 <h1>[% IF course_name %] Edit <em>[% course_name | html %]</em> [% ELSE %] New course [% END %]</h1>
43
44             <form method="post" action="/cgi-bin/koha/course_reserves/mod_course.pl" class="validated">
45                 [% IF course_id %]<input type="hidden" name="course_id" value="[% course_id | html %]" />[% END %]
46                 <fieldset class="rows">
47                     <legend>[% IF course_id %]Edit course[% ELSE %]Create course[% END %]</legend>
48                     <ol>
49                         <li>
50                             <label class="required" for="department">Department:</label>
51                             <select id="department" name="department" required="required" class="required">
52                                 <option value="">Select a department</option>
53
54                                 [% FOREACH d IN departments %]
55                                     [% IF d.authorised_value == department %]
56                                         <option value="[% d.authorised_value | html %]" selected="selected">[% d.lib | html %]</option>
57                                     [% ELSE %]
58                                         <option value="[% d.authorised_value | html %]">[% d.lib | html %]</option>
59                                     [% END %]
60                                 [% END %]
61                             </select>
62                             <span class="required">Required</span>
63                         </li>
64
65                         <li>
66                             <label class="required" for="course_number">Course number:</label>
67                             <input id="course_number" name="course_number" type="text" value="[% course_number | html %]" required="required" class="required" />
68                             <span class="required">Required</span>
69                         </li>
70
71                         <li>
72                             <label for="section">Section:</label>
73                             <input id="section" name="section" type="text" value="[% section | html %]"/>
74                         </li>
75
76                         <li>
77                             <label class="required" for="course_name">Course name:</label>
78                             <input id="course_name" name="course_name" type="text" value="[% course_name | html %]" required="required" class="required" />
79                             <span class="required">Required</span>
80                         </li>
81
82                         <li>
83                             [% IF terms %]
84                                 <label for="term">[% tp('Semester', 'Term:') | html %]</label>
85                                 <select id="term" name="term">
86                                     <option value=""></option>
87
88                                     [% FOREACH t IN terms %]
89                                         [% IF t.authorised_value == term %]
90                                             <option value="[% t.authorised_value | html %]" selected="selected">[% t.lib | html %]</option>
91                                         [% ELSE %]
92                                             <option value="[% t.authorised_value | html %]">[% t.lib | html %]</option>
93                                         [% END %]
94                                     [% END %]
95                                 </select>
96                             [% ELSE %]
97                                 <span class="label">[% tp('Semester', 'Term:') | html %] </span>
98                                 <span id="term">No TERM authorised values found! Please create one or more authorised values with the category TERM.</span>
99                             [% END %]
100                         </li>
101
102                         <li>
103                             <span class="label">Instructors:</span>
104
105                             <div id="course_instructors">
106                                  <div id="instructors">
107                                     [% FOREACH i IN instructors %]
108                                         <div class="instructor_line" id="borrower_[% i.borrowernumber | html %]">[% i.surname | html %], [% i.firstname | html %] ( <a href="#" class="removeInstructor"><i class="fa fa-trash"></i> Remove </a> )
109                                              <input type='hidden' name='instructors' value='[% i.borrowernumber | html %]' />
110                                          </div>
111                                      [% END %]
112                                  </div>
113                                 <p>
114                                     <label for="find_instructor">Instructor search:</label>
115                                     <input autocomplete="off" id="find_instructor" type="text" style="width:150px" class="noEnterSubmit"/>
116                                 </p>
117                                 <div id="find_instructor_container"></div>
118                             </div>
119                         <li>
120                             <label for="staff_note">Staff note:</label>
121                             <textarea name="staff_note" id="staff_note">[% staff_note | html %]</textarea>
122                         </li>
123
124                         <li>
125                             <label for="public_note">Public note:</label>
126                             <textarea name="public_note" id="public_note">[% public_note | html %]</textarea>
127                         </li>
128
129                         <li>
130                             <label for="students_count">Number of students:</label>
131                             <input id="students_count" name="students_count" type="text" value="[% students_count | html %]" />
132                         </li>
133
134                         <li>
135                             <label for="enabled">Enabled?</label>
136                             [% IF enabled == 'no' %]
137                                 <input type="checkbox" name="enabled" id="enabled" />
138                             [% ELSE %]
139                                 <input type="checkbox" name="enabled" id="enabled" checked="checked" />
140                             [% END %]
141                         </li>
142                     </ol>
143                 </fieldset>
144
145                 <fieldset class="action">
146                     <input type="submit" value="Save" class="submit" />
147
148                     [% IF course_id %]
149                         <a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course_id | uri %]" class="cancel">Cancel</a>
150                     [% ELSE %]
151                         <a href="/cgi-bin/koha/course_reserves/course-reserves.pl" class="cancel">Cancel</a>
152                     [% END %]
153                 </fieldset>
154             </form>
155         </div>
156     </div>
157
158 [% ELSE %]
159
160 <div class="dialog alert">
161     <h1>No DEPARTMENT authorized values found!</h1>
162     <p>
163         [% IF ( CAN_user_parameters ) %]
164             Please <a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=DEPARTMENT">create one or more authorized values</a> with the category DEPARTMENT.
165         [% ELSE %]
166             An administrator must create one or more authorized values with the category DEPARTMENT.
167         [% END %]
168     </p>
169 </div>
170
171 [% END %]
172
173 [% IF ( departments ) %]
174     [% MACRO jsinclude BLOCK %]
175         <script>
176             $(document).ready(function(){
177                 $( "#find_instructor" ).autocomplete({
178                     source: "/cgi-bin/koha/circ/ysearch.pl",
179                     minLength: 3,
180                     select: function( event, ui ) {
181                         AddInstructor( ui.item.surname + ", " + ui.item.firstname, ui.item.borrowernumber );
182                         return false;
183                     }
184                 })
185                 .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
186                     return $( "<li></li>" )
187                     .data( "ui-autocomplete-item", item )
188                     .append(
189                         "<a>"
190                             + ( item.surname ? item.surname.escapeHtml() : "" )
191                             + ", "
192                             + ( item.firstname ? item.firstname.escapeHtml() : "" )
193                             + " (" + ( item.cardnumber ? item.cardnumber.escapeHtml() : "" ) + ")"
194                             + " "
195                             + "<small>"
196                                 + ( item.address ? item.address.escapeHtml() : "" )
197                                 + " "
198                                 + ( item.city ? item.city.escapeHtml() : "" )
199                                 + " "
200                                 + ( item.zipcode ? item.zipcode.escapeHtml() : "" )
201                                 + " "
202                                 + ( item.country ? item.country.escapeHtml() : "" )
203                             + "</small>"
204                         + "</a>" )
205                     .appendTo( ul );
206                 };
207
208                 if ( ! $('#instructors').html() ) {
209                     $('#course_instructors').hide();
210                 }
211
212                 $("body").on("click",".removeInstructor",function(e){
213                     e.preventDefault();
214                     var divid = $(this).parent().attr("id");
215                     var borrowernumber = divid.replace("borrower_","");
216                     RemoveInstructor(borrowernumber);
217                 });
218             });
219
220             function AddInstructor( name, borrowernumber ) {
221                 div = "<div class='instructor_line' id='borrower_" + borrowernumber + "'>" + ( name ? name.escapeHtml() : "" ) + " ( <a href='#' class='removeInstructor'><i class='fa fa-trash'></i> " + _("Remove")+ " </a> ) <input type='hidden' name='instructors' value='" + borrowernumber + "' /></div>";
222                 $('#instructors').append( div );
223
224                 $('#find_instructor').val('').focus();
225                 $('#course_instructors').show();
226             }
227
228             function RemoveInstructor( borrowernumber ) {
229                 $( '#borrower_' + borrowernumber ).remove();
230
231                 if ( ! $('#instructors').html() ) {
232                     $('#course_instructors').hide( 800 );
233                 }
234             }
235         </script>
236     [% END %]
237 [% END %]
238
239 [% INCLUDE 'intranet-bottom.inc' %]