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