You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

147 lines
4.4 KiB

  1. ::use 'contractadmin/design.mtt'::
  2. ::if u==null::
  3. <h3>::_("Key-in an order")::</h3>
  4. ::else::
  5. <h3>::_("Key-in an order for"):: ::u.getCoupleName()::</h3>
  6. ::end::
  7. ::if distribution!=null::
  8. <p>::_("For the delivery of the"):: <b>::hDate(distribution.date)::</b></p>
  9. ::end::
  10. <form name="order" id="order" method="POST" action="" class="form-horizontal">
  11. <input type="hidden" name="token" value="::token::"/>
  12. ::if distribution!=null::
  13. <input type="hidden" name="distribution" value="::distribution.id::" />
  14. ::end::
  15. ::if u==null ::
  16. <div class="form-group">
  17. <label for="user" class="control-label col-md-2 text-left">::_("Member:")::</label>
  18. <div class="col-md-10">
  19. <select name="user" id="user" class="form-control">
  20. ::foreach uu users::
  21. <option value="::uu.value::">::uu.label::</option>
  22. ::end::
  23. </select>
  24. </div>
  25. </div>
  26. ::end::
  27. <br/>
  28. <table class="table table-bordered">
  29. <tr>
  30. <th></th>
  31. <th>::_("Product")::</th>
  32. <th>::_("Price")::</th>
  33. <th>::_("Quantity")::</th>
  34. <th ::cond !user._amap.hasPayments()::>::_("Status")::</th>
  35. ::if distribution==null::<th>::_("Alternately with :")::</th>::end::
  36. </tr>
  37. ::set total = 0::
  38. ::foreach uo userOrders::
  39. <tr>
  40. <td>
  41. ::if uo.product.active==false::
  42. <img src="::uo.product.getImage()::" style="width:32px;height:32px;opacity:0.3;" />
  43. ::else::
  44. <img src="::uo.product.getImage()::" style="width:32px;height:32px;" />
  45. ::end::
  46. </td>
  47. <td>
  48. ::if uo.product.active==false::
  49. <span style="color:#AAA;">::uo.product.getName():: ::_("(inactive)")::</span>
  50. ::else::
  51. ::uo.product.getName()::
  52. ::end::
  53. </td>
  54. <td>
  55. ::formatNum(uo.product.price)::&nbsp;::currency()::
  56. </td>
  57. <td>
  58. ::if uo.order==null::
  59. ::set q = 0::
  60. ::else::
  61. ::set q = uo.order.quantity::
  62. ::end::
  63. ::set total = total+(q*uo.product.price)::
  64. <input type="text" class="form-control input-sm" name="product::uo.product.id::" id="product::uo.product.id::" value="::q::" />
  65. </td>
  66. <!-- "paid" checkbox only if payments are not enabled -->
  67. <td class="paid" ::cond !user._amap.hasPayments()::>
  68. ::_("Paid:")::
  69. ::if uo.order!=null::
  70. <input type="checkbox" name="paid::uo.product.id::" value="1" ::attr checked (uo.order.paid==true ):: />
  71. ::else::
  72. <input type="checkbox" name="paid::uo.product.id::" value="1" />
  73. ::end::
  74. </td>
  75. <td ::cond distribution==null::>
  76. <select name="user2::uo.product.id::" class="form-control input-sm" style="width:150px;display:inline-block;">
  77. <option value="0">-</option>
  78. ::foreach uu users::
  79. <option value="::uu.value::" ::attr selected (uo.order!=null && uo.order._user2!=null && uo.order._user2.id==uu.value)::>::uu.label::</option>
  80. ::end::
  81. </select>
  82. <input data-toggle="tooltip" title="::_("Reverse the alternation")::" type="checkbox" name="invert::uo.product.id::" value="1" ::attr checked (uo.order!=null && uo.order.hasInvertSharedOrder()==true ):: />
  83. </td>
  84. </tr>
  85. ::end::
  86. ::set extra = 0::
  87. ::if c.hasPercentageOnOrders()::
  88. <tr>
  89. <th></th>
  90. <th>::_("Total order")::</th>
  91. <th>::total::::currency()::</th>
  92. <th></th>
  93. <th></th>
  94. </tr>
  95. <tr>
  96. <th></th>
  97. <td>::c.percentageName:: (::c.percentageValue::%)</td>
  98. ::set extra = total*(c.percentageValue/100)::
  99. <td>::extra::::currency()::</td>
  100. <th></th>
  101. <th></th>
  102. </tr>
  103. ::end::
  104. <tr>
  105. <th></th>
  106. <th>::_("Total")::</th>
  107. <th>::total+extra::::currency()::</th>
  108. <th></th>
  109. <th ::cond !user._amap.hasPayments()::>
  110. <a href="#" id="checkButton">::_("Check all")::</a>
  111. <script language="javascript">
  112. var globalCheck = true;
  113. var checkEverything = function(e){
  114. var boxes = $("td.paid :checkbox");
  115. boxes.attr("checked",globalCheck);
  116. globalCheck=!globalCheck;
  117. e.preventDefault();
  118. };
  119. $("#checkButton").click(checkEverything);
  120. </script>
  121. </th>
  122. </tr>
  123. </table>
  124. <input type="submit" class="btn btn-primary" value="::_("Validate the order")::" name="submit" id="submit" />
  125. </form>
  126. ::end::