Bug 33908: Improve translation of title tags: Acquisitions
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / supplier.tt
1 [% USE raw %]
2 [% USE To %]
3 [% USE Asset %]
4 [% USE KohaDates %]
5 [% USE AuthorisedValues %]
6 [% PROCESS 'i18n.inc' %]
7 [% BLOCK edit_contact %]
8     <ol id="contact-form">
9         <input type="hidden" name="contact_id" value="[% contact.id | html %]" />
10         <li><label for="contact_name[% contact.id | html %]">Contact name: </label>
11             <input type="text" size="40" id="contact_name[% contact.id | html %]" name="contact_name" value="[% contact.name | html %]" /></li>
12         <li><label for="contact_position[% contact.id | html %]">Position: </label>
13             <input type="text" size="40" id="contact_position[% contact.id | html %]" name="contact_position" value="[% contact.position | html %]" /></li>
14         <li><label for="contact_phone[% contact.id | html %]">Phone: </label>
15                 <input type="text" size="20" id="contact_phone[% contact.id | html %]" name="contact_phone" value="[% contact.phone | html %]" /> </li>
16         <li><label for="contact_altphone[% contact.id | html %]">Alternative phone: </label>
17             <input type="text" size="20" id="contact_altphone[% contact.id | html %]" name="contact_altphone" value="[% contact.altphone | html %]" /></li>
18         <li><label for="contact_fax[% contact.id | html %]">Fax: </label>
19             <input type="text" size="20" id="contact_fax[% contact.id | html %]" name="contact_fax" value="[% contact.fax | html %]" /></li>
20         <li><label for="contact_email[% contact.id | html %]">Email: </label>
21             <input type="text" size="40" id="contact_email[% contact.id | html %]" name="contact_email" value="[% contact.email | html %]" class="email" /></li>
22         <li><label for="contact_notes[% contact.id | html %]">Notes: </label>
23             <textarea id="contact_notes[% contact.id | html %]" name="contact_notes" cols="40" rows="4">[% contact.notes | html %]</textarea></li>
24     </ol>
25     <div style="display:flex">
26         <div>
27             <fieldset class="rows">
28                 <legend>Acquisitions options</legend>
29                 <ol class="radio">
30                     <li>
31                         <label>
32                             [% IF contact.acqprimary %]
33                                 <input type="checkbox" id="contact_acqprimary[% contact.id | html %]" class="contact_acqprimary" checked="checked" />
34                             [% ELSE %]
35                                 <input type="checkbox" id="contact_acqprimary[% contact.id | html %]" class="contact_acqprimary" />
36                             [% END %]
37                             <input type="hidden" class="contact_acqprimary_hidden" name="contact_acqprimary" value="[% contact.acqprimary | html %]" />
38                             Primary acquisitions contact
39                         </label>
40                     </li>
41                     <li>
42                         <label>
43                             [% IF contact.orderacquisition %]
44                                 <input type="checkbox" id="contact_orderacquisition[% contact.id | html %]" class="contact_orderacquisition" checked="checked" />
45                             [% ELSE %]
46                                 <input type="checkbox" id="contact_orderacquisition[% contact.id | html %]" class="contact_orderacquisition" />
47                             [% END %]
48                             <input type="hidden" class="contact_orderacquisition_hidden" name="contact_orderacquisition" value="[% contact.orderacquisition | html %]" />
49                             Contact when ordering
50                         </label>
51                     </li>
52                     <li>
53                         <label>
54                             [% IF contact.claimacquisition %]
55                                 <input type="checkbox" id="contact_claimacquisition[% contact.id | html %]" class="contact_claimacquisition" checked="checked" />
56                             [% ELSE %]
57                                 <input type="checkbox" id="contact_claimacquisition[% contact.id | html %]" class="contact_claimacquisition" />
58                             [% END %]
59                             <input type="hidden" class="contact_claimacquisition_hidden" name="contact_claimacquisition" value="[% contact.claimacquisition | html %]" />
60                             Contact about late orders
61                         </label>
62                     </li>
63                 </ol>
64             </fieldset>
65         </div>
66         <div>
67             <fieldset class="rows">
68                 <legend>Serials options</legend>
69                 <ol class="radio">
70                     <li>
71                         <label>
72                             [% IF contact.serialsprimary %]
73                                 <input type="checkbox" id="contact_serialsprimary[% contact.id | html %]" class="contact_serialsprimary" checked="checked" />
74                             [% ELSE %]
75                                 <input type="checkbox" id="contact_serialsprimary[% contact.id | html %]" class="contact_serialsprimary" />
76                             [% END %]
77                             <input type="hidden" class="contact_serialsprimary_hidden" name="contact_serialsprimary" value="[% contact.serialsprimary | html %]" />
78                             Primary serials contact
79                         </label>
80                     </li>
81                     <li>
82                         <label>
83                             [% IF contact.claimissues %]
84                                 <input type="checkbox" id="contact_claimissues[% contact.id | html %]" class="contact_claimissues" checked="checked" />
85                             [% ELSE %]
86                                 <input type="checkbox" id="contact_claimissues[% contact.id | html %]" class="contact_claimissues" />
87                             [% END %]
88                             <input type="hidden" class="contact_claimissues_hidden" name="contact_claimissues" value="[% contact.claimissues | html %]" />
89                             Contact about late issues
90                         </label>
91                     </li>
92                 </ol>
93             </fieldset>
94         </div>
95     </div>
96
97         [% IF contact.id %]<li><button class="btn btn-default delete-contact"><i class="fa fa-trash-can"></i> Delete contact</li>[% END %]
98     </ol>
99 [% END %]
100
101 [% BLOCK show_contact %]
102     <h3>[% contact.name | html %]</h3>
103     <ol>
104         <li><span class="label">Position: </span>[% contact.position | html %]</li>
105         <li><span class="label">Phone: </span>[% contact.phone | html %]</li>
106         <li><span class="label">Alternative phone: </span>[% contact.altphone | html %]</li>
107         <li><span class="label">Fax: </span>[% contact.fax | html %]</li>
108         [% IF ( contact.email ) %]
109             <li><span class="label">Email: </span><a href="mailto:[% contact.email | uri %]">[% contact.email | html %]</a></li>
110         [% END %]
111         [% IF ( contact.notes ) %]
112             <li><span class="label">Notes: </span>[% contact.notes | html %]</li>
113         [% END %]
114         [% IF ( contact.acqprimary || contact.orderacquisition || contact.claimacquisition ) %]
115             <li>
116                 <span class="label">Acquisitions options:</span>
117                 <ol>
118                     [% IF ( contact.acqprimary ) %]
119                         <li><span class="label"></span> <i class="fa fa-check"></i> Primary acquisitions contact</li>
120                     [% END %]
121                     [% IF ( contact.orderacquisition ) %]
122                         <li><span class="label"></span> <i class="fa fa-check"></i> Receives orders</li>
123                     [% END %]
124                     [% IF ( contact.claimacquisition ) %]
125                         <li><span class="label"></span> <i class="fa fa-check"></i> Receives claims for late orders</li>
126                     [% END %]
127                 </ol>
128             </li>
129         [% END %]
130         [% IF ( contact.serialsprimary || contact.claimissues ) %]
131             <li>
132                 <span class="label">Serials options:</span>
133                 <ol>
134                     [% IF ( contact.serialsprimary ) %]
135                         <li><span class="label"></span> <i class="fa fa-check"></i> Primary serials contact</li>
136                     [% END %]
137                     [% IF ( contact.claimissues ) %]
138                         <li><span class="label"></span> <i class="fa fa-check"></i> Receives claims for late issues</li>
139                     [% END %]
140                 </ol>
141             </li>
142         [% END %]
143     </ol>
144 [% END %]
145
146 [% SET footerjs = 1 %]
147 [% INCLUDE 'doc-head-open.inc' %]
148 <title>[% FILTER collapse %]
149     [% tx("Vendor {vendor}", { vendor = name }) | html %] &rsaquo;
150     [% t("Koha") | html %]
151 [% END %]</title>
152 [% INCLUDE 'doc-head-close.inc' %]
153 <style>
154 div.rows p{ margin-left: 1rem; }
155 div.rows { padding: 1rem; }
156 </style>
157 </head>
158
159 <body id="acq_supplier" class="acq">
160 [% WRAPPER 'header.inc' %]
161     [% INCLUDE 'acquisitions-search.inc' %]
162 [% END %]
163
164 [% WRAPPER 'sub-header.inc' %]
165     [% WRAPPER breadcrumbs %]
166         [% WRAPPER breadcrumb_item %]
167             <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
168         [% END %]
169         [% IF ( enter ) %]
170             [% IF ( booksellerid ) %]
171                 [% WRAPPER breadcrumb_item %]
172                     <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% name | html %]</a>
173                 [% END %]
174                 [% WRAPPER breadcrumb_item bc_active= 1 %]
175                     <span>Modify [% name | html %]</span>
176                 [% END %]
177             [% ELSE %]
178                 [% WRAPPER breadcrumb_item bc_active= 1 %]
179                     <span>Add vendor</span>
180                 [% END %]
181             [% END %]
182         [% ELSE %]
183             [% WRAPPER breadcrumb_item bc_active= 1 %]
184                 [% name | html %]
185             [% END %]
186         [% END # /IF (enter) %]
187     [% END #/ WRAPPER breadcrumbs %]
188 [% END #/ WRAPPER sub-header.inc %]
189
190 <div class="main container-fluid">
191     <div class="row">
192         <div class="col-sm-10 col-sm-push-2">
193             <main>
194
195     [% IF ( enter ) %]
196         [% IF ( booksellerid ) %]
197         <h1>Update: [% name | html %]</h1>
198     [% ELSE %]
199         <h1>Add vendor</h1>
200     [% END %]
201     [% END %]
202 [% UNLESS ( enter ) %][% INCLUDE 'acquisitions-toolbar.inc' %][% END %]
203 [% IF ( enter ) %]
204     <form action="updatesupplier.pl" name="updatesupplier" style="display:block" class="validated" method="post">
205         <div id="toolbar" class="btn-toolbar">
206             <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> Save</button>
207             [% IF ( booksellerid ) %]
208                 <a class="btn btn-default cancel" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">
209             [% ELSE %]
210                 <a class="btn btn-default cancel" href="/cgi-bin/koha/acqui/acqui-home.pl">
211             [% END %] <i class="fa fa-times"></i> Cancel</a>
212         </div>
213
214         <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
215         <fieldset class="rows">
216             <legend>Company details</legend>
217             <ol><li><label for="company" class="required">Name:</label>
218                 <input type="text" size="40" id="company" name="company" value="[% name | html %]" required="required" class="required focus" /><span class="required">Required</span></li>
219             <li><label for="company_postal">Postal address: </label>
220                     <textarea id="company_postal" name="company_postal" cols="40" rows="3">[% postal | html %]</textarea></li>
221             <li><label for="physical">Physical address: </label>
222                 <textarea id="physical" name="physical" cols="40" rows="3">[% address1 | html %][% address2 | html %][% address3 | html %][% address4 | html %]</textarea></li>
223             <li><label for="company_phone">Phone: </label>
224                 <input type="text" size="20" id="company_phone" name="company_phone" value="[% phone | html %]" /></li>
225             <li><label for="company_fax">Fax: </label>
226                 <input type="text" size="20" id="company_fax" name="company_fax" value="[% fax | html %]" /></li>
227             <li><label for="website">Website: </label>
228                 <input type="text" size="40" id="website" name="website" value="[% url | html %]" class="url" /></li>
229             <li><label for="accountnumber">Account number: </label>
230                 <input type="text" size="40" id="accountnumber" name="accountnumber" value="[% accountnumber | html %]" /></li>
231                 <li>
232                     <label for="vendor_type">Vendor type: </label>
233                     [% PROCESS 'av-build-dropbox.inc' name="vendor_type", category="VENDOR_TYPE", default=type, empty=1, size = 20 %]
234                 </li>
235                 <li>
236                     <label for="aliases">Aliases: </label>
237                     <div id="aliases" style="padding-left: 11rem;"></div>
238                 </li>
239             </ol>
240         </fieldset>
241         <fieldset class="rows">
242             <legend>Contacts</legend>
243             <fieldset id="contact-template" class="supplier-contact">
244                 <legend>Contact details</legend>
245                 [% INCLUDE edit_contact %]
246             </fieldset>
247             [% FOREACH contact IN contacts %]
248                 <fieldset class="supplier-contact">
249                     <legend>Contact details</legend>
250                     [% INCLUDE edit_contact %]
251                 </fieldset>
252             [% END %]
253             <button id="add-contact" class="btn btn-default"><i class="fa fa-plus"></i> Add another contact</button>
254         </fieldset>
255
256         <fieldset class="rows">
257             <legend>Interfaces</legend>
258             <div id="interfaces"></div>
259         </fieldset>
260
261         <fieldset class="rows">
262             <legend>Ordering information</legend>
263             <ol><li><label for="activestatus">Vendor is:</label>
264                     [% IF ( active ) %]
265                         <input type="radio" id="activestatus" name="status" value="1" checked="checked" />
266                         <label class="radio" for="activestatus">Active</label>
267                         <input type="radio" id="inactivestatus" name="status" value="0" />
268                         <label class="radio" for="inactivestatus">Inactive</label>
269                     [% ELSE %]
270                         <input type="radio" id="activestatus" name="status" value="1" />
271                         <label class="radio" for="activestatus">Active</label>
272                         <input type="radio" id="inactivestatus" name="status" value="0" checked="checked" />
273                         <label class="radio" for="inactivestatus">Inactive</label>
274                     [% END %]</li>
275             <li><label for="list_currency">List prices are: </label>
276                 <select name="list_currency" id="list_currency">
277                     [% FOREACH c IN currencies %]
278                         [% IF booksellerid and c.currency == listprice or not booksellerid and c.active %]
279                             <option value="[% c.currency | html %]" selected="selected">[% c.currency | html %]</option>
280                         [% ELSIF not c.archived %]
281                             <option value="[% c.currency | html %]">[% c.currency | html %]</option>
282                         [% END %]
283                     [% END %]
284                 </select>
285             </li>
286             <li><label for="invoice_currency">Invoice prices are: </label>
287                 <select name="invoice_currency" id="invoice_currency">
288                     [% FOREACH c IN currencies %]
289                         [% IF booksellerid and c.currency == invoiceprice or not booksellerid and c.active %]
290                             <option value="[% c.currency | html %]" selected="selected">[% c.currency | html %]</option>
291                         [% ELSIF not c.archived %]
292                             <option value="[% c.currency | html %]">[% c.currency | html %]</option>
293                         [% END %]
294                     [% END %]
295                 </select>
296             </li>
297             <li><label for="gstyes">Tax number registered:</label>
298                 [% IF ( gstreg ) %]
299                     <label class="radio" for="gstyes">Yes</label>
300                     <input type="radio" name="gst" id="gstyes" value="1" checked="checked" />
301                     <label class="radio" for="gstno">No</label>
302                     <input type="radio" name="gst" id="gstno" value="0" />
303                 [% ELSE %]
304                     <label class="radio" for="gstyes">Yes</label>
305                     <input type="radio" name="gst" id="gstyes" value="1" />
306                     <label class="radio" for="gstno">No</label>
307                     <input type="radio" name="gst" id="gstno" value="0" checked="checked" />
308                 [% END %]</li>
309
310             <li><label for="list_gstyes">List prices:</label>
311                 [% IF ( listincgst ) %]
312                     <label class="radio" for="list_gstyes">Include tax</label>
313                     <input type="radio" id="list_gstyes" name="list_gst" value="1" checked="checked" />
314                     <label class="radio" for="list_gstno">Don't include tax</label>
315                     <input type="radio" id="list_gstno" name="list_gst" value="0" />
316                 [% ELSE %]
317                     <label class="radio" for="list_gstyes">Include tax</label>
318                     <input type="radio" id="list_gstyes" name="list_gst" value="1" />
319                     <label class="radio" for="list_gstno">Don't include tax</label>
320                     <input type="radio" id="list_gstno" name="list_gst" value="0" checked="checked" />
321                 [% END %]</li>
322
323             <li><label for="invoice_gstyes">Invoice prices:</label>
324                 [% IF ( invoiceincgst ) %]
325                     <label class="radio" for="invoice_gstyes">Include tax</label>
326                     <input type="radio" id="invoice_gstyes" name="invoice_gst" value="1" checked="checked" />
327                     <label class="radio" for="invoice_gstno">Don't include tax</label>
328                     <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" />
329                     [% ELSE %]
330                     <label class="radio" for="invoice_gstyes">Include tax</label>
331                     <input type="radio" id="invoice_gstyes" name="invoice_gst" value="1" />
332                     <label class="radio" for="invoice_gstno">Don't include tax</label>
333                     <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" checked="checked" />
334                 [% END %]</li>
335
336             [% IF gst_values %]
337                 <li>
338                   <label for="tax_rate">Tax rate: </label>
339                   <select name="tax_rate" id="tax_rate">
340                   [% FOREACH gst IN gst_values %]
341                     [% IF ( tax_rate == gst.option ) %]
342                       <option value="[% gst.option | html %]" selected="selected">[% gst.option * 100 | html %] %</option>
343                     [% ELSE %]
344                       <option value="[% gst.option | html %]">[% gst.option * 100 | html %] %</option>
345                     [% END %]
346                   [% END %]
347                   </select>
348                 </li>
349             [% ELSE %]
350                 <input type="hidden" name="tax_rate" value="0" />
351             [% END %]
352             <li><label for="discount">Discount: </label>
353                 <input type="text" size="6" id="discount" name="discount" value="[% discount | format ('%.1f') %]" />%</li>
354             <li>
355                 <label for="deliverytime">Delivery time: </label>
356                 <input type="text" size="2" id="deliverytime" name="deliverytime" value="[% deliverytime | html %]" /> days
357             </li>
358             <li><label for="notes">Notes: </label>
359                 <textarea cols="40" rows="4" id="notes" name="notes" >[% notes | html %]</textarea></li>
360             </ol>
361         </fieldset>
362
363     </form>
364 [% ELSE %]
365     <h1>[% name | html %]</h1>
366         <div class="row">
367             <div class="col-sm-6">
368                 <div id="supplier-company-details" class="page-section rows">
369                     <h2>Vendor details</h2>
370                     <li>
371                         <span class="label">Type: </span>
372                         [% IF (type) %][% AuthorisedValues.GetByCode( 'VENDOR_TYPE', type ) | html %][% END %]
373                     </li>
374                     <li><span class="label">Company name: </span>[% name | html %]</li>
375                     <li><span class="label">Postal address: </span>[% postal | html %]</li>
376                     <li><span class="label">Physical address: </span>[% address1 | html %][% address2 | html %][% address3 | html %][% address4 | html %]</li>
377                     <li><span class="label">Phone: </span>[% phone | html %]</li>
378                     <li><span class="label">Fax: </span>[% fax | html %]</li>
379                     [% IF ( url ) %]
380                         <li><span class="label">Website: </span><a href="[% url | url %]">[% url | html %]</a></li>
381                     [% END %]
382                     [% IF ( accountnumber ) %]
383                         <li><span class="label">Account number: </span>[% accountnumber | html %]</li>
384                     [% END %]
385                     [% IF vendor.aliases.count %]
386                         <li>
387                             <span class="label">Aliases: </span>
388                             <ul>
389                             [% FOR alias IN vendor.aliases %]
390                                 <li>[% alias.alias | html %]</li>
391                             [% END %]
392                             </ul>
393                         </li>
394                     [% END %]
395                 </div> <!-- /#supplier-company-details -->
396
397                 <div id="supplier-ordering-information" class="page-section rows">
398                     <h2>Ordering information</h2>
399                     <li><span class="label">Vendor is: </span>[% IF ( active ) %]Active[% ELSE %]Inactive[% END %]</li>
400                     <li><span class="label">List prices are: </span>[% listprice | html %]</li>
401                     <li><span class="label">Invoice prices are: </span>[% invoiceprice | html %]</li>
402                     [% IF ( tax_rate ) %]
403                         <li><span class="label">Tax number registered: </span>[% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</li>
404                         <li><span class="label">List item price includes tax: </span>[% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</li>
405                         <li><span class="label">Invoice item price includes tax: </span>[% IF ( invoiceincgst ) %]Yes[% ELSE %]No[% END %]</li>
406                     [% END %]
407                     <li><span class="label">Discount: </span>[% ( discount || 0 ) | format("%.1f" ) %] %</li>
408                     <li><span class="label">Tax rate: </span>[% ( tax_rate || 0 ) * 100 | html %] %</li>
409                     [% IF deliverytime.defined %]
410                         <li><span class="label">Delivery time: </span>[% deliverytime | html %] days</li>
411                     [% END %]
412                     [% IF ( notes ) %]
413                         <li><span class="label">Notes: </span>[% notes | html %]</li>
414                     [% END %]
415                 </div> <!-- #supplier-ordering-information -->
416
417                 [% IF vendor.interfaces.count %]
418                 <div id="supplier-interfaces" class="page-section rows">
419                     <h2>Interfaces</h2>
420
421                     [% FOR i IN vendor.interfaces %]
422                         <h3>[% i.name | html %]</h3>
423                         [% IF i.type %]
424                             <li><span class="label">Type: </span>[% AuthorisedValues.GetByCode( 'VENDOR_INTERFACE_TYPE', i.type) | html %]</li>
425                         [% END %]
426                         [% IF i.uri %]
427                             <li><span class="label">URI: </span>[% i.uri | html %]</li>
428                         [% END %]
429                         [% IF i.login %]
430                             <li><span class="label">Login: </span>[% i.login | html %]</li>
431                         [% END %]
432                         [% IF i.password %]
433                             <li><span class="label">Password: </span><span class="password"><a href="#" class="show_password" data-plain-text-password="[% i.plain_text_password | html %]">Show</a></span></span></li>
434                         [% END %]
435                         [% IF i.account_email %]
436                             <li><span class="label">Account email: </span>[% i.account_email | html %]</li>
437                         [% END %]
438                         [% IF i.notes %]
439                             <li><span class="label">Notes: </span>[% i.notes | html %]</li>
440                         [% END %]
441                     [% END %]
442                 </div>
443                 [% END %]
444
445             </div> <!-- /.col-sm-6 -->
446
447             <div class="col-sm-6">
448                 <div id="supplier-contact-details" class="page-section rows">
449                     <h2>Contact</h2>
450                     [% FOREACH contact IN contacts %]
451                         [% INCLUDE show_contact %]
452                     [% END %]
453                 </div> <!-- /#supplier-contact-details -->
454
455                 <div id="subscription-details" class="page-section rows">
456                     <h2>Subscription details</h2>
457                     <p><strong>Number of subscriptions: </strong>
458                         [% IF (  CAN_user_serials ) %]
459                             <a href="/cgi-bin/koha/serials/serials-search.pl?bookseller_filter=[% name | uri %]&searched=1">[% subscriptioncount | html %]</a>
460                         [% ELSE %]
461                             [% subscriptioncount | html %]
462                         [% END %]
463                     </p>
464                 </div> <!-- /#subscription-details -->
465             </div> <!-- /.col-sm-6 -->
466
467         </div>
468
469         [% IF ( contracts ) %]
470             <div id="supplier-contracts" class="page-section rows">
471                 <h2>Contract(s)</h2>
472                 <table id="contractst">
473                   <thead>
474                     <tr>
475                         <th scope="col">Name</th>
476                         <th scope="col">Description</th>
477                         <th scope="col">Start date</th>
478                         <th scope="col">End date</th>
479                         [% IF CAN_user_acquisition_contracts_manage %]
480                             <th scope="col" class="NoSort noExport">Actions</th>
481                         [% END %]
482                     </tr>
483                   </thead>
484                   <tbody>
485                     [% FOREACH contract IN contracts %]
486                         <tr>
487                         <td>
488                             <a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&amp;contractnumber=[% contract.contractnumber | uri %]&amp;booksellerid=[% contract.booksellerid | uri %]">[% contract.contractname | html %]</a>
489                         </td>
490                         <td>[% contract.contractdescription | html %]</td>
491                         <td data-order="[% contract.contractstartdate | html %]">[% contract.contractstartdate | $KohaDates %]</td>
492                         <td data-order="[% contract.contractenddate | html %]">[% contract.contractenddate | $KohaDates %]</td>
493                         [% IF CAN_user_acquisition_contracts_manage %]
494                             <td class="actions">
495                                 <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-solid fa-pencil" aria-hidden="true"></i> Edit</a>
496                                 <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-can"></i> Delete</a>
497                             </td>
498                         [% END %]
499                         </tr>
500                     [% END %]
501                   </tbody>
502                 </table>
503             </div> <!-- /#supplier-contracts -->
504         [% END %]
505
506 [% END %]
507
508 </main>
509 </div> <!-- /.col-sm-10.col-sm-push-2 -->
510
511 <div class="col-sm-2 col-sm-pull-10">
512     <aside>
513         [% INCLUDE 'vendor-menu.inc' %]
514     </aside>
515 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
516 </div> <!-- /.row -->
517 [% MACRO jsinclude BLOCK %]
518     [% Asset.js("js/acquisitions-menu.js") | $raw %]
519     [% Asset.js("lib/hc-sticky.js") | $raw %]
520     [% Asset.js("js/acq.js") | $raw %]
521     [% INCLUDE 'datatables.inc' %]
522     <script>
523         function confirm_deletion() {
524             if (confirm(_("Confirm deletion of this vendor ?"))) {
525                 window.location="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]&op=delete";
526             }
527         }
528
529         function add_contact() {
530             var new_contact = $('#contact-template').clone();
531             var timestamp = new Date().getTime();
532             $(new_contact).removeAttr('id');
533             $('input, textarea', new_contact).each(function () {
534                 $(this).attr('id', $(this).attr('id') + '_' + timestamp);
535             });
536             $(new_contact).insertBefore(this);
537             if ($('.supplier-contact').length === 2) { // First contact
538                 $.each(['.contact_acqprimary', '.contact_serialsprimary', '.contact_orderacquisition', '.contact_claimacquisition', '.contact_claimissues'], function (idx, checkbox) {
539                     $(checkbox, new_contact).click();
540                 });
541             }
542             $('input[name="contact_name"]', new_contact).focus();
543             return false;
544         }
545
546         function delete_contact(ev) {
547             $(this).parents('.supplier-contact').remove();
548             ev.preventDefault();
549         }
550
551         [% IF vendor %]
552         let aliases = [% To.json(vendor.aliases.unblessed) | $raw %];
553         [% ELSE %]
554         let aliases = [];
555         [% END %]
556         function remove_alias(i){
557             aliases.splice(i, 1);
558             refresh_aliases();
559         }
560
561         function encodeHTMLEntities(str){
562             return str.replace(/[&<>'"]/g,
563               tag => ({
564                   '&': '&amp;',
565                   '<': '&lt;',
566                   '>': '&gt;',
567                   "'": '&#39;',
568                   '"': '&quot;'
569                 }[tag]));
570         }
571
572         function add_alias(){
573             let alias = $("#new_alias").val();
574             if ( !alias.length > 0 ) { return }
575             aliases.push({alias});
576             refresh_aliases();
577         }
578         function refresh_aliases(){
579             let nodes = $("<div></div>");
580             aliases.forEach((a, i) => {
581                 let alias_str = encodeHTMLEntities(a.alias);
582                 let n = $("<div></div>").append(alias_str);
583                 let input = $('<input type="hidden" name="alias" />');
584                 input.val(a.alias);
585                 n.append(input);
586                 n.append(` <a style="cursor: pointer;" onclick="remove_alias(${i});"><i class="fa fa-trash" aria-hidden="true"></i> ` + _("Remove") + '</a>');
587                 nodes.append(n);
588             });
589             nodes.append("<input id='new_alias' type='text' class='noEnterSubmit' />");
590             nodes.append(' <a style="cursor: pointer;" onclick="add_alias();"><i class="fa fa-plus" aria-hidden="true"></i> ' + _("Add") + '</a>');
591             $("#aliases").html(nodes.html());
592         }
593
594         [% IF vendor %]
595             let interfaces = [];
596             [% FOR i_object IN vendor.interfaces %]
597                 [% SET i = i_object.unblessed %]
598                 [% SET i.password = i_object.plain_text_password %]
599                 interfaces.push([% To.json(i) | $raw %]);
600             [% END %]
601         [% ELSE %]
602             let interfaces = [];
603         [% END %]
604         function serialize_interface_form(){
605             interfaces = [];
606             $("#interfaces > fieldset.supplier-interface > ol.interface-form").each( (index, interface_form )=> {
607                 let interface = {};
608                 $(interface_form).find('input,textarea,select').serializeArray().map(attr => {
609                     let name = attr.name.replace(/interface_([\w_]+)_\d+/, "$1");
610                     interface[name] = attr.value
611                 })
612                 interfaces.push(interface);
613             });
614             return interfaces;
615         }
616         function remove_interface(i){
617             interfaces = serialize_interface_form();
618             interfaces.splice(i, 1);
619             refresh_interfaces();
620         }
621         function add_interface(){
622             interfaces = serialize_interface_form();
623             interfaces.push({
624                 type: "",
625                 name: "",
626                 uri: "",
627                 login: "",
628                 password: "",
629                 account_email: "",
630                 notes: "",
631             });
632             refresh_interfaces();
633         }
634         let av_select = {
635             VENDOR_INTERFACE_TYPE: $("[% PROCESS 'av-build-dropbox.inc', category="VENDOR_INTERFACE_TYPE" empty=1 | replace('\n', '') | replace('"', '\"') %]"),
636         };
637         function refresh_interfaces(){
638             let nodes = $("<div id='interfaces'></div>");
639             interfaces.forEach((interface, i) => {
640                 let n = $("<fieldset class='supplier-interface'></fieldset>");
641                 n.append("<legend>" + _("Interface details") + "</legend>");
642                 n.append(`<input type="hidden" name="interface_counter" value="${i}" />`);
643                 let ol = $('<ol class="interface-form"></ol>');
644                 let attributes = [
645                     { label: _("Name:"),          name: 'name',          node: 'input' },
646                     { label: _("Type:"),          name: 'type',          node: 'av_select', av_cat: 'VENDOR_INTERFACE_TYPE' },
647                     { label: _("URI:"),           name: 'uri',           node: 'input' },
648                     { label: _("Login:"),         name: 'login',         node: 'input' },
649                     { label: _("Password:"),      name: 'password',      node: 'input' },
650                     { label: _("Account email:"), name: 'account_email', node: 'input' },
651                     { label: _("Notes:"),         name: 'notes',         node: 'textarea' }
652                 ];
653                 attributes.forEach((attribute, ii) => {
654                     let li = $('<li></li>');
655                     li.append(`<label for="interface_${attribute.name}_${i}">${attribute.label}</label>`);
656                     if( attribute.node == 'input' ) {
657                         li.append(`<input type="text" size="40" id="interface_${attribute.name}_${i}" name="interface_${attribute.name}_${i}" value="${interface[attribute.name]}" />`);
658                     } else if ( attribute.node == 'textarea' ) {
659                         li.append(`<textarea cols="40" rows="3" id="interface_${attribute.name}_${i}" name="interface_${attribute.name}_${i}">${interface[attribute.name]}</textarea>`);
660                     } else if ( attribute.node == 'av_select' ) {
661                         let select = av_select[attribute.av_cat].clone();
662                         select.attr('name', `interface_${attribute.name}_${i}`);
663                         select.find(`option[value='${interface[attribute.name]}']`).prop("selected", true);
664                         li.append(select);
665                     }
666                     ol.append(li);
667                 });
668                 ol.append(`<li><button class="btn btn-default" onclick="remove_interface(${i});"><i class="fa fa-trash"></i> ` + _("Delete interface") + '</li>');
669                 n.append(ol);
670                 nodes.append(n);
671             });
672             nodes.append(`<button onclick="add_interface();" class="btn btn-default"><i class="fa fa-plus"></i> ` + _("Add another interface") + '</button>')
673             $("#interfaces").replaceWith(nodes);
674
675             interfaces.forEach((interface, i) => {
676                 $("#interface_account_email_" + i).rules("add", {
677                     email: true,
678                 });
679             });
680         }
681
682         var Sticky;
683
684          $(document).ready(function() {
685             var contractst = $("#contractst").dataTable($.extend(true, {}, dataTablesDefaults, {
686                 "aoColumnDefs": [
687                     { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] }
688                 ],
689                 'sDom': 't'
690             } ) );
691             $('body').on('click', '.delete-contact', null, delete_contact);
692             $('#add-contact').click(add_contact);
693             $('body').on('click', '.contact_acqprimary', null, function () {
694                 if ($(this).is(':checked')) {
695                     $('.contact_acqprimary').filter(':checked').not(this).prop('checked', false);
696                     $('.contact_acqprimary_hidden').each(function () {
697                         $(this).val('0');
698                     });
699                 }
700                 $(this).next('.contact_acqprimary_hidden').val('1');
701             });
702             $('body').on('click', '.contact_serialsprimary', null, function () {
703                 if ($(this).is(':checked')) {
704                     $('.contact_serialsprimary').filter(':checked').not(this).prop('checked', false);
705                     $('.contact_serialsprimary_hidden').each(function () {
706                         $(this).val('0');
707                     });
708                 }
709                 $(this).next('.contact_serialsprimary_hidden').val($(this).is(':checked') ? '1' : '0');
710             });
711             $('body').on('click', '.contact_orderacquisition', null, function () {
712                 $(this).next('.contact_orderacquisition_hidden').val($(this).is(':checked') ? '1' : '0');
713             });
714             $('body').on('click', '.contact_claimacquisition', null, function () {
715                 $(this).next('.contact_claimacquisition_hidden').val($(this).is(':checked') ? '1' : '0');
716             });
717             $('body').on('click', '.contact_claimissues', null, function () {
718                 $(this).next('.contact_claimissues_hidden').val($(this).is(':checked') ? '1' : '0');
719             });
720
721             $('body').on('click', '.show_password', null, function(e){
722                 e.preventDefault();
723                 $(this).parent().replaceWith($(this).data('plain-text-password'));
724             });
725             refresh_aliases();
726             refresh_interfaces();
727
728             Sticky = $("#toolbar");
729             Sticky.hcSticky({
730                 stickTo: "main",
731                 stickyClass: "floating"
732             });
733         });
734     </script>
735 [% END %]
736
737 [% INCLUDE 'intranet-bottom.inc' %]