Bug 15758: Koha::Libraries - Remove GetBranchName
[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 %]" class="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-trash"></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="[% interface %]/[% theme %]/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 ], "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).is(':checked')) {
129             $('.contact_acqprimary').filter(':checked').not(this).prop('checked', false);
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).is(':checked')) {
138             $('.contact_serialsprimary').filter(':checked').not(this).prop('checked', false);
139             $('.contact_serialsprimary_hidden').each(function () {
140                 $(this).val('0');
141             });
142         }
143         $(this).next('.contact_serialsprimary_hidden').val($(this).is(':checked') ? '1' : '0');
144     });
145     $('body').on('click', '.contact_claimacquisition', null, function () {
146         $(this).next('.contact_claimacquisition_hidden').val($(this).is(':checked') ? '1' : '0');
147     });
148     $('body').on('click', '.contact_claimissues', null, function () {
149         $(this).next('.contact_claimissues_hidden').val($(this).is(':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 %]" class="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 c IN currencies %]
226                         [% IF booksellerid and c.currency == listprice or not booksellerid and c.active %]
227                             <option value="[% c.currency %]" selected="selected">[% c.currency %]</option>
228                         [% ELSIF not c.archived %]
229                             <option value="[% c.currency %]">[% c.currency %]</option>
230                         [% END %]
231                     [% END %]
232                 </select>
233             </li>
234             <li><label for="invoice_currency">Invoice prices are: </label>
235                 <select name="invoice_currency" id="invoice_currency">
236                     [% FOREACH c IN currencies %]
237                         [% IF booksellerid and c.currency == invoiceprice or not booksellerid and c.active %]
238                             <option value="[% c.currency %]" selected="selected">[% c.currency %]</option>
239                         [% ELSIF not c.archived %]
240                             <option value="[% c.currency %]">[% c.currency %]</option>
241                         [% END %]
242                     [% END %]
243                 </select>
244             </li>
245             </ol>
246             <ol class="radio">
247             <li><label for="gstyes" class="radio">Tax number registered:</label>
248                 [% IF ( gstreg ) %]
249                     <label for="gstyes">Yes</label> <input type="radio" name="gst" id="gstyes" value="1" checked="checked" />
250                     <label for="gstno">No</label> <input type="radio" name="gst" id="gstno" value="0" />
251                 [% ELSE %]
252                     <label for="gstyes">Yes</label> <input type="radio" name="gst" id="gstyes" value="1" />
253                     <label for="gstno">No</label> <input type="radio" name="gst" id="gstno" value="0" checked="checked" />
254                 [% END %]</li>
255             
256             <li><label for="list_gstyes" class="radio">List prices:</label>
257                 [% IF ( listincgst ) %]
258                     <label for="list_gstyes">Include tax</label> <input type="radio" id="list_gstyes" name="list_gst" value="1" checked="checked" />
259                     <label for="list_gstno">Don't include tax</label> <input type="radio" id="list_gstno" name="list_gst" value="0" />
260                 [% ELSE %]
261                     <label for="list_gstyes">Include tax</label> <input type="radio" id="list_gstyes" name="list_gst" value="1" />
262                     <label for="list_gstno">Don't include tax</label> <input type="radio" id="list_gstno" name="list_gst" value="0" checked="checked" />
263                 [% END %]</li>
264             
265             <li><label for="invoice_gstyes" class="radio">Invoice prices:</label>
266                 [% IF ( invoiceincgst ) %]
267                     <label for="invoice_gstyes">Include tax</label> <input type="radio" id="invoice_gstyes" name="invoice_gst" value="1" checked="checked" />
268                     <label for="invoice_gstno">Don't include tax</label> <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" />
269                     [% ELSE %]
270                     <label for="invoice_gstyes">Include tax</label> <input type="radio" id="invoice_gstyes" name="invoice_gst" value="1" />
271                     <label for="invoice_gstno">Don't include tax</label> <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" checked="checked" />
272                 [% END %]</li>
273             </ol>
274             [% IF gst_values %]
275                 <ol>
276                   <li>
277                     <label for="gstrate">Tax rate: </label>
278                     <select name="gstrate" id="gstrate">
279                     [% FOREACH gst IN gst_values %]
280                       [% IF ( gstrate == gst.option ) %]
281                         <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format ("%.1f") %] %</option>
282                       [% ELSE %]
283                         <option value="[% gst.option %]">[% gst.option * 100 | format ("%.1f") %] %</option>
284                       [% END %]
285                     [% END %]
286                     </select>
287                   </li>
288                 </ol>
289             [% ELSE %]
290                 <input type="hidden" name="gstrate" value="0" />
291             [% END %]
292             <ol>
293             <li><label for="discount">Discount: </label>
294                 <input type="text" size="6" id="discount" name="discount" value="[% discount | format ("%.1f") %]" />%</li>
295             <li>
296                 <label for="deliverytime">Delivery time: </label>
297                 <input type="text" size="2" id="deliverytime" name="deliverytime" value="[% deliverytime %]" /> days
298             </li>
299             <li><label for="notes">Notes: </label>
300                 <textarea cols="40" rows="4" id="notes" name="notes" >[% notes %]</textarea></li></ol>
301         </fieldset>
302         <fieldset class="action"><input type="submit" value="Save" /> [% IF ( booksellerid ) %]
303         <a class="cancel" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% ELSE %]<a class="cancel" href="/cgi-bin/koha/acqui/acqui-home.pl">
304         [% END %]Cancel</a></fieldset>
305         </div>
306     </form>
307 [% ELSE %]
308     <h1>[% name %]</h1>
309         <div class="yui-g">
310             <div id="supplier-company-details" class="yui-u first">
311                 <h2>Vendor details</h2>
312                 <p><span class="label">Company name: </span>[% name %]</p>
313                 <p><span class="label">Postal address: </span>[% postal %]</p>
314                 <p><span class="label">Physical address: </span>[% address1 %][% address2 %][% address3 %][% address4 %]</p>
315                 <p><span class="label">Phone: </span>[% phone %]</p>
316                 <p><span class="label">Fax: </span>[% fax %]</p>
317                 [% IF ( url ) %]
318                     <p><span class="label">Website: </span><a href="[% url %]">[% url %]</a></p>
319                 [% END %]
320                 [% IF ( accountnumber ) %]
321                     <p><span class="label">Account number: </span>[% accountnumber %]</p>
322                 [% END %]
323
324             <div id="supplier-ordering-information">
325             <h2>Ordering information</h2>
326                 <p><strong>Vendor is: </strong>
327                         [% IF ( active ) %]
328                             Active
329                         [% ELSE %]
330                             Inactive
331                         [% END %]</p>
332                 <p><strong>List prices are: </strong>[% listprice %]</p>
333                 <p><strong>Invoice prices are: </strong>[% invoiceprice %]</p>
334                 [% IF ( gstrate ) %]<p><strong>Tax number registered: </strong>
335                         [% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</p>
336                 <p><strong>List item price includes tax: </strong>
337                         [% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</p>
338                 <p><strong>Invoice item price includes tax: </strong>
339                         [% IF ( invoiceincgst ) %]Yes[% ELSE %]No[% END %]</p>[% END %]
340                 <p><strong>Discount: </strong>
341                     [% discount | format("%.1f") %] %</p>
342                 <p><strong>Tax rate: </strong>
343                     [% 0 + gstrate * 100 | format("%.1f") %] %</p>
344                 [% IF deliverytime.defined %]
345                     <p><strong>Delivery time: </strong>
346                         [% deliverytime %] days</p>
347                 [% END %]
348                 [% IF ( notes ) %]<p><strong>Notes: </strong>
349                     [% notes %]</p>[% END %]
350             </div>
351             </div>
352
353             <div class="supplier-contact-details yui-u">
354                 <h2>Contact</h2>
355                 [% FOREACH contact IN contacts %]
356                     [% INCLUDE show_contact %]
357                 [% END %]
358             </div>
359
360         </div>
361
362         [% IF ( contracts ) %]
363             <div id="supplier-contracts" class="yui-g">
364                 <h2>Contract(s)</h2>
365                 <table id="contractst">
366                   <thead>
367                     <tr>
368                         <th scope="col">Name</th>
369                         <th scope="col">Description</th>
370                         <th scope="col" class="title-string">Start date</th>
371                         <th scope="col" class="title-string">End date</th>
372                         <th scope="col">Actions</th>
373                     </tr>
374                   </thead>
375                   <tbody>
376                     [% FOREACH contract IN contracts %]
377                         <tr>
378                         <td>
379                             <a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&amp;contractnumber=[% contract.contractnumber %]&amp;booksellerid=[% contract.booksellerid %]">[% contract.contractname %]</a>
380                         </td>
381                         <td>[% contract.contractdescription %]</td>
382                         <td><span title="[% contract.contractstartdate %]">[% contract.contractstartdate | $KohaDates %]</span></td>
383                         <td><span title="[% contract.contractenddate %]">[% contract.contractenddate | $KohaDates %]</span></td>
384                         <td class="actions">
385                             <a class="btn btn-mini" 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>
386                             <a class="btn btn-mini" 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>
387                         </td>
388                         </tr>
389                     [% END %]
390                   </tbody>
391                 </table>
392             </div>
393         [% END %]
394
395 [% END %]
396
397 </div>
398 </div>
399 <div class="yui-b">
400 [% INCLUDE 'vendor-menu.inc' %]
401 </div>
402 </div>
403 [% INCLUDE 'intranet-bottom.inc' %]