Bug 10904: Limit patron update request management by branch
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / supplier.tt
1 [% USE KohaDates %]
2 [% BLOCK edit_contact %]
3     <ol id="contact-form">
4         <input type="hidden" name="contact_id" value="[% contact.id %]" />
5         <li><label for="contact_name[% contact.id %]">Contact name: </label>
6             <input type="text" size="40" id="contact_name[% contact.id %]" name="contact_name" value="[% contact.name %]" /></li>
7         <li><label for="contact_position[% contact.id %]">Position: </label>
8             <input type="text" size="40" id="contact_position[% contact.id %]" name="contact_position" value="[% contact.position %]" /></li>
9         <li><label for="contact_phone[% contact.id %]">Phone: </label>
10                 <input type="text" size="20" id="contact_phone[% contact.id %]" name="contact_phone" value="[% contact.phone %]" /> </li>
11         <li><label for="contact_altphone[% contact.id %]">Alternative phone: </label>
12             <input type="text" size="20" id="contact_altphone[% contact.id %]" name="contact_altphone" value="[% contact.altphone %]" /></li>
13         <li><label for="contact_fax[% contact.id %]">Fax: </label>
14             <input type="text" size="20" id="contact_fax[% contact.id %]" name="contact_fax" value="[% contact.fax %]" /></li>
15         <li><label for="contact_email[% contact.id %]">Email: </label>
16             <input type="text" size="40" id="contact_email[% contact.id %]" name="contact_email" value="[% contact.email %]" /></li>
17         <li><label for="contact_notes[% contact.id %]">Notes: </label>
18             <textarea id="contact_notes[% contact.id %]" name="contact_notes" cols="40" rows="4">[% contact.notes %]</textarea></li>
19         <li><label for="contact_acqprimary[% contact.id %]">Primary acquisitions contact</label>
20             [% IF contact.acqprimary %]
21                 <input type="checkbox" id="contact_acqprimary[% contact.id %]" class="contact_acqprimary" checked="checked"></input>
22             [% ELSE %]
23                 <input type="checkbox" id="contact_acqprimary[% contact.id %]" class="contact_acqprimary"></input>
24             [% END %]
25             <input type="hidden" class="contact_acqprimary_hidden" name="contact_acqprimary" value="[% contact.acqprimary %]"></input>
26         <li><label for="contact_serialsprimary[% contact.id %]">Primary serials contact</label>
27             [% IF contact.serialsprimary %]
28                 <input type="checkbox" id="contact_serialsprimary[% contact.id %]" class="contact_serialsprimary" checked="checked"></input>
29             [% ELSE %]
30                 <input type="checkbox" id="contact_serialsprimary[% contact.id %]" class="contact_serialsprimary"></input>
31             [% END %]
32             <input type="hidden" class="contact_serialsprimary_hidden" name="contact_serialsprimary" value="[% contact.serialsprimary %]"></input>
33         <li><label for="contact_claimacquisition[% contact.id %]">Contact about late orders?</label>
34             [% IF contact.claimacquisition %]
35                 <input type="checkbox" id="contact_claimacquisition[% contact.id %]" class="contact_claimacquisition" checked="checked"></input>
36             [% ELSE %]
37                 <input type="checkbox" id="contact_claimacquisition[% contact.id %]" class="contact_claimacquisition"></input>
38             [% END %]
39             <input type="hidden" class="contact_claimacquisition_hidden" name="contact_claimacquisition" value="[% contact.claimacquisition %]"></input>
40         <li><label for="contact_claimissues[% contact.id %]">Contact about late issues?</label>
41             [% IF contact.claimissues %]
42                 <input type="checkbox" id="contact_claimissues[% contact.id %]" class="contact_claimissues" checked="checked"></input>
43             [% ELSE %]
44                 <input type="checkbox" id="contact_claimissues[% contact.id %]" class="contact_claimissues"></input>
45             [% END %]
46             <input type="hidden" class="contact_claimissues_hidden" name="contact_claimissues" value="[% contact.claimissues %]"></input>
47         </li>
48         [% IF contact.id %]<li><button class="btn delete-contact"><i class="fa fa-remove"></i> Delete contact</li>[% END %]
49     </ol>
50 [% END %]
51
52 [% BLOCK show_contact %]
53     <h3>[% contact.name %]</h3>
54     <p><span class="label">Position: </span>[% contact.position %]</p>
55     <p><span class="label">Phone: </span>[% contact.phone %]</p>
56     <p><span class="label">Alternative phone: </span>[% contact.altphone %]</p>
57     <p><span class="label">Fax: </span>[% contact.fax %]</p>
58     [% IF ( contact.email ) %]
59         <p><span class="label">Email: </span><a href="mailto:[% contact.email %]">[% contact.email %]</a></p>
60     [% END %]
61     [% IF ( contact.notes ) %]
62         <p><span class="label">Notes: </span>[% contact.notes %]</p>
63     [% END %]
64     [% IF ( contact.acqprimary ) %]
65         <p><span class="label">Primary acquisitions contact</span></p>
66     [% END %]
67     [% IF ( contact.serialsprimary ) %]
68         <p><span class="label">Primary serials contact</span></p>
69     [% END %]
70     [% IF ( contact.claimacquisition ) %]
71         <p><span class="label">Receives claims for late orders</span></p>
72     [% END %]
73     [% IF ( contact.claimissues ) %]
74         <p><span class="label">Receives claims for late issues</span></p>
75     [% END %]
76 [% END %]
77
78 [% INCLUDE 'doc-head-open.inc' %]
79 <title>Koha &rsaquo; Vendor [% bookselname %]</title>
80 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
81 [% INCLUDE 'doc-head-close.inc' %]
82 [% INCLUDE 'datatables.inc' %]
83
84 <script type="text/javascript">
85 //<![CDATA[
86 function confirm_deletion() {
87     if (confirm(_("Confirm deletion of this vendor ?"))) {
88         window.location="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]&op=delete";
89     }
90 }
91
92 function add_contact() {
93     var new_contact = $('#contact-template').clone();
94     var timestamp = new Date().getTime();
95     $(new_contact).removeAttr('id');
96     $('input, textarea', new_contact).each(function () {
97         $(this).attr('id', $(this).attr('id') + '_' + timestamp);
98     });
99     $('label', new_contact).each(function () {
100         $(this).attr('for', $(this).attr('for') + '_' + timestamp);
101     });
102     $(new_contact).insertBefore(this);
103     if ($('.supplier-contact').length === 2) { // First contact
104         $.each(['.contact_acqprimary', '.contact_serialsprimary', '.contact_claimacquisition', '.contact_claimissues'], function (idx, checkbox) {
105             $(checkbox, new_contact).click();
106         });
107     }
108     $('input[name="contact_name"]', new_contact).focus();
109     return false;
110 }
111
112 function delete_contact(ev) {
113     $(this).parents('.supplier-contact').remove();
114     ev.preventDefault();
115 }
116
117  $(document).ready(function() {
118     var contractst = $("#contractst").dataTable($.extend(true, {}, dataTablesDefaults, {
119         "aoColumnDefs": [
120           { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
121           { "sType": "title-string", "aTargets" : [ "title-string" ] }
122         ],
123         'sDom': 't'
124     } ) );
125     $('body').on('click', '.delete-contact', null, delete_contact);
126     $('#add-contact').click(add_contact);
127     $('body').on('click', '.contact_acqprimary', null, function () {
128         if ($(this).attr('checked') === 'checked') {
129             $('.contact_acqprimary').filter(':checked').not(this).removeAttr('checked');
130             $('.contact_acqprimary_hidden').each(function () {
131                 $(this).val('0');
132             });
133         }
134         $(this).next('.contact_acqprimary_hidden').val('1');
135     });
136     $('body').on('click', '.contact_serialsprimary', null, function () {
137         if ($(this).attr('checked') === 'checked') {
138             $('.contact_serialsprimary').filter(':checked').not(this).removeAttr('checked');
139             $('.contact_serialsprimary_hidden').each(function () {
140                 $(this).val('0');
141             });
142         }
143         $(this).next('.contact_serialsprimary_hidden').val($(this).attr('checked') === 'checked' ? '1' : '0');
144     });
145     $('body').on('click', '.contact_claimacquisition', null, function () {
146         $(this).next('.contact_claimacquisition_hidden').val($(this).attr('checked') === 'checked' ? '1' : '0');
147     });
148     $('body').on('click', '.contact_claimissues', null, function () {
149         $(this).next('.contact_claimissues_hidden').val($(this).attr('checked') === 'checked' ? '1' : '0');
150     });
151  });
152 //]]>
153 </script>
154 </head>
155 <body id="acq_supplier" class="acq">
156 [% INCLUDE 'header.inc' %]
157 [% INCLUDE 'acquisitions-search.inc' %]
158
159 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; [% IF ( enter ) %][% IF ( booksellerid ) %] <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% name %]</a> &rsaquo; Update: [% name %][% ELSE %]Add vendor[% END %] [% ELSE %][% name %][% END %]</div>
160
161 <div id="doc3" class="yui-t2">
162
163 <div id="bd">
164     <div id="yui-main">
165     <div class="yui-b">
166     [% IF ( enter ) %]
167         [% IF ( booksellerid ) %]
168         <h1>Update: [% name %]</h1>
169     [% ELSE %]
170         <h1>Add vendor</h1>
171     [% END %]
172     [% END %]
173 [% UNLESS ( enter ) %][% INCLUDE 'acquisitions-toolbar.inc' %][% END %]
174 [% IF ( enter ) %]
175     <form action="updatesupplier.pl" name="updatesupplier" class="validated" method="post">
176     <div class="yui-g">
177         <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
178         <fieldset class="rows">
179             <legend>Company details</legend>
180             <ol><li><label for="company" class="required">Name:</label>
181                 <input type="text" size="40" id="company" name="company" value="[% name %]" required="required" class="required" /><span class="required">Required</span></li>
182             <li><label for="company_postal">Postal address: </label>
183                     <textarea id="company_postal" name="company_postal" cols="40" rows="3">[% postal %]</textarea></li>
184             <li><label for="physical">Physical address: </label>
185                 <textarea id="physical" name="physical" cols="40" rows="3">[% address1 %][% address2 %][% address3 %][% address4 %]</textarea></li>
186             <li><label for="company_phone">Phone: </label>
187                 <input type="text" size="20" id="company_phone" name="company_phone" value="[% phone %]" /></li>
188             <li><label for="company_fax">Fax: </label>
189                 <input type="text" size="20" id="company_fax" name="company_fax" value="[% fax %]" /></li>
190             <li><label for="website">Website: </label>
191                 <input type="text" size="40" id="website" name="website" value="[% url %]" /></li>
192             <li><label for="accountnumber">Account number: </label>
193                 <input type="text" size="40" id="accountnumber" name="accountnumber" value="[% accountnumber %]" /></li></ol>
194         </fieldset>
195         <fieldset class="rows">
196             <legend>Contacts</legend>
197             <fieldset id="contact-template" class="supplier-contact">
198                 <legend>Contact details</legend>
199                 [% INCLUDE edit_contact %]
200             </fieldset>
201             [% FOREACH contact IN contacts %]
202                 <fieldset class="supplier-contact">
203                     <legend>Contact details</legend>
204                     [% INCLUDE edit_contact %]
205                 </fieldset>
206             [% END %]
207             <button id="add-contact" class="btn"><i class="fa fa-plus"></i> Add another contact</button>
208         </fieldset>
209     </div>
210         <div class="yui-g">
211         <fieldset class="rows">
212             <legend>Ordering information</legend>
213             <ol class="radio"><li><label for="activestatus" class="radio">Vendor is:</label>
214                     [% IF ( active ) %]
215                         <label for="activestatus">Active</label> <input type="radio" id="activestatus" name="status" value="1" checked="checked" />
216                         <label for="inactivestatus">Inactive</label> <input type="radio" id="inactivestatus" name="status" value="0" />
217                     [% ELSE %]
218                         <label for="activestatus">Active</label> <input type="radio" id="activestatus" name="status" value="1" />
219                         <label for="inactivestatus">Inactive</label> <input type="radio" id="inactivestatus" name="status" value="0" checked="checked" />
220                     [% END %]</li>
221             </ol>
222             <ol>
223             <li><label for="list_currency">List prices are: </label>
224                     <select name="list_currency" id="list_currency">
225                     [% FOREACH loop_currenc IN loop_currency %]
226                         [% IF ( loop_currenc.listprice ) %]<option value="[% loop_currenc.currency %]" selected="selected">[% loop_currenc.currency %]</option>
227                         [% ELSE %]<option value="[% loop_currenc.currency %]">[% loop_currenc.currency %]</option>[% END %]
228                     [% END %]
229                     </select>
230             </li>
231             <li><label for="invoice_currency">Invoice prices are: </label>
232                     <select name="invoice_currency" id="invoice_currency">
233                     [% FOREACH loop_currenc IN loop_currency %]
234                         [% IF ( loop_currenc.invoiceprice ) %]<option value="[% loop_currenc.currency %]" selected="selected">[% loop_currenc.currency %]</option>
235                         [% ELSE %]<option value="[% loop_currenc.currency %]">[% loop_currenc.currency %]</option>[% END %]
236                     [% END %]
237                     </select>
238             </li>
239             </ol>
240             <ol class="radio">
241             <li><label for="gstyes" class="radio">Tax number registered:</label>
242                 [% IF ( gstreg ) %]
243                     <label for="gstyes">Yes</label> <input type="radio" name="gst" id="gstyes" value="1" checked="checked" />
244                     <label for="gstno">No</label> <input type="radio" name="gst" id="gstno" value="0" />
245                 [% ELSE %]
246                     <label for="gstyes">Yes</label> <input type="radio" name="gst" id="gstyes" value="1" />
247                     <label for="gstno">No</label> <input type="radio" name="gst" id="gstno" value="0" checked="checked" />
248                 [% END %]</li>
249             
250             <li><label for="list_gstyes" class="radio">List prices:</label>
251                 [% IF ( listincgst ) %]
252                     <label for="list_gstyes">Include tax</label> <input type="radio" id="list_gstyes" name="list_gst" value="1" checked="checked" />
253                     <label for="list_gstno">Don't include tax</label> <input type="radio" id="list_gstno" name="list_gst" value="0" />
254                 [% ELSE %]
255                     <label for="list_gstyes">Include tax</label> <input type="radio" id="list_gstyes" name="list_gst" value="1" />
256                     <label for="list_gstno">Don't include tax</label> <input type="radio" id="list_gstno" name="list_gst" value="0" checked="checked" />
257                 [% END %]</li>
258             
259             <li><label for="invoice_gstyes" class="radio">Invoice prices:</label>
260                 [% IF ( invoiceincgst ) %]
261                     <label for="invoice_gstyes">Include tax</label> <input type="radio" id="invoice_gstyes" name="invoice_gst" value="1" checked="checked" />
262                     <label for="invoice_gstno">Don't include tax</label> <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" />
263                     [% ELSE %]
264                     <label for="invoice_gstyes">Include tax</label> <input type="radio" id="invoice_gstyes" name="invoice_gst" value="1" />
265                     <label for="invoice_gstno">Don't include tax</label> <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" checked="checked" />
266                 [% END %]</li>
267             </ol>
268             [% IF gst_values %]
269                 <ol>
270                   <li>
271                     <label for="gstrate">Tax rate: </label>
272                     <select name="gstrate" id="gstrate">
273                     [% FOREACH gst IN gst_values %]
274                       [% IF ( gstrate == gst.option ) %]
275                         <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format ("%.1f") %] %</option>
276                       [% ELSE %]
277                         <option value="[% gst.option %]">[% gst.option * 100 | format ("%.1f") %] %</option>
278                       [% END %]
279                     [% END %]
280                     </select>
281                   </li>
282                 </ol>
283             [% ELSE %]
284                 <input type="hidden" name="gstrate" value="0" />
285             [% END %]
286             <ol>
287             <li><label for="discount">Discount: </label>
288                 <input type="text" size="6" id="discount" name="discount" value="[% discount | format ("%.1f") %]" />%</li>
289             <li>
290                 <label for="deliverytime">Delivery time: </label>
291                 <input type="text" size="2" id="deliverytime" name="deliverytime" value="[% deliverytime %]" /> days
292             </li>
293             <li><label for="notes">Notes: </label>
294                 <textarea cols="40" rows="4" id="notes" name="notes" >[% notes %]</textarea></li></ol>
295         </fieldset>
296         <fieldset class="action"><input type="submit" value="Save" /> [% IF ( booksellerid ) %]
297         <a class="cancel" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% ELSE %]<a class="cancel" href="/cgi-bin/koha/acqui/acqui-home.pl">
298         [% END %]Cancel</a></fieldset>
299         </div>
300     </form>
301 [% ELSE %]
302     <h1>[% name %]</h1>
303         <div class="yui-g">
304             <div id="supplier-company-details" class="yui-u first">
305                 <h2>Vendor details</h2>
306                 <p><span class="label">Company name: </span>[% name %]</p>
307                 <p><span class="label">Postal address: </span>[% postal %]</p>
308                 <p><span class="label">Physical address: </span>[% address1 %][% address2 %][% address3 %][% address4 %]</p>
309                 <p><span class="label">Phone: </span>[% phone %]</p>
310                 <p><span class="label">Fax: </span>[% fax %]</p>
311                 [% IF ( url ) %]
312                     <p><span class="label">Website: </span><a href="[% url %]" target="_blank">[% url %]</a></p>
313                 [% END %]
314                 [% IF ( accountnumber ) %]
315                     <p><span class="label">Account number: </span>[% accountnumber %]</p>
316                 [% END %]
317
318             <div id="supplier-ordering-information">
319             <h2>Ordering information</h2>
320                 <p><strong>Vendor is: </strong>
321                         [% IF ( active ) %]
322                             Active
323                         [% ELSE %]
324                             Inactive
325                         [% END %]</p>
326                 <p><strong>List prices are: </strong>[% listprice %]</p>
327                 <p><strong>Invoice prices are: </strong>[% invoiceprice %]</p>
328                 [% IF ( gstrate ) %]<p><strong>Tax number registered: </strong>
329                         [% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</p>
330                 <p><strong>List item price includes tax: </strong>
331                         [% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</p>
332                 <p><strong>Invoice item price includes tax: </strong>
333                         [% IF ( invoiceincgst ) %]Yes[% ELSE %]No[% END %]</p>[% END %]
334                 <p><strong>Discount: </strong>
335                     [% discount | format("%.1f") %] %</p>
336                 <p><strong>Tax rate: </strong>
337                     [% 0 + gstrate * 100 | format("%.1f") %] %</p>
338                 [% IF deliverytime.defined %]
339                     <p><strong>Delivery time: </strong>
340                         [% deliverytime %] days</p>
341                 [% END %]
342                 [% IF ( notes ) %]<p><strong>Notes: </strong>
343                     [% notes %]</p>[% END %]
344             </div>
345             </div>
346
347             <div class="supplier-contact-details yui-u">
348                 <h2>Contact</h2>
349                 [% FOREACH contact IN contacts %]
350                     [% INCLUDE show_contact %]
351                 [% END %]
352             </div>
353
354         </div>
355
356         [% IF ( contracts ) %]
357             <div id="supplier-contracts" class="yui-g">
358                 <h2>Contract(s)</h2>
359                 <table id="contractst">
360                   <thead>
361                     <tr>
362                         <th scope="col">Name</th>
363                         <th scope="col">Description</th>
364                         <th scope="col" class="title-string">Start date</th>
365                         <th scope="col" class="title-string">End date</th>
366                         <th scope="col">&nbsp; </th>
367                         <th scope="col">&nbsp; </th>
368                     </tr>
369                   </thead>
370                   <tbody>
371                     [% FOREACH contract IN contracts %]
372                         [% IF ( loop.even ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
373                         <td>
374                             <a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&amp;contractnumber=[% contract.contractnumber %]&amp;booksellerid=[% contract.booksellerid %]">[% contract.contractname %]</a>
375                         </td>
376                         <td>[% contract.contractdescription %]</td>
377                         <td><span title="[% contract.contractstartdate %]">[% contract.contractstartdate | $KohaDates %]</span></td>
378                         <td><span title="[% contract.contractenddate %]">[% contract.contractenddate | $KohaDates %]</span></td>
379                         <td><a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&amp;contractnumber=[% contract.contractnumber %]&amp;booksellerid=[% contract.booksellerid %]">Edit</a></td>
380                         <td><a href="/cgi-bin/koha/admin/aqcontract.pl?op=delete_confirm&amp;contractnumber=[% contract.contractnumber %]&amp;booksellerid=[% contract.booksellerid %]">Delete</a></td>
381                         </tr>
382                     [% END %]
383                   </tbody>
384                 </table>
385             </div>
386         [% END %]
387
388 [% END %]
389
390 </div>
391 </div>
392 <div class="yui-b">
393 [% INCLUDE 'vendor-menu.inc' %]
394 </div>
395 </div>
396 [% INCLUDE 'intranet-bottom.inc' %]