5 [% USE AuthorisedValues %]
6 [% PROCESS 'i18n.inc' %]
7 [% BLOCK edit_contact %]
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="tel" 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="tel" 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="tel" 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="email" 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>
25 <div style="display:flex">
27 <fieldset class="rows">
28 <legend>Acquisitions options</legend>
32 [% IF contact.acqprimary %]
33 <input type="checkbox" id="contact_acqprimary[% contact.id | html %]" class="contact_acqprimary" checked="checked" />
35 <input type="checkbox" id="contact_acqprimary[% contact.id | html %]" class="contact_acqprimary" />
37 <input type="hidden" class="contact_acqprimary_hidden" name="contact_acqprimary" value="[% contact.acqprimary | html %]" />
38 Primary acquisitions contact
43 [% IF contact.orderacquisition %]
44 <input type="checkbox" id="contact_orderacquisition[% contact.id | html %]" class="contact_orderacquisition" checked="checked" />
46 <input type="checkbox" id="contact_orderacquisition[% contact.id | html %]" class="contact_orderacquisition" />
48 <input type="hidden" class="contact_orderacquisition_hidden" name="contact_orderacquisition" value="[% contact.orderacquisition | html %]" />
54 [% IF contact.claimacquisition %]
55 <input type="checkbox" id="contact_claimacquisition[% contact.id | html %]" class="contact_claimacquisition" checked="checked" />
57 <input type="checkbox" id="contact_claimacquisition[% contact.id | html %]" class="contact_claimacquisition" />
59 <input type="hidden" class="contact_claimacquisition_hidden" name="contact_claimacquisition" value="[% contact.claimacquisition | html %]" />
60 Contact about late orders
67 <fieldset class="rows">
68 <legend>Serials options</legend>
72 [% IF contact.serialsprimary %]
73 <input type="checkbox" id="contact_serialsprimary[% contact.id | html %]" class="contact_serialsprimary" checked="checked" />
75 <input type="checkbox" id="contact_serialsprimary[% contact.id | html %]" class="contact_serialsprimary" />
77 <input type="hidden" class="contact_serialsprimary_hidden" name="contact_serialsprimary" value="[% contact.serialsprimary | html %]" />
78 Primary serials contact
83 [% IF contact.claimissues %]
84 <input type="checkbox" id="contact_claimissues[% contact.id | html %]" class="contact_claimissues" checked="checked" />
86 <input type="checkbox" id="contact_claimissues[% contact.id | html %]" class="contact_claimissues" />
88 <input type="hidden" class="contact_claimissues_hidden" name="contact_claimissues" value="[% contact.claimissues | html %]" />
89 Contact about late issues
97 [% IF contact.id %]<li><button class="btn btn-default delete-contact"><i class="fa fa-trash-can"></i> Delete contact</li>[% END %]
101 [% BLOCK show_contact %]
102 <h3>[% contact.name | html %]</h3>
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>
111 [% IF ( contact.notes ) %]
112 <li><span class="label">Notes: </span>[% contact.notes | html %]</li>
114 [% IF ( contact.acqprimary || contact.orderacquisition || contact.claimacquisition ) %]
116 <span class="label">Acquisitions options:</span>
118 [% IF ( contact.acqprimary ) %]
119 <li><span class="label"></span> <i class="fa fa-check"></i> Primary acquisitions contact</li>
121 [% IF ( contact.orderacquisition ) %]
122 <li><span class="label"></span> <i class="fa fa-check"></i> Receives orders</li>
124 [% IF ( contact.claimacquisition ) %]
125 <li><span class="label"></span> <i class="fa fa-check"></i> Receives claims for late orders</li>
130 [% IF ( contact.serialsprimary || contact.claimissues ) %]
132 <span class="label">Serials options:</span>
134 [% IF ( contact.serialsprimary ) %]
135 <li><span class="label"></span> <i class="fa fa-check"></i> Primary serials contact</li>
137 [% IF ( contact.claimissues ) %]
138 <li><span class="label"></span> <i class="fa fa-check"></i> Receives claims for late issues</li>
146 [% SET footerjs = 1 %]
147 [% INCLUDE 'doc-head-open.inc' %]
148 <title>[% FILTER collapse %]
149 [% tx("Vendor {vendor}", { vendor = name }) | html %] ›
150 [% t("Koha") | html %]
152 [% INCLUDE 'doc-head-close.inc' %]
155 <body id="acq_supplier" class="acq">
156 [% WRAPPER 'header.inc' %]
157 [% INCLUDE 'acquisitions-search.inc' %]
160 [% WRAPPER 'sub-header.inc' %]
161 [% WRAPPER breadcrumbs %]
162 [% WRAPPER breadcrumb_item %]
163 <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
166 [% IF ( booksellerid ) %]
167 [% WRAPPER breadcrumb_item %]
168 <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% name | html %]</a>
170 [% WRAPPER breadcrumb_item bc_active= 1 %]
171 <span>Modify [% name | html %]</span>
174 [% WRAPPER breadcrumb_item bc_active= 1 %]
175 <span>Add vendor</span>
179 [% WRAPPER breadcrumb_item bc_active= 1 %]
182 [% END # /IF (enter) %]
183 [% END #/ WRAPPER breadcrumbs %]
184 [% END #/ WRAPPER sub-header.inc %]
186 <div class="main container-fluid">
188 <div class="col-sm-10 col-sm-push-2">
192 [% IF ( booksellerid ) %]
193 <h1>Update: [% name | html %]</h1>
198 [% UNLESS ( enter ) %][% INCLUDE 'acquisitions-toolbar.inc' %][% END %]
200 <form action="updatesupplier.pl" name="updatesupplier" style="display:block" class="validated" method="post">
201 <div id="toolbar" class="btn-toolbar">
202 <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> Save</button>
203 [% IF ( booksellerid ) %]
204 <a class="btn btn-default cancel" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">
206 <a class="btn btn-default cancel" href="/cgi-bin/koha/acqui/acqui-home.pl">
207 [% END %] <i class="fa fa-times"></i> Cancel</a>
210 <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
211 <fieldset class="rows">
212 <legend>Company details</legend>
213 <ol><li><label for="company" class="required">Name:</label>
214 <input type="text" size="40" id="company" name="company" value="[% name | html %]" required="required" class="required focus" /><span class="required">Required</span></li>
215 <li><label for="company_postal">Postal address: </label>
216 <textarea id="company_postal" name="company_postal" cols="40" rows="3">[% postal | html %]</textarea></li>
217 <li><label for="physical">Physical address: </label>
218 <textarea id="physical" name="physical" cols="40" rows="3">[% address1 | html %][% address2 | html %][% address3 | html %][% address4 | html %]</textarea></li>
219 <li><label for="company_phone">Phone: </label>
220 <input type="tel" size="20" id="company_phone" name="company_phone" value="[% phone | html %]" /></li>
221 <li><label for="company_fax">Fax: </label>
222 <input type="tel" size="20" id="company_fax" name="company_fax" value="[% fax | html %]" /></li>
223 <li><label for="website">Website: </label>
224 <input type="url" size="40" id="website" name="website" value="[% url | html %]" class="url" /></li>
225 <li><label for="accountnumber">Account number: </label>
226 <input type="text" size="40" id="accountnumber" name="accountnumber" value="[% accountnumber | html %]" /></li>
228 <label for="vendor_type">Vendor type: </label>
229 [% PROCESS 'av-build-dropbox.inc' name="vendor_type", category="VENDOR_TYPE", default=type, empty=1, size = 20 %]
232 <label for="aliases">Aliases: </label>
233 <div id="aliases" style="padding-left: 11rem;"></div>
237 <fieldset class="rows">
238 <legend>Contacts</legend>
239 <fieldset id="contact-template" class="supplier-contact">
240 <legend>Contact details</legend>
241 [% INCLUDE edit_contact %]
243 [% FOREACH contact IN contacts %]
244 <fieldset class="supplier-contact">
245 <legend>Contact details</legend>
246 [% INCLUDE edit_contact %]
249 <button id="add-contact" class="btn btn-default"><i class="fa fa-plus"></i> Add another contact</button>
252 <fieldset class="rows">
253 <legend>Interfaces</legend>
254 <div id="interfaces"></div>
257 <fieldset class="rows">
258 <legend>Ordering information</legend>
259 <ol><li><label for="activestatus">Vendor is:</label>
261 <input type="radio" id="activestatus" name="status" value="1" checked="checked" />
262 <label class="radio" for="activestatus">Active</label>
263 <input type="radio" id="inactivestatus" name="status" value="0" />
264 <label class="radio" for="inactivestatus">Inactive</label>
266 <input type="radio" id="activestatus" name="status" value="1" />
267 <label class="radio" for="activestatus">Active</label>
268 <input type="radio" id="inactivestatus" name="status" value="0" checked="checked" />
269 <label class="radio" for="inactivestatus">Inactive</label>
271 <li><label for="list_currency">List prices are: </label>
272 <select name="list_currency" id="list_currency">
273 [% FOREACH c IN currencies %]
274 [% IF booksellerid and c.currency == listprice or not booksellerid and c.active %]
275 <option value="[% c.currency | html %]" selected="selected">[% c.currency | html %]</option>
276 [% ELSIF not c.archived %]
277 <option value="[% c.currency | html %]">[% c.currency | html %]</option>
282 <li><label for="invoice_currency">Invoice prices are: </label>
283 <select name="invoice_currency" id="invoice_currency">
284 [% FOREACH c IN currencies %]
285 [% IF booksellerid and c.currency == invoiceprice or not booksellerid and c.active %]
286 <option value="[% c.currency | html %]" selected="selected">[% c.currency | html %]</option>
287 [% ELSIF not c.archived %]
288 <option value="[% c.currency | html %]">[% c.currency | html %]</option>
293 <li><label for="gstyes">Tax number registered:</label>
295 <label class="radio" for="gstyes">Yes</label>
296 <input type="radio" name="gst" id="gstyes" value="1" checked="checked" />
297 <label class="radio" for="gstno">No</label>
298 <input type="radio" name="gst" id="gstno" value="0" />
300 <label class="radio" for="gstyes">Yes</label>
301 <input type="radio" name="gst" id="gstyes" value="1" />
302 <label class="radio" for="gstno">No</label>
303 <input type="radio" name="gst" id="gstno" value="0" checked="checked" />
306 <li><label for="list_gstyes">List prices:</label>
307 [% IF ( listincgst ) %]
308 <label class="radio" for="list_gstyes">Include tax</label>
309 <input type="radio" id="list_gstyes" name="list_gst" value="1" checked="checked" />
310 <label class="radio" for="list_gstno">Don't include tax</label>
311 <input type="radio" id="list_gstno" name="list_gst" value="0" />
313 <label class="radio" for="list_gstyes">Include tax</label>
314 <input type="radio" id="list_gstyes" name="list_gst" value="1" />
315 <label class="radio" for="list_gstno">Don't include tax</label>
316 <input type="radio" id="list_gstno" name="list_gst" value="0" checked="checked" />
319 <li><label for="invoice_gstyes">Invoice prices:</label>
320 [% IF ( invoiceincgst ) %]
321 <label class="radio" for="invoice_gstyes">Include tax</label>
322 <input type="radio" id="invoice_gstyes" name="invoice_gst" value="1" checked="checked" />
323 <label class="radio" for="invoice_gstno">Don't include tax</label>
324 <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" />
326 <label class="radio" for="invoice_gstyes">Include tax</label>
327 <input type="radio" id="invoice_gstyes" name="invoice_gst" value="1" />
328 <label class="radio" for="invoice_gstno">Don't include tax</label>
329 <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" checked="checked" />
334 <label for="tax_rate">Tax rate: </label>
335 <select name="tax_rate" id="tax_rate">
336 [% FOREACH gst IN gst_values %]
337 [% IF ( tax_rate == gst.option ) %]
338 <option value="[% gst.option | html %]" selected="selected">[% gst.option * 100 | html %] %</option>
340 <option value="[% gst.option | html %]">[% gst.option * 100 | html %] %</option>
346 <input type="hidden" name="tax_rate" value="0" />
348 <li><label for="discount">Discount: </label>
349 <input type="text" size="6" id="discount" name="discount" value="[% discount | format ('%.1f') %]" />%</li>
351 <label for="deliverytime">Delivery time: </label>
352 <input type="text" size="2" id="deliverytime" name="deliverytime" value="[% deliverytime | html %]" /> days
354 <li><label for="notes">Notes: </label>
355 <textarea cols="40" rows="4" id="notes" name="notes" >[% notes | html %]</textarea></li>
361 <h1>[% name | html %]</h1>
363 <div class="col-sm-6">
364 <div id="supplier-company-details" class="page-section rows">
365 <h2>Vendor details</h2>
367 <span class="label">Type: </span>
368 [% IF (type) %][% AuthorisedValues.GetByCode( 'VENDOR_TYPE', type ) | html %][% END %]
370 <li><span class="label">Company name: </span>[% name | html %]</li>
371 <li><span class="label">Postal address: </span>[% postal | html %]</li>
372 <li><span class="label">Physical address: </span>[% address1 | html %][% address2 | html %][% address3 | html %][% address4 | html %]</li>
373 <li><span class="label">Phone: </span>[% phone | html %]</li>
374 <li><span class="label">Fax: </span>[% fax | html %]</li>
376 <li><span class="label">Website: </span><a href="[% url | url %]" target="_blank">[% url | html %]</a></li>
378 [% IF ( accountnumber ) %]
379 <li><span class="label">Account number: </span>[% accountnumber | html %]</li>
381 [% IF vendor.aliases.count %]
383 <span class="label">Aliases: </span>
385 [% FOR alias IN vendor.aliases %]
386 <li>[% alias.alias | html %]</li>
391 </div> <!-- /#supplier-company-details -->
393 <div id="supplier-ordering-information" class="page-section rows">
394 <h2>Ordering information</h2>
395 <li><span class="label">Vendor is: </span>[% IF ( active ) %]Active[% ELSE %]Inactive[% END %]</li>
396 <li><span class="label">List prices are: </span>[% listprice | html %]</li>
397 <li><span class="label">Invoice prices are: </span>[% invoiceprice | html %]</li>
398 [% IF ( tax_rate ) %]
399 <li><span class="label">Tax number registered: </span>[% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</li>
400 <li><span class="label">List item price includes tax: </span>[% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</li>
401 <li><span class="label">Invoice item price includes tax: </span>[% IF ( invoiceincgst ) %]Yes[% ELSE %]No[% END %]</li>
403 <li><span class="label">Discount: </span>[% ( discount || 0 ) | format("%.1f" ) %] %</li>
404 <li><span class="label">Tax rate: </span>[% ( tax_rate || 0 ) * 100 | html %] %</li>
405 [% IF deliverytime.defined %]
406 <li><span class="label">Delivery time: </span>[% deliverytime | html %] days</li>
409 <li><span class="label">Notes: </span>[% notes | html %]</li>
411 </div> <!-- #supplier-ordering-information -->
413 [% IF vendor.interfaces.count %]
414 <div id="supplier-interfaces" class="page-section rows">
417 [% FOR i IN vendor.interfaces %]
418 <h3>[% i.name | html %]</h3>
420 <li><span class="label">Type: </span>[% AuthorisedValues.GetByCode( 'VENDOR_INTERFACE_TYPE', i.type) | html %]</li>
424 <span class="label">URI: </span><a href="[% i.uri | url %]" target="_blank">[% i.uri | html %]</a>
428 <li><span class="label">Login: </span>[% i.login | html %]</li>
431 <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>
433 [% IF i.account_email %]
434 <li><span class="label">Account email: </span>[% i.account_email | html %]</li>
437 <li><span class="label">Notes: </span>[% i.notes | html %]</li>
443 </div> <!-- /.col-sm-6 -->
445 <div class="col-sm-6">
446 <div id="supplier-contact-details" class="page-section rows">
448 [% FOREACH contact IN contacts %]
449 [% INCLUDE show_contact %]
451 </div> <!-- /#supplier-contact-details -->
453 <div id="subscription-details" class="page-section">
454 <h2>Subscription details</h2>
455 <p><strong>Number of subscriptions: </strong>
456 [% IF ( CAN_user_serials ) %]
457 <a href="/cgi-bin/koha/serials/serials-search.pl?bookseller_filter=[% name | uri %]&searched=1">[% subscriptioncount | html %]</a>
459 [% subscriptioncount | html %]
462 </div> <!-- /#subscription-details -->
463 </div> <!-- /.col-sm-6 -->
465 </div> <!-- /.row -->
467 [% IF ( contracts ) %]
468 <div id="supplier-contracts" class="page-section rows">
470 <table id="contractst">
473 <th scope="col">Name</th>
474 <th scope="col">Description</th>
475 <th scope="col">Start date</th>
476 <th scope="col">End date</th>
477 [% IF CAN_user_acquisition_contracts_manage %]
478 <th scope="col" class="NoSort noExport">Actions</th>
483 [% FOREACH contract IN contracts %]
486 <a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=[% contract.contractnumber | uri %]&booksellerid=[% contract.booksellerid | uri %]">[% contract.contractname | html %]</a>
488 <td>[% contract.contractdescription | html %]</td>
489 <td data-order="[% contract.contractstartdate | html %]">[% contract.contractstartdate | $KohaDates %]</td>
490 <td data-order="[% contract.contractenddate | html %]">[% contract.contractenddate | $KohaDates %]</td>
491 [% IF CAN_user_acquisition_contracts_manage %]
493 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=[% contract.contractnumber | html %]&booksellerid=[% contract.booksellerid | html %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
494 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/aqcontract.pl?op=delete_confirm&contractnumber=[% contract.contractnumber | html %]&booksellerid=[% contract.booksellerid | html %]"><i class="fa fa-trash-can"></i> Delete</a>
501 </div> <!-- /#supplier-contracts -->
507 </div> <!-- /.col-sm-10.col-sm-push-2 -->
509 <div class="col-sm-2 col-sm-pull-10">
511 [% INCLUDE 'vendor-menu.inc' %]
513 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
514 </div> <!-- /.row -->
515 [% MACRO jsinclude BLOCK %]
516 [% Asset.js("js/acquisitions-menu.js") | $raw %]
517 [% Asset.js("lib/hc-sticky.js") | $raw %]
518 [% Asset.js("js/acq.js") | $raw %]
519 [% INCLUDE 'datatables.inc' %]
521 function confirm_deletion() {
522 if (confirm(_("Confirm deletion of this vendor ?"))) {
523 window.location="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]&op=delete";
527 function add_contact() {
528 var new_contact = $('#contact-template').clone();
529 var timestamp = new Date().getTime();
530 $(new_contact).removeAttr('id');
531 $('input, textarea', new_contact).each(function () {
532 $(this).attr('id', $(this).attr('id') + '_' + timestamp);
534 $(new_contact).insertBefore(this);
535 if ($('.supplier-contact').length === 2) { // First contact
536 $.each(['.contact_acqprimary', '.contact_serialsprimary', '.contact_orderacquisition', '.contact_claimacquisition', '.contact_claimissues'], function (idx, checkbox) {
537 $(checkbox, new_contact).click();
540 $('input[name="contact_name"]', new_contact).focus();
544 function delete_contact(ev) {
545 $(this).parents('.supplier-contact').remove();
550 let aliases = [% To.json(vendor.aliases.unblessed) | $raw %];
554 function remove_alias(i){
555 aliases.splice(i, 1);
559 function encodeHTMLEntities(str){
560 return str.replace(/[&<>'"]/g,
570 function add_alias(){
571 let alias = $("#new_alias").val();
572 if ( !alias.length > 0 ) { return }
573 aliases.push({alias});
576 function refresh_aliases(){
577 let nodes = $("<div></div>");
578 aliases.forEach((a, i) => {
579 let alias_str = encodeHTMLEntities(a.alias);
580 let n = $("<div></div>").append(alias_str);
581 let input = $('<input type="hidden" name="alias" />');
584 n.append(` <a style="cursor: pointer;" onclick="remove_alias(${i});"><i class="fa fa-trash" aria-hidden="true"></i> ` + _("Remove") + '</a>');
587 nodes.append("<input id='new_alias' type='text' class='noEnterSubmit' />");
588 nodes.append(' <a style="cursor: pointer;" onclick="add_alias();"><i class="fa fa-plus" aria-hidden="true"></i> ' + _("Add") + '</a>');
589 $("#aliases").html(nodes.html());
594 [% FOR i_object IN vendor.interfaces %]
595 [% SET i = i_object.unblessed %]
596 [% SET i.password = i_object.plain_text_password %]
597 interfaces.push([% To.json(i) | $raw %]);
602 function serialize_interface_form(){
604 $("#interfaces > fieldset.supplier-interface > ol.interface-form").each( (index, interface_form )=> {
606 $(interface_form).find('input,textarea,select').serializeArray().map(attr => {
607 let name = attr.name.replace(/interface_([\w_]+)_\d+/, "$1");
608 interface[name] = attr.value
610 interfaces.push(interface);
614 function remove_interface(i){
615 interfaces = serialize_interface_form();
616 interfaces.splice(i, 1);
617 refresh_interfaces();
619 function add_interface(){
620 interfaces = serialize_interface_form();
630 refresh_interfaces();
633 VENDOR_INTERFACE_TYPE: $("[% PROCESS 'av-build-dropbox.inc', category="VENDOR_INTERFACE_TYPE" empty=1 | replace('\n', '') | replace('"', '\"') %]"),
635 function refresh_interfaces(){
636 let nodes = $("<div id='interfaces'></div>");
637 interfaces.forEach((interface, i) => {
638 let n = $("<fieldset class='supplier-interface'></fieldset>");
639 n.append("<legend>" + _("Interface details") + "</legend>");
640 n.append(`<input type="hidden" name="interface_counter" value="${i}" />`);
641 let ol = $('<ol class="interface-form"></ol>');
643 { label: _("Name:"), name: 'name', type: 'text', node: 'input' },
644 { label: _("Type:"), name: 'type', type: 'select', node: 'av_select', av_cat: 'VENDOR_INTERFACE_TYPE' },
645 { label: _("URI:"), name: 'uri', type: 'url', node: 'input' },
646 { label: _("Login:"), name: 'login', type: 'text', node: 'input' },
647 { label: _("Password:"), name: 'password', type: 'text', node: 'input' },
648 { label: _("Account email:"), name: 'account_email', type: 'email', node: 'input' },
649 { label: _("Notes:"), name: 'notes', type: 'textarea', node: 'textarea' }
651 attributes.forEach((attribute, ii) => {
652 let li = $('<li></li>');
653 li.append(`<label for="interface_${attribute.name}_${i}">${attribute.label}</label>`);
654 if( attribute.node == 'input' ) {
655 li.append(`<input type="${attribute.type}" size="40" id="interface_${attribute.name}_${i}" name="interface_${attribute.name}_${i}" value="${interface[attribute.name]}" />`);
656 } else if ( attribute.node == 'textarea' ) {
657 li.append(`<textarea cols="40" rows="3" id="interface_${attribute.name}_${i}" name="interface_${attribute.name}_${i}">${interface[attribute.name]}</textarea>`);
658 } else if ( attribute.node == 'av_select' ) {
659 let select = av_select[attribute.av_cat].clone();
660 select.attr('name', `interface_${attribute.name}_${i}`);
661 select.find(`option[value='${interface[attribute.name]}']`).prop("selected", true);
666 ol.append(`<li><button class="btn btn-default" onclick="remove_interface(${i});"><i class="fa fa-trash"></i> ` + _("Delete interface") + '</li>');
670 nodes.append(`<button onclick="add_interface();" class="btn btn-default"><i class="fa fa-plus"></i> ` + _("Add another interface") + '</button>')
671 $("#interfaces").replaceWith(nodes);
673 interfaces.forEach((interface, i) => {
674 $("#interface_account_email_" + i).rules("add", {
682 $(document).ready(function() {
683 var contractst = $("#contractst").dataTable($.extend(true, {}, dataTablesDefaults, {
685 { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] }
689 $('body').on('click', '.delete-contact', null, delete_contact);
690 $('#add-contact').click(add_contact);
691 $('body').on('click', '.contact_acqprimary', null, function () {
692 if ($(this).is(':checked')) {
693 $('.contact_acqprimary').filter(':checked').not(this).prop('checked', false);
694 $('.contact_acqprimary_hidden').each(function () {
698 $(this).next('.contact_acqprimary_hidden').val('1');
700 $('body').on('click', '.contact_serialsprimary', null, function () {
701 if ($(this).is(':checked')) {
702 $('.contact_serialsprimary').filter(':checked').not(this).prop('checked', false);
703 $('.contact_serialsprimary_hidden').each(function () {
707 $(this).next('.contact_serialsprimary_hidden').val($(this).is(':checked') ? '1' : '0');
709 $('body').on('click', '.contact_orderacquisition', null, function () {
710 $(this).next('.contact_orderacquisition_hidden').val($(this).is(':checked') ? '1' : '0');
712 $('body').on('click', '.contact_claimacquisition', null, function () {
713 $(this).next('.contact_claimacquisition_hidden').val($(this).is(':checked') ? '1' : '0');
715 $('body').on('click', '.contact_claimissues', null, function () {
716 $(this).next('.contact_claimissues_hidden').val($(this).is(':checked') ? '1' : '0');
719 $('body').on('click', '.show_password', null, function(e){
721 $(this).parent().replaceWith($(this).data('plain-text-password'));
724 refresh_interfaces();
726 Sticky = $("#toolbar");
729 stickyClass: "floating"
735 [% INCLUDE 'intranet-bottom.inc' %]