Templates werden nicht mehr explizit übersetzt: *_master in * umbenannt
[kivitendo-erp.git] / templates / webpages / generic / cov_selection.html
diff --git a/templates/webpages/generic/cov_selection.html b/templates/webpages/generic/cov_selection.html
new file mode 100644 (file)
index 0000000..f3cdbcd
--- /dev/null
@@ -0,0 +1,104 @@
+[%- USE T8 %]
+[%- USE HTML %]
+<body[% IF onload %] onload="[% onload %]"[% END %]>
+
+ <form method="post">
+
+  <input type="hidden" name="input_name" value="[% HTML.escape(input_name) %]">
+  <input type="hidden" name="input_id" value="[% HTML.escape(input_id) %]">
+  <input type="hidden" name="is_vendor" value="[% HTML.escape(is_vendor) %]">
+  <input type="hidden" name="allow_both" value="[% HTML.escape(allow_both) %]">
+  <input type="hidden" name="action_on_cov_selected" value="[% HTML.escape(action_on_cov_selected) %]">
+
+  <table width="100%">
+   <tr>
+    <th class="listtop">[% title %]</th>
+   </tr>
+   <tr height="5"></tr>
+
+   <tr>
+    <td>
+     [%- IF !is_vendor %]
+      [% 'Please select a customer from the list below.' | $T8 %]
+     [%- ELSE %]
+      [% 'Please select a vendor from the list below.' | $T8 %]
+     [%- END %]
+    </td>
+   </tr>
+
+   <tr>
+    <td>
+
+     <table>
+      <tr class="listheading">
+       <th class="listheading">&nbsp;</th>
+       [%- FOREACH row = HEADER %]
+        <th nowrap class="listheading"><a href="[% HTML.escape(row.callback) %]">[% row.column_title %]</a></th>
+       [%- END %]
+      </tr>
+
+      [%- FOREACH row = COVS %]
+       <tr class="listrow[% loop.count % 2 %]">
+        <td valign="top"><button type="button" onclick="cov_selected('[% loop.count %]')">Auswahl</button></td>
+        <td valign="top"><input type="hidden" id="id_[% loop.count %]" name="id_[% loop.count %]" value="[% HTML.escape(row.id) %]">
+         <input type="hidden" id="name_[% loop.count %]" name="name_[% loop.count %]" value="[% HTML.escape(row.name) %]">
+         <input type="hidden" id="customer_is_vendor_[% loop.count %]" name="customer_is_vendor_[% loop.count %]" value="[% HTML.escape(row.customer_is_vendor) %]">
+         [% HTML.escape(row.name) %]</td>
+        <td valign="top">[% HTML.escape(row.address) %]</td>
+        <td valign="top">[% HTML.escape(row.contact) %]</td>
+       </tr>
+      [% END %]
+     </table>
+
+    </td>
+   </tr>
+  </table>
+
+ </form>
+
+ <script type="text/javascript">
+  <!--
+      function cov_selected(selected) {
+        var name = document.getElementsByName("name_" + selected)[0].value
+        var id = document.getElementsByName("id_" + selected)[0].value
+        var customer_is_vendor = document.getElementsByName("customer_is_vendor_" + selected)[0].value
+        var cov_name = document.forms[0].input_name.value;
+        window.opener.document.getElementsByName(cov_name)[0].value = name;
+        if (document.forms[0].input_id.value != "") {
+          window.opener.document.getElementsByName(document.forms[0].input_id.value)[0].value = id;
+        }
+
+        var cov_is_vendor = cov_name + "_is_vendor";
+        var input = window.opener.document.getElementsByName(cov_is_vendor)[0];
+        if (input) {
+          input.value = customer_is_vendor;
+        }
+
+        var prefix = "";
+        if (cov_name.substr(0, 2) == "f_") {
+          prefix = "f_";
+          cov_name = cov_name.substr(2);
+        }
+        cov_name = prefix + "old_" + cov_name;
+        var input = window.opener.document.getElementsByName(cov_name)[0];
+        if (input) {
+          input.value = name;
+        }
+        cov_name = prefix + "old" + cov_name;
+        input = window.opener.document.getElementsByName(cov_name)[0];
+        if (input) {
+          input.value = name;
+        }
+
+        if (document.forms[0].action_on_cov_selected.value != "") {
+          window.opener.document.getElementsByName("action")[0].value = document.forms[0].action_on_cov_selected.value;
+          window.opener.document.forms[0].submit();
+        }
+
+        self.close();
+      }
+      //-->
+ </script>
+
+</body>
+</html>