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.
 
 
 
 
 

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