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.

353 lines
11 KiB

  1. ::use 'design.mtt'::
  2. ::if user==null::
  3. <div style="margin-top:12px;"></div>
  4. ::end::
  5. <div id="content" class="col-md-8">
  6. <!-- Welcoming message + access to tutos-->
  7. ::if newGroup::
  8. <div class="alert alert-success">
  9. <h3>::_("Welcome to Cagette.net !")::</h3>
  10. <p>
  11. ::raw _("Congratulations, you just created a new group !<br/>As an example, we created a fake farmer and fake products.<br/>It will show you how things work together in Cagette.net.<br/>Of course, you'll be able to delete them.")::
  12. </p>
  13. <hr/>
  14. <p>
  15. ::raw _("As a starter, we recommand you to follow the <b>guided tour</b> to discover step by step the main sections of the software.")::
  16. </p>
  17. <p>
  18. <a href="/contract/?startTuto=intro" class="btn btn-primary"><span class="glyphicon glyphicon-chevron-right"></span> ::_("Start the guided tour")::</a>
  19. </p>
  20. </div>
  21. ::end::
  22. <!-- standard mode order forms -->
  23. ::if !amap.hasShopMode()::
  24. <div class="homeBlock" ::cond ( openContracts!=null && openContracts.length>0 )::>
  25. <img src="/img/order.png" width="64" height="64" style="float:right;" />
  26. <h2>::_("Open orders")::</h2>
  27. <ul>
  28. ::foreach c openContracts::
  29. <li><a href="/contract/view/::c.id::">::c.name::</a></li>
  30. ::end::
  31. </ul>
  32. </div>
  33. ::end::
  34. <!-- empty planning -->
  35. ::if distribs==null || count(distribs)==0::
  36. <div class="homeBlock">
  37. <!--Votre planning de livraison est vide pour l'instant.-->
  38. ::_("You delivery planning is currently empty||on homepage when there is no planned deliveries")::
  39. <br/>
  40. </div>
  41. ::else::
  42. ::foreach d distribs::
  43. ::if d.userHasOrders(user)::
  44. <!-- block with orders -->
  45. <div class="distrib">
  46. ::set place = d.getPlace()::
  47. ::set active = d.isActive()::
  48. ::set start = d.getDate()::
  49. ::set end = d.getEndDate()::
  50. ::set ordersStartDate = d.getOrdersStartDate()::
  51. ::set ordersEndDate = d.getOrdersEndDate()::
  52. <div class="header orders">
  53. <div class="dateBoxOffset">
  54. ::set s = getDate(start)::
  55. ::if isToday(start)::
  56. $$today(::s.dow::,::s.d::,::s.m::,::s.y::,::s.h::,null)
  57. ::else::
  58. $$date(::s.dow::,::s.d::,::s.m::,::s.y::,null)
  59. ::end::
  60. </div>
  61. <div class="pull-right text-right" ::cond amap.hasShopMode() && d.type==1 ::>
  62. ::if active::
  63. <a ::cond !amap.hasPayments():: href="/contract/editOrderByDate/::start.toString().substr(0,10)::" class="btn btn-default btn-sm">
  64. <span class="glyphicon glyphicon-edit"></span> ::_("Modify my order")::
  65. </a>
  66. <a href="/shop/::place.id::/::start.toString().substr(0,10)::" class="btn btn-default btn-sm">
  67. <span class="glyphicon glyphicon-plus"></span> ::_("Add products")::
  68. </a>
  69. ::elseif(ordersEndDate!=null)::
  70. <!--Fermeture des commandes :-->
  71. ::if Date.now().getTime() > ordersEndDate.getTime()::
  72. ::_("Order closed since"):: <br/>
  73. ::hDate(ordersEndDate)::
  74. ::else::
  75. ::_("Order will open on"):: <br/>
  76. ::hDate(ordersStartDate)::
  77. ::end::
  78. ::end::
  79. </div>
  80. <div class="info">
  81. $$place(::place::)
  82. </div>
  83. </div>
  84. <div class="myorder">::_("My ordered products"):: :</div>
  85. <div class="content orders">
  86. ::foreach dist d.distributions::
  87. ::set orders = prepare(dist.getUserOrders(user))::
  88. ::if orders.length>0::
  89. <h4>
  90. ::set s = getDate(dist.date) ::
  91. ::set e = getDate(dist.end)::
  92. <span style="color:#999;"><span class="glyphicon glyphicon-time"></span> ::s.h+":"+s.i:: - ::e.h+":"+e.i::</span>
  93. &nbsp;::_("Distribution"):: <a href="/contract/view/::dist._contract.id::">::dist._contract.name::</a>
  94. </h4>
  95. <div class="row">
  96. ::foreach c orders::
  97. <div class="col-xs-12 col-sm-6 col-lg-4" ::cond orders.length>0:: >
  98. <table>
  99. <tr>
  100. <td>
  101. <div style="background-image:url('::c.productImage::')" class="productImg" />
  102. </td>
  103. <td class="name">
  104. <span ::cond c.quantity >1:: ><b>::raw c.smartQt::</b></span>
  105. <span style="background-color: #B00;color:white;padding: 2px;border-radius: 3px;margin-right:3px;" ::cond c.quantity ==0:: >
  106. ::_("Canceled")::
  107. </span>
  108. ::c.productName::
  109. ::if c.userId2!=null::
  110. ::if user.id==c.userId::
  111. ::set you = c.userName::
  112. ::set mate = c.userName2::
  113. ::else::
  114. ::set mate = c.userName::
  115. ::set you = c.userName2::
  116. ::end::
  117. <br/>(
  118. ::raw __("alternated with ::mate::",{mate:mate})::,
  119. ::if getWhosTurn(c.id,dist)==false::
  120. ::if c.userName == you::
  121. <span style="color:#080">::_("It's your turn")::</span>
  122. ::else::
  123. ::_("It's his/her turn")::
  124. ::end::
  125. ::else::
  126. ::if c.userName2 == you::
  127. <span style="color:#080">::_("It's your turn")::</span>
  128. ::else::
  129. ::_("It's his/her turn")::
  130. ::end::
  131. ::end::
  132. )
  133. ::end::
  134. </td>
  135. </tr>
  136. </table>
  137. </div>
  138. ::end::
  139. </div>
  140. <div class="footer">
  141. ::if user.isContractManager(dist._contract) || dist.distributor1Id==user.id || dist.distributor2Id==user.id || dist.distributor3Id==user.id || dist.distributor4Id==user.id::
  142. <a href="/distribution/list/::dist.id::"><span class="glyphicon glyphicon-print"></span> ::_("Distribution list")::</a>
  143. ::end::
  144. <span ::cond dist.distributor1Id!=null || dist.distributor2Id!=null || dist.distributor3Id!=null || dist.distributor4Id!=null::>
  145. &nbsp; <a href="#" onclick="$('#distributors::dist.id::').toggle();return false;"><span class="glyphicon glyphicon-user"></span> ::_("Permanence")::</a>
  146. </span>
  147. &nbsp; <a href="/contract/view/::dist._contract.id::"><span class="glyphicon glyphicon-list-alt"></span> ::_("Contract details")::</a>
  148. ::if !amap.hasShopMode() && dist._contract.type==1::
  149. &nbsp; <a href="/contract/order/::dist._contract.id::"><span class="glyphicon glyphicon-edit"></span> ::_("Modify my order")::</a>
  150. ::end::
  151. <div id="distributors::dist.id::" style="display:none;margin:8px;">
  152. <ul>
  153. <li ::cond dist.distributor1Id!=null::><i class="icon-user"></i> ::dist._distributor1.getCoupleName():: </li>
  154. <li ::cond dist.distributor2Id!=null::><i class="icon-user"></i> ::dist._distributor2.getCoupleName():: </li>
  155. <li ::cond dist.distributor3Id!=null::><i class="icon-user"></i> ::dist._distributor3.getCoupleName():: </li>
  156. <li ::cond dist.distributor4Id!=null::><i class="icon-user"></i> ::dist._distributor4.getCoupleName():: </li>
  157. </ul>
  158. </div>
  159. <div class="distribMessage" ::cond dist.distributor1Id==user.id || dist.distributor2Id==user.id ||dist.distributor3Id==user.id || dist.distributor4Id==user.id::>
  160. ::_("Warning, you're engaged in this distribution !")::
  161. </div>
  162. </div>
  163. ::end::
  164. ::end::
  165. <!-- extra html -->
  166. <div class="text-center">
  167. <!--::foreach i d.actions::
  168. <a href="::i.link::" class="btn btn-default btn-sm">
  169. <span ::cond i.icon:: class="glyphicon glyphicon-::i.icon::" ></span>
  170. ::i.name::
  171. </a>
  172. ::end::-->
  173. ::raw d.extraHtml::
  174. </div>
  175. </div>
  176. </div>
  177. ::elseif(amap.hasShopMode())::
  178. <!-- delivery open to orders (only for shopmode) -->
  179. <div class="distrib">
  180. ::set place = d.getPlace()::
  181. ::set active = d.isActive()::
  182. ::set start = d.getDate()::
  183. ::set end = d.getEndDate()::
  184. ::set ordersStartDate = d.getOrdersStartDate()::
  185. ::set ordersEndDate = d.getOrdersEndDate()::
  186. ::set class =""::
  187. ::if !active::
  188. ::set class="disabled"::
  189. ::end::
  190. <div class="header ::class::">
  191. <div class="text-right pull-right">
  192. ::if active==true::
  193. <a href="/shop/::place.id::/::start.toString().substr(0,10)::" class="btn btn-lg btn-primary">
  194. <span class="glyphicon glyphicon-chevron-right"></span>
  195. ::_("Order||Order button on homepage")::
  196. </a>
  197. <br/>
  198. ::elseif(ordersEndDate!=null)::
  199. <!--Fermeture des commandes :-->
  200. ::if Date.now().getTime() > ordersEndDate.getTime()::
  201. ::_("Order closed since"):: <br/>
  202. ::hDate(ordersEndDate)::
  203. ::else::
  204. ::_("Order will open on"):: <br/>
  205. ::hDate(ordersStartDate)::
  206. ::end::
  207. ::end::
  208. </div>
  209. <div class="dateBoxOffset">
  210. ::set s = getDate(start)::
  211. ::if isToday(start)::
  212. $$today(::s.dow::,::s.d::,::s.m::,::s.y::,::s.h::,null)
  213. ::else::
  214. $$date(::s.dow::,::s.d::,::s.m::,::s.y::,null)
  215. ::end::
  216. </div>
  217. <div class="info">
  218. ::set e = getDate(end)::
  219. <span class="glyphicon glyphicon-time"></span>
  220. ::set start = s.h+":"+s.i::
  221. ::set end = e.h+":"+e.i::
  222. ::__("Delivery from ::start:: to ::end::||Delivery from 18:00 to 19:30",{start:start,end:end})::
  223. <br/>
  224. $$place(::place::)
  225. </div>
  226. </div>
  227. <div class="content ::class::">
  228. <!-- products previews-->
  229. ::foreach p d.getProductsExcerpt()::
  230. <div data-toggle="tooltip" data-placement="top" title="::p.name::" style="background-image:url('::p.image::')" class="productImg"/>
  231. ::end::
  232. <!-- extra html -->
  233. <div class="text-center">
  234. ::raw d.extraHtml::
  235. </div>
  236. </div>
  237. </div>
  238. ::end::
  239. ::end::
  240. ::end::
  241. </div>
  242. <!-- RIGHT COLUMN -->
  243. <div class="col-md-4">
  244. <div class="block" >
  245. ::if amap._image!=null::
  246. ::if amap.extUrl!=null && amap.extUrl!=""::
  247. <a href="::amap.extUrl::"><img src="::file(amap._image)::" style="margin:auto;display: block;width: 100%;" class="thumbnail" /><br/></a>
  248. ::else::
  249. <img src="::file(amap._image)::" style="margin:auto;display: block;width: 100%;" class="thumbnail" /><br/>
  250. ::end::
  251. ::end::
  252. ::if amap.txtHome!=null && amap.txtHome!=""::
  253. ::raw nl2br(amap.txtHome)::
  254. ::end::
  255. </div>
  256. <div class="block" ::cond contractsWithDistributors.length>0 ::>
  257. <h3>::_("Permanences")::</h3>
  258. <p>::_("Don't forget to register for permanences")::</p>
  259. <ul>
  260. ::foreach c contractsWithDistributors::
  261. <li><a href="/distribution/planning/::c.id::">::c.name::</a></li>
  262. ::end::
  263. </ul>
  264. </div>
  265. <div class="alert alert-danger" ::cond user!=null && !user.isFullyRegistred()::>
  266. <p>
  267. ::_("Warning, you don't have defined a password yet !")::
  268. </p>
  269. <a href="/user/definePassword" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-chevron-right"></span> ::_("Set my password")::</a>
  270. </div>
  271. <!-- additionnal blocks from plugins -->
  272. ::if blocks!=null::
  273. ::foreach b blocks::
  274. <div class="block">
  275. <h3>::b.title::</h3>
  276. <p>::raw b.html::</p>
  277. </div>
  278. ::end::
  279. ::end::
  280. </div>
  281. ::end::