a6570aec6fb1c5ef6081c5d285db604d63ab6682
[kivitendo-erp.git] / templates / webpages / generic / cov_selection.html
1 [%- USE T8 %]
2 [%- USE HTML %]
3 <body[% IF onload %] onload="[% onload %]"[% END %]>
4
5  <form method="post">
6
7   <input type="hidden" name="input_name" value="[% HTML.escape(input_name) %]">
8   <input type="hidden" name="input_id" value="[% HTML.escape(input_id) %]">
9   <input type="hidden" name="is_vendor" value="[% HTML.escape(is_vendor) %]">
10   <input type="hidden" name="allow_both" value="[% HTML.escape(allow_both) %]">
11   <input type="hidden" name="action_on_cov_selected" value="[% HTML.escape(action_on_cov_selected) %]">
12
13   <table width="100%">
14    <tr>
15     <th class="listtop">[% title %]</th>
16    </tr>
17    <tr height="5"></tr>
18
19    <tr>
20     <td>
21      [%- IF !is_vendor %]
22       [% 'Please select a customer from the list below.' | $T8 %]
23      [%- ELSE %]
24       [% 'Please select a vendor from the list below.' | $T8 %]
25      [%- END %]
26     </td>
27    </tr>
28
29    <tr>
30     <td>
31
32      <table>
33       <tr class="listheading">
34        <th class="listheading">&nbsp;</th>
35        [%- FOREACH row = HEADER %]
36         <th nowrap class="listheading"><a href="[% HTML.escape(row.callback) %]">[% row.column_title %]</a></th>
37        [%- END %]
38       </tr>
39
40       [%- FOREACH row = COVS %]
41        <tr class="listrow[% loop.count % 2 %]">
42         <td valign="top"><button type="button" onclick="cov_selected('[% loop.count %]')">Auswahl</button></td>
43         <td valign="top"><input type="hidden" id="id_[% loop.count %]" name="id_[% loop.count %]" value="[% HTML.escape(row.id) %]">
44          <input type="hidden" id="name_[% loop.count %]" name="name_[% loop.count %]" value="[% HTML.escape(row.name) %]">
45          <input type="hidden" id="customer_is_vendor_[% loop.count %]" name="customer_is_vendor_[% loop.count %]" value="[% HTML.escape(row.customer_is_vendor) %]">
46          [% HTML.escape(row.name) %]</td>
47         <td valign="top">[% HTML.escape(row.address) %]</td>
48         <td valign="top">[% HTML.escape(row.contact) %]</td>
49        </tr>
50       [% END %]
51      </table>
52
53     </td>
54    </tr>
55   </table>
56
57  </form>
58
59  <script type="text/javascript">
60   <!--
61       function cov_selected(selected) {
62         var name = document.getElementsByName("name_" + selected)[0].value
63         var id = document.getElementsByName("id_" + selected)[0].value
64         var customer_is_vendor = document.getElementsByName("customer_is_vendor_" + selected)[0].value
65         var cov_name = document.forms[0].input_name.value;
66         window.opener.document.getElementsByName(cov_name)[0].value = name;
67         if (document.forms[0].input_id.value != "") {
68           window.opener.document.getElementsByName(document.forms[0].input_id.value)[0].value = id;
69         }
70
71         var cov_is_vendor = cov_name + "_is_vendor";
72         var input = window.opener.document.getElementsByName(cov_is_vendor)[0];
73         if (input) {
74           input.value = customer_is_vendor;
75         }
76
77         var prefix = "";
78         if (cov_name.substr(0, 2) == "f_") {
79           prefix = "f_";
80           cov_name = cov_name.substr(2);
81         }
82         cov_name = prefix + "old_" + cov_name;
83         var input = window.opener.document.getElementsByName(cov_name)[0];
84         if (input) {
85           input.value = name;
86         }
87         cov_name = prefix + "old" + cov_name;
88         input = window.opener.document.getElementsByName(cov_name)[0];
89         if (input) {
90           input.value = name;
91         }
92
93         if (document.forms[0].action_on_cov_selected.value != "") {
94           window.opener.document.getElementsByName("action")[0].value = document.forms[0].action_on_cov_selected.value;
95           window.opener.document.forms[0].submit();
96         }
97
98         self.close();
99       }
100       //-->
101  </script>
102
103 </body>