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.

214 lines
7.3 KiB

  1. ::use 'contractadmin/design.mtt'::
  2. <h3>::_("Orders")::</h3>
  3. ::if distribution!=null::
  4. ::_("Delivery of the"):: <b>::hDate(distribution.date)::</b>
  5. ::end::
  6. <div id="orderBox"></div><!-- for react -->
  7. <div style="margin:8px 0;">
  8. ::if distribution!=null::
  9. <a href="/contractAdmin/edit/::c.id::?d=::distribution.id::" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-plus-sign"></span> ::_("New order")::</a>
  10. ::else::
  11. <a href="/contractAdmin/edit/::c.id::" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-plus-sign"></span> ::_("New order")::</a>
  12. ::end::
  13. ::if distribution!=null::
  14. $$export(/contractAdmin/orders/::c.id::?csv=1&d=::distribution.id::)
  15. <a href="/contractAdmin/ordersByProduct/::c.id::?d=::distribution.id::" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-list"></span>
  16. ::_("Summary by products")::
  17. </a>
  18. <div class="dropdown" style="display:inline-block;">
  19. <button class="btn btn-default btn-sm dropdown-toggle btn-noAntiDoubleClick" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  20. <span class="glyphicon glyphicon-print"></span> ::_("Attendance sheet")::
  21. </button>
  22. <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
  23. <li><a href="/distribution/list/::distribution.id::"> ::_("Standard")::</a></li>
  24. <li><a href="/distribution/listByProductUser/::distribution.id::"> ::_("By Product-User")::</a></li>
  25. </ul>
  26. </div>
  27. ::else::
  28. $$export(/contractAdmin/orders/::c.id::?csv=1)
  29. <a href="/contractAdmin/ordersByProduct/::c.id::" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-list"></span>
  30. ::_("Summary by products")::</a>
  31. ::end::
  32. </div>
  33. ::if disabledProducts > 0::
  34. $$alert( ::raw __("Be careful, there are <b>::disabledProducts::</b> order(s) containing <b>disabled products</b>.",{disabledProducts:disabledProducts}):: )
  35. ::end::
  36. <style>
  37. td.userRow{
  38. font-size:120%;
  39. color:#e7e7e7;
  40. }
  41. td.userRow a{ color:white; }
  42. </style>
  43. ::set total = 0::
  44. ::set totalAdh = 0::
  45. <table class="table table-bordered table-hover table-condensed" style="width:100%;">
  46. ::set name = ""::
  47. ::set name2 = ""::
  48. ::foreach m orders::
  49. ::if m.userName != name || m.userName2 != name2::
  50. <tr style="background-color:#666;">
  51. <td colspan="7" style="font-size:120%;color:#e7e7e7;">
  52. ::if distribution!=null::
  53. ::set basket = getBasket(m.userId,distribution._place.id,distribution.date)::
  54. <div class="basketNumber" ::cond basket!=null:: >
  55. <i class="fa fa-shopping-basket" aria-hidden="true"></i> N°::basket.num::
  56. </div>
  57. ::end::
  58. ::m.userName::
  59. ::if m.userName2!=null::
  60. <span class="glyphicon glyphicon-refresh"></span> ::_("alternated with"):: ::m.userName2::
  61. ::end::
  62. ::set name = m.userName ::
  63. ::set name2 = m.userName2 ::
  64. ::set totalAdh = totalAdh+1::
  65. </td>
  66. <td>
  67. <!--
  68. ::if distribution!=null::
  69. <a href="/contractAdmin/edit/::c.id::/::m.userId::?d=::distribution.id::" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-edit"></span>
  70. ::_("Edit")::</a>
  71. ::else::
  72. <a href="/contractAdmin/edit/::c.id::/::m.userId::" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-edit"></span>
  73. ::_("Edit")::</a>
  74. ::end::
  75. -->
  76. ::if distribution!=null::
  77. <a class="btn btn-default btn-xs"
  78. onclick="_.initOrderBox(::m.userId::,::distribution.id::,::distribution._contract.id::,::distribution._contract.type::,'::escapeJS(hDate(distribution.date))::','::escapeJS(distribution._place.toString())::','::escapeJS(m.userName)::','::user.getAmap().currency::',::user.getAmap().hasPayments()::,'/contractAdmin/orders/::c.id::?d=::distribution.id::')">
  79. <span class="glyphicon glyphicon-edit"></span>
  80. ::_("Edit")::
  81. </a>
  82. ::else::
  83. <a class="btn btn-default btn-xs"
  84. onclick="_.initOrderBox(::m.userId::, null, ::c.id::,::c.type::, null, null, '::escapeJS(m.userName)::','::user.getAmap().currency::',::user.getAmap().hasPayments()::,'/contractAdmin/orders/::c.id::')">
  85. <span class="glyphicon glyphicon-edit"></span>
  86. ::_("Edit")::
  87. </a>
  88. ::end::
  89. </td>
  90. </tr>
  91. <tr>
  92. <th>::_("Prod. ID")::</th>
  93. <th>::_("Qty")::</th>
  94. <th>::_("Product")::</th>
  95. <th><a href="#" data-toggle="tooltip" data-placement="top" title="::_("Unit price including taxes")::">::_("U.P||price per unit")::</a></th>
  96. <th>::_("Sub-total")::</th>
  97. <th>::_("Fees")::</th>
  98. <th>::_("Total")::</th>
  99. <th>::_("Paid")::</th>
  100. </tr>
  101. ::end::
  102. ::if m.disabled==true::
  103. ::set class="danger"::
  104. ::else::
  105. ::set class=""::
  106. ::end::
  107. <tr class="::class::">
  108. <td class="ref">
  109. $$nullSafe(::m.productRef::)
  110. </td>
  111. <td>
  112. ::if(m.quantity==0 && m.canceled)::
  113. <span style="color:#AAA">::_("Canceled")::</span>
  114. ::else::
  115. ::raw m.smartQt::
  116. ::end::
  117. </td>
  118. <td>
  119. ::m.productName::
  120. </td>
  121. <td>
  122. ::formatNum(m.productPrice)::&nbsp;::currency()::
  123. </td>
  124. <td>
  125. ::formatNum(m.subTotal)::&nbsp;::currency()::
  126. </td>
  127. <td>
  128. <!-- frais -->
  129. ::if m.percentageValue!=null::
  130. <a href="#" data-toggle="tooltip" data-placement="top" title="::m.percentageName:: : ::m.percentageValue:: %">
  131. ::formatNum(m.fees)::&nbsp;::currency()::
  132. </a>
  133. ::end::
  134. </td>
  135. <td>
  136. <!-- total -->
  137. ::formatNum(m.total)::&nbsp;::currency()::
  138. ::set total = total + m.total::
  139. </td>
  140. <td>
  141. ::if !m.canceled && m.quantity!=0::
  142. ::if m.paid==true::
  143. <span style="color:#00AA00;">::_("Paid")::</span>
  144. ::else::
  145. <span style="color:#DD0000;">::_("Not paid")::</span>
  146. ::end::
  147. ::end::
  148. ::if(m.quantity==0)::
  149. &nbsp;&nbsp;&nbsp;&nbsp;
  150. ::if distribution==null::
  151. <a href="/contractAdmin/orders/::c.id::?delete=::m.id::&token=::token::" $$confirm(::__("Do you really want to delete this order row for the product \"::productName::\" ?",{productName:m.productName})::) class="btn btn-danger btn-xs" >
  152. <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
  153. ::_("Delete")::
  154. </a>
  155. ::else::
  156. <a href="/contractAdmin/orders/::c.id::?d=::distribution.id::&delete=::m.id::&token=::token::" $$confirm(::__("Do you really want to delete this order row for the product \"::productName::\" ?",{productName:m.productName})::) class="btn btn-danger btn-xs" >
  157. <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
  158. ::_("Delete")::
  159. </a>
  160. ::end::
  161. ::end::
  162. </td>
  163. </tr>
  164. ::end::
  165. <tr style="background:#DDD;">
  166. <th colspan="6">::_("Total")::</th>
  167. <th>::formatNum(total)::&nbsp;::currency()::</th>
  168. <th></th>
  169. </tr>
  170. </table>
  171. <div style="margin-top:18px;margin-bottom:18px;">
  172. ::raw __("<b>::totalAdh::</b> member(s) in this distribution.",{totalAdh:totalAdh})::
  173. </div>
  174. ::end::