Verwaltung von Zahlungsbedingungen auf Drag & Drop mit AJAX und jQuery UI Sortable...
[kivitendo-erp.git] / templates / webpages / payment_term / list.html
index e26e07f..8563137 100644 (file)
@@ -1,4 +1,7 @@
 [% USE HTML %][% USE T8 %][% USE L %][% USE LxERP %]
+
+<script type="text/javascript" src="js/jquery-ui.js"></script>
+
 <body>
  <div class="listtop">[% FORM.title %]</div>
 
    </p>
 
   [%- ELSE %]
-   <table>
+   <table id="payment_term_list">
+    <thead>
     <tr class="listheading">
-     <th align="center"><img src="image/up.png"></th>
-     <th align="center"><img src="image/down.png"></th>
+     <th align="center"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></th>
      <th>[%- 'Description' | $T8 %]</th>
      <th>[%- 'Long Description' | $T8 %]</th>
      <th align="right">[%- 'Netto Terms' | $T8 %]</th>
      <th align="right">[%- 'Skonto Terms' | $T8 %]</th>
      <th align="right">[%- 'Skonto' | $T8 %]</th>
     </tr>
+    </thead>
 
+    <tbody>
     [%- FOREACH payment_term = PAYMENT_TERMS %]
-    <tr class="listrow[% loop.count % 2 %]">
-     <td align="center">
-      [%- UNLESS loop.first %]
-       <a href="[% SELF.url_for(action => 'move_up', id => payment_term.id) %]"><img src="image/up.png" border="0"></a>
-      [%- END %]
-     </td>
-     <td align="center">
-      [%- UNLESS loop.last %]
-       <a href="[% SELF.url_for(action => 'move_down', id => payment_term.id) %]"><img src="image/down.png" border="0"></a>
-      [%- END %]
-     </td>
+    <tr class="listrow[% loop.count % 2 %]" id="payment_term_id_[% payment_term.id %]">
+     <td align="center" class="dragdrop"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></td>
      <td>
       <a href="[% SELF.url_for(action => 'edit', id => payment_term.id) %]">
        [%- HTML.escape(payment_term.description) %]
@@ -45,6 +41,7 @@
      <td align="right">[%- HTML.escape(payment_term.percent_skonto_as_number) %] %</td>
     </tr>
     [%- END %]
+    </tbody>
    </table>
   [%- END %]
 
@@ -53,5 +50,7 @@
   </p>
  </form>
 
+ [% L.sortable_element('#payment_term_list tbody', url => 'controller.pl?action=PaymentTerm/reorder', with => 'payment_term_id') %]
+
 </body>
 </html>