Le repo des sources pour le site web des JM2L
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.
 
 
 
 
 

313 lines
14 KiB

  1. <%namespace name="h" file="jm2l:templates/helpers.mako"/>
  2. <%namespace name="tables" file="jm2l:templates/Logistique/Tables.mako"/>
  3. ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  4. <%def name="Main(Exchanges, miam_form)">
  5. <%
  6. DicExch = Exchanges.get_overview( request.user.uid )
  7. %>
  8. <div class="tabbable tabs-left" id="Intendance_tab">
  9. <ul class="nav nav-tabs navbar" style="margin-bottom:0;background-color: #f7f7f7;">
  10. <li class="active"> <a href="#ResumeInt" data-toggle="tab">Resum&eacute;</a> </li>
  11. <li> <a href="#Miam" data-toggle="tab">Miam</a> </li>
  12. <li> <a href="#Covoiturage" data-toggle="tab"><i class="icon-road"></i> Covoiturage</a> </li>
  13. <li> <a href="#Hebergement" data-toggle="tab"><i class="icon-home"></i> H&eacute;bergement</a> </li>
  14. <li> <a href="#Materiel" data-toggle="tab"><i class="icon-shopping-cart"></i> Mat&eacute;riel</a> </li>
  15. </ul>
  16. <div class="tab-content">
  17. <div class="tab-pane fade active in" id="ResumeInt">${Route_wrapper(DicExch)}</div>
  18. <div class="tab-pane fade" id="Miam">${Miam_wrapper(miam_form)}</div>
  19. <div class="tab-pane fade" id="Covoiturage">${Exchange_wrapper('C', DicExch['C'])}</div>
  20. <div class="tab-pane fade" id="Hebergement">${Exchange_wrapper('H', DicExch['H'])}</div>
  21. <div class="tab-pane fade" id="Materiel">${Exchange_wrapper('M', DicExch['M'])}</div>
  22. </div>
  23. </div>
  24. </%def>
  25. ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  26. <%def name="Exchange_wrapper(Type, DicExch)">
  27. ${tables.DoTable(Type, 'Ask', DicExch)}
  28. ${tables.DoTable(Type, 'Proposal', DicExch)}
  29. <fieldset>
  30. <legend>Tous les échanges</legend>
  31. ${Missing(Type, DicExch['Missing'])}
  32. </fieldset>
  33. </%def>
  34. ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  35. <%def name="Miam_wrapper(miam_form)">
  36. <fieldset>
  37. <legend>Qu'est ce qu'on mange ?</legend>
  38. <%
  39. DicForm = {
  40. }
  41. %>
  42. ${h.DisplayForm(miam_form, DicForm)}
  43. </fieldset>
  44. </%def>
  45. ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  46. <%def name="Missing(Type, Selection)">
  47. <%
  48. if Type=='H':
  49. CurTitle = u"d'hébergement"
  50. CurIcon = "icon-home"
  51. elif Type=='C':
  52. CurTitle = "de co-voiturage"
  53. CurIcon = "icon-road"
  54. elif Type=='M':
  55. CurTitle = u"de prêt de matériel"
  56. CurIcon = "icon-shopping-cart"
  57. %>
  58. <table class="table table-striped table-bordered table-hover">
  59. <thead>
  60. <tr>
  61. <th colspan="5">
  62. Les échanges ${CurTitle}
  63. % if 0:
  64. <span style="float:right;">
  65. <a data-original-title="Afficher les demandes" data-toggle="tooltip" id="${Type}_Demande">
  66. <label class="checkbox inline">
  67. <input type="checkbox" id="Demandes">
  68. <i class="icon-comment"></i>
  69. </input>
  70. </label>
  71. </a>
  72. <a data-original-title="Afficher les propositions" data-toggle="tooltip" id="${Type}_Props">
  73. <label class="checkbox inline">
  74. <input type="checkbox" value="#">
  75. <i class="${CurIcon}"></i>
  76. </input>
  77. </label>
  78. </a>
  79. <span>
  80. % endif
  81. </th>
  82. </tr>
  83. <tr>
  84. <th style="width:1em;"></th>
  85. <th>Détails</th>
  86. <th style="width:1em;"></th>
  87. <tr>
  88. </thead>
  89. <tbody id="Missing${Type}Table">
  90. % if len(Selection)==0:
  91. <tr>
  92. <td colspan="5" style="text-align:center;">
  93. <i>Il n'y a aucun échange ${CurTitle} proposé actuellement...</i>
  94. </td>
  95. </tr>
  96. % else:
  97. % for item in Selection:
  98. <%
  99. if (item.provider_id and item.asker_id):
  100. continue
  101. %>
  102. <tr style="cursor:pointer;">
  103. % if item.exch_state=='Ask':
  104. <td style="vertical-align: middle;"><i class="${CurIcon}"></i></td>
  105. % elif item.exch_state=='Proposal':
  106. <td style="vertical-align: middle;"><i class="icon-comment"></i></td>
  107. % endif
  108. <td>
  109. <p style="text-align:center">
  110. %if item.asker and item.exch_state=='Ask':
  111. <a href="/user/${item.asker.slug}"> ${item.asker.prenom} ${item.asker.nom} </a> demande
  112. %elif item.provider and item.exch_state=='Proposal':
  113. <a href="/user/${item.provider.slug}"> ${item.provider.prenom} ${item.provider.nom} </a> offre
  114. % endif
  115. % if item.exch_type=="C":
  116. un co-voiturage le ${item.start_time.strftime('%a %d %b vers %Hh%M').decode('utf-8')}
  117. de <a href="javascript:DoGetLieu('/2015/modal/Place/${item.Itin.start.place_id}')">${item.Itin.start.display_name}</a>
  118. à <a href="javascript:DoGetLieu('/2015/modal/Place/${item.Itin.arrival.place_id}')">${item.Itin.arrival.display_name}</a>
  119. % elif item.exch_type=="M":
  120. % if item.Category:
  121. <i>${item.Category.exch_subtype}</i>
  122. % endif
  123. % if item.description:
  124. ${item.description[:30]}
  125. % endif
  126. de ${item.start_time.strftime('%a %d %b %Hh%M').decode('utf-8')}
  127. à ${item.end_time.strftime('%a %d %b %Hh%M').decode('utf-8')}
  128. % else:
  129. % if item.Category:
  130. <i>${item.Category.exch_subtype}</i>
  131. % endif
  132. % if item.description:
  133. ${item.description[:30]}
  134. % endif
  135. ${item.start_time.strftime('%a %d %b').decode('utf-8')} soir
  136. % endif
  137. </p>
  138. </td>
  139. <td style="vertical-align: middle;">
  140. % if item.provider_id==request.user.uid or item.asker_id==request.user.uid:
  141. <a class="btn btn-mini btn-primary" style="float:right"
  142. href="javascript:DoGet('/2015/modal/Show${Type}/${item.exch_id}')">
  143. <i class="icon-search icon-white"></i>
  144. </a>
  145. % elif (item.provider_id and item.asker_id):
  146. <a class="btn btn-mini btn-primary" style="float:right"
  147. href="javascript:DoGet('/2015/modal/Show${Type}/${item.exch_id}')">
  148. <i class="icon-search icon-white"></i>
  149. </a> <br/> <br/>
  150. ## <a id="Ask${Type}-${item.exch_id}"
  151. ## class="btn btn-mini btn-info" style="float:right"
  152. ## data-original-title="En attente"
  153. ## data-toggle="popover" data-placement="left"
  154. ## data-content="Déjà en attente d'une réponse."
  155. ## href="#Missing${Type}Table">
  156. ## <i class="icon-random icon-white"></i>
  157. ## </a>
  158. ## <script>$("#Ask${Type}-${item.exch_id}").popover();</script>
  159. % else:
  160. <a class="btn btn-mini btn-primary" style="float:right"
  161. href="javascript:DoGet('/2015/modal/Show${Type}/${item.exch_id}')">
  162. <i class="icon-search icon-white"></i>
  163. </a> <br/> <br/>
  164. ## <a class="btn btn-mini btn-primary" style="float:right"
  165. ## href="javascript:DoGet('/2015/exchange/Ask${Type}/${item.exch_id}/deal')">
  166. ## <i class="icon-random icon-white"></i>
  167. ## </a>
  168. % endif
  169. </td>
  170. </tr>
  171. % endfor
  172. % endif
  173. </tbody>
  174. </table>
  175. <%
  176. context._kwargs['postpone_js'].append( "$('#%s_Props').tooltip();" % Type )
  177. context._kwargs['postpone_js'].append( "$('#%s_Demande').tooltip();" % Type )
  178. %>
  179. ## <script>
  180. ## $('#${Type}_Props').tooltip()
  181. ## $('#${Type}_Demande').tooltip()
  182. ## </script>
  183. </%def>
  184. ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  185. <%def name="Route_wrapper(DicExch)">
  186. <%
  187. AskSelection = Exchanges.get_my_counters( int(request.user.uid) )
  188. AllSelection = Exchanges.get_counters()
  189. ListWrap = ["Co-voiturage",u"Hébergement","Matos"]
  190. %>
  191. <div class="accordion" id="AccordionCounter">
  192. <div class="accordion-group">
  193. <div class="accordion-heading">
  194. <a class="accordion-toggle" data-toggle="collapse" data-parent="#AccordionCounter" href="#collapseMe"> Mes compteurs </a>
  195. </div>
  196. <div id="collapseMe" class="accordion-body collapse in">
  197. <div class="accordion-inner">
  198. <table class="table table-striped table-bordered table-hover LogistiqueTable">
  199. <thead style="text-align:center">
  200. <tr>
  201. <th>Section</th>
  202. <th>Mes demandes</th>
  203. <th>Mes offres</th>
  204. <th>Accords</th>
  205. </tr>
  206. </thead>
  207. <tbody id="MyCounters">
  208. <tr>
  209. <td>Miam</td>
  210. <td>?</td>
  211. <td>-</td>
  212. <td>?</td>
  213. </tr>
  214. % for Wrap in ListWrap:
  215. <tr>
  216. <td>${Wrap | h}</td>
  217. <td>
  218. <span class="badge">
  219. ${len(DicExch[Wrap[0]]['Ask'])}
  220. </span>
  221. </td>
  222. <td>
  223. <span class="badge">
  224. ${len(DicExch[Wrap[0]]['Proposal'])}
  225. </span>
  226. </td>
  227. <td>
  228. <span class="badge">
  229. ${len(DicExch[Wrap[0]]['Agree'])}
  230. </span>
  231. </td>
  232. </tr>
  233. % endfor
  234. </tbody>
  235. </table>
  236. </div>
  237. </div>
  238. </div>
  239. <div class="accordion-group">
  240. <div class="accordion-heading">
  241. <a class="accordion-toggle" data-toggle="collapse" data-parent="#AccordionCounter" href="#collapseAll">Les compteur de l´évenement</a>
  242. </div>
  243. <div id="collapseAll" class="accordion-body collapse">
  244. <div class="accordion-inner">
  245. <table class="table table-striped table-bordered table-hover LogistiqueTable">
  246. <thead style="text-align:center">
  247. <tr>
  248. <th>Section</th>
  249. <th>Les demandes</th>
  250. <th>Les propositions</th>
  251. <th>Les Accords</th>
  252. </tr>
  253. </thead>
  254. <tbody id="AllCounters">
  255. <tr>
  256. <td>Miam</td>
  257. <td>?</td>
  258. <td>-</td>
  259. <td>?</td>
  260. </tr>
  261. % for Wrap in ListWrap:
  262. <tr>
  263. <td>${Wrap | h}</td>
  264. <td>
  265. <span class="badge">
  266. ${DicExch[Wrap[0]]['Counters']['AllAsk']}
  267. </span>
  268. </td>
  269. <td>
  270. <span class="badge">
  271. ${DicExch[Wrap[0]]['Counters']['AllProp']}
  272. </span>
  273. </td>
  274. <td>
  275. <span class="badge">
  276. ${DicExch[Wrap[0]]['Counters']['AllAgree']}
  277. </span>
  278. </td>
  279. </tr>
  280. % endfor
  281. </tbody>
  282. </table>
  283. </div>
  284. </div>
  285. </div>
  286. </div>
  287. <fieldset>
  288. <legend>Mon Badge</legend>
  289. </fieldset>
  290. </%def>
  291. ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  292. ## Handle the Javascript Refresh to live update Current Page
  293. ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  294. % if reload:
  295. <%
  296. DicExch = Exchanges.get_overview( request.user.uid )
  297. context._kwargs['postpone_js'] = []
  298. %>
  299. ${Route_wrapper(DicExch)}
  300. ${Exchange_wrapper(Type, DicExch[Type])}
  301. %endif