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