Le repo des sources pour le site web des JM2L
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

301 行
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. <script>
  171. $('#${Type}_Props').tooltip()
  172. $('#${Type}_Demande').tooltip()
  173. </script>
  174. </%def>
  175. ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  176. <%def name="Route_wrapper(DicExch)">
  177. <%
  178. AskSelection = Exchanges.get_my_counters( int(request.user.uid) )
  179. AllSelection = Exchanges.get_counters()
  180. ListWrap = ["Co-voiturage",u"Hébergement","Matos"]
  181. %>
  182. <div class="accordion" id="AccordionCounter">
  183. <div class="accordion-group">
  184. <div class="accordion-heading">
  185. <a class="accordion-toggle" data-toggle="collapse" data-parent="#AccordionCounter" href="#collapseMe"> Mes compteurs </a>
  186. </div>
  187. <div id="collapseMe" class="accordion-body collapse in">
  188. <div class="accordion-inner">
  189. <table width="100%" class="table table-striped table-bordered table-hover LogistiqueTable">
  190. <thead style="text-align:center">
  191. <tr>
  192. <th>Section</th>
  193. <th>Mes demandes</th>
  194. <th>Mes offres</th>
  195. <th>Accords</th>
  196. </tr>
  197. </thead>
  198. <tbody id="MyCounters">
  199. <tr>
  200. <td>Miam</td>
  201. <td>?</td>
  202. <td>-</td>
  203. <td>?</td>
  204. </tr>
  205. % for Wrap in ListWrap:
  206. <tr>
  207. <td>${Wrap | h}</td>
  208. <td>
  209. <span class="badge">
  210. ${len(DicExch[Wrap[0]]['Ask'])}
  211. </span>
  212. </td>
  213. <td>
  214. <span class="badge">
  215. ${len(DicExch[Wrap[0]]['Proposal'])}
  216. </span>
  217. </td>
  218. <td>
  219. <span class="badge">
  220. ${len(DicExch[Wrap[0]]['Agree'])}
  221. </span>
  222. </td>
  223. </tr>
  224. % endfor
  225. </tbody>
  226. </table>
  227. </div>
  228. </div>
  229. </div>
  230. <div class="accordion-group">
  231. <div class="accordion-heading">
  232. <a class="accordion-toggle" data-toggle="collapse" data-parent="#AccordionCounter" href="#collapseAll">Les compteur de l´évenement</a>
  233. </div>
  234. <div id="collapseAll" class="accordion-body collapse">
  235. <div class="accordion-inner">
  236. <table width="100%" class="table table-striped table-bordered table-hover LogistiqueTable">
  237. <thead style="text-align:center">
  238. <tr>
  239. <th>Section</th>
  240. <th>Les demandes</th>
  241. <th>Les propositions</th>
  242. <th>Les Accords</th>
  243. </tr>
  244. </thead>
  245. <tbody id="AllCounters">
  246. <tr>
  247. <td>Miam</td>
  248. <td>?</td>
  249. <td>-</td>
  250. <td>?</td>
  251. </tr>
  252. % for Wrap in ListWrap:
  253. <tr>
  254. <td>${Wrap | h}</td>
  255. <td>
  256. <span class="badge">
  257. ${DicExch[Wrap[0]]['Counters']['AllAsk']}
  258. </span>
  259. </td>
  260. <td>
  261. <span class="badge">
  262. ${DicExch[Wrap[0]]['Counters']['AllProp']}
  263. </span>
  264. </td>
  265. <td>
  266. <span class="badge">
  267. ${DicExch[Wrap[0]]['Counters']['AllAgree']}
  268. </span>
  269. </td>
  270. </tr>
  271. % endfor
  272. </tbody>
  273. </table>
  274. </div>
  275. </div>
  276. </div>
  277. </div>
  278. <fieldset>
  279. <legend>Mon Badge</legend>
  280. </fieldset>
  281. </%def>
  282. ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  283. ## Handle the Javascript Refresh to live update Current Page
  284. ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  285. % if reload:
  286. <% DicExch = Exchanges.get_overview( request.user.uid ) %>
  287. ${Route_wrapper(DicExch)}
  288. ${Exchange_wrapper(Type, DicExch[Type])}
  289. %endif