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