1 [% USE HTML %]<body [% IF onload %]onload="[% onload %]"[% END %]>
3 <form action="[% HTML.escape(script) %]" method="post" name="Form">
5 <input type="hidden" name="input_partnumber" value="[% HTML.escape(input_partnumber) %]">
6 <input type="hidden" name="input_description" value="[% HTML.escape(input_description) %]">
7 <input type="hidden" name="input_partsid" value="[% HTML.escape(input_partsid) %]">
8 <input type="hidden" name="input_partnotes" value="[% HTML.escape(input_partnotes) %]">
9 <input type="hidden" name="allow_creation" value="[% HTML.escape(allow_creation) %]">
10 <input type="hidden" name="action_on_part_selected" value="[% HTML.escape(action_on_part_selected) %]">
11 <input type="hidden" name="filter" value="[% HTML.escape(filter) %]">
12 <input type="hidden" name="options" value="[% HTML.escape(options) %]">
13 <input type="hidden" name="new_description" value="[% HTML.escape(description) %]">
15 <div class="listtop">[% title %]</div>
20 [% IF no_parts_found %]
21 <translate>No part was found matching the search parameters.</translate>
22 [% IF allow_creation %]
23 <translate>However, you can create a new part which will then be selected.</translate>
26 <translate>Please select a part from the list below.</translate>
27 [% IF allow_creation %]
28 <translate>Alternatively you can create a new part which will then be selected.</translate>
34 [% UNLESS no_parts_found %]
38 <tr class="listheading">
39 <th class="listheading"> </th>
40 [% FOREACH header = HEADER %]
41 <th nowrap class="listheading"><a href="[% HTML.escape(header.callback) %]">[% header.column_title %]</a></th>
45 [% FOREACH part = PARTS %]
46 <tr class="listrow[% IF loop.count % 2 %]1[% ELSE %]0[% END %]">
47 <td><button type="button" onclick="part_selected('[% loop.count %]')"><translate>Select</translate></button></td>
49 <input type="hidden" id="partsid_[% loop.count %]" name="partsid_[% loop.count %]" value="[% HTML.escape(part.id) %]">
50 <input type="hidden" id="partnumber_[% loop.count %]" name="partnumber_[% loop.count %]" value="[% HTML.escape(part.partnumber) %]">
51 [% HTML.escape(part.partnumber) %]
54 <input type="hidden" id="description_[% loop.count %]" name="description_[% loop.count %]" value="[% HTML.escape(part.description) %]">
55 <input type="hidden" id="partnotes_[% loop.count %]" name="partnotes_[% loop.count %]" value="[% HTML.escape(part.partnotes) %]">
56 [% HTML.escape(part.description) %]
59 <!-- <input type="hidden" id="onhand_[% loop.count %]" name="onhand_[% loop.count %]" value="[% HTML.escape(part.onhand) %]"> -->
60 <!-- [% HTML.escape(part.onhand) %] -->
70 [% IF allow_creation %]
71 <p><input type="submit" name="action" value="<translate>New part</translate>"></p>
76 <script type="text/javascript">
78 function part_selected(selected) {
79 var partnumber = document.getElementsByName("partnumber_" + selected)[0].value;
80 var description = document.getElementsByName("description_" + selected)[0].value;
81 var partsid = document.getElementsByName("partsid_" + selected)[0].value;
82 var partnotes = document.getElementsByName("partnotes_" + selected)[0].value;
83 var pnum_name = document.Form.input_partnumber.value;
84 window.opener.document.getElementsByName(pnum_name)[0].value = partnumber;
85 window.opener.document.getElementsByName(document.Form.input_description.value)[0].value = description;
86 if (document.Form.input_partsid.value != "") {
87 window.opener.document.getElementsByName(document.Form.input_partsid.value)[0].value = partsid;
89 if (document.Form.input_partnotes.value != "") {
90 var el = window.opener.document.getElementsByName(document.Form.input_partnotes.value)[0];
94 if (document.Form.action_on_part_selected.value != "") {
95 window.opener.document.getElementsByName("action")[0].value = document.Form.action_on_part_selected.value;
96 window.opener.document.[% formname %].submit();
101 if (pnum_name.substr(0, 2) == "f_") {
103 pnum_name = pnum_name.substr(2);
105 pnum_name = prefix + "old_" + pnum_name;
106 var input = window.opener.document.getElementsByName(pnum_name)[0];
111 [%- IF click_button %]
112 window.opener.document.[% formname %].[% click_button %].click();