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.
 
 
 
 
 

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