diff options
author | tr4ck3ur <tr4ck3ur@style-python.fr> | 2015-02-13 02:29:37 +0100 |
---|---|---|
committer | tr4ck3ur <tr4ck3ur@style-python.fr> | 2015-02-13 02:29:37 +0100 |
commit | fa4a9859c57de6b7894ff4b84b75d242f2b796f5 (patch) | |
tree | c6ec352fdd634ca3e645cb2db897a127fcff299b /jm2l/templates/Logistique | |
download | jm2l-fa4a9859c57de6b7894ff4b84b75d242f2b796f5.tar.gz jm2l-fa4a9859c57de6b7894ff4b84b75d242f2b796f5.tar.bz2 jm2l-fa4a9859c57de6b7894ff4b84b75d242f2b796f5.tar.xz jm2l-fa4a9859c57de6b7894ff4b84b75d242f2b796f5.zip |
first drop
Diffstat (limited to 'jm2l/templates/Logistique')
-rw-r--r-- | jm2l/templates/Logistique/Dialog.mako | 150 | ||||
-rw-r--r-- | jm2l/templates/Logistique/Dialog_Covoit.mako | 131 | ||||
-rw-r--r-- | jm2l/templates/Logistique/Dialog_Heberg.mako | 51 | ||||
-rw-r--r-- | jm2l/templates/Logistique/Dialog_Matos.mako | 49 | ||||
-rw-r--r-- | jm2l/templates/Logistique/Logistique.mako | 300 | ||||
-rw-r--r-- | jm2l/templates/Logistique/Tables.mako | 123 |
6 files changed, 804 insertions, 0 deletions
diff --git a/jm2l/templates/Logistique/Dialog.mako b/jm2l/templates/Logistique/Dialog.mako new file mode 100644 index 0000000..ba2c864 --- /dev/null +++ b/jm2l/templates/Logistique/Dialog.mako @@ -0,0 +1,150 @@ +<%namespace name="dialogH" file="jm2l:templates/Logistique/Dialog_Heberg.mako"/> +<%namespace name="dialogC" file="jm2l:templates/Logistique/Dialog_Covoit.mako"/> +<%namespace name="dialogM" file="jm2l:templates/Logistique/Dialog_Matos.mako"/> +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +## Faire une Proposition +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +<%def name="AddProposal(Type, form)"> \ +<% +if Type=='H': + CurTitle = u"un hébergement" + CurIcon = "icon-home" +elif Type=='C': + CurTitle = "un co-voiturage" + CurIcon = "icon-road" +elif Type=='M': + CurTitle = u"un prêt de matériel" + CurIcon = "icon-shopping-cart" +%> \ + <!-- Modal --> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h3 id="AddProp${Type}ModalLabel"> Je propose ${CurTitle} !</h3> + </div> + <div class="modal-body"> + %if 'exch_id' in form._fields.keys(): + <form id="ModalForm" action="javascript:DoPost('/2015/modal/Prop${Type}/${form.exch_id.data}');"> + %else: + <form id="ModalForm" action="javascript:DoPost('/2015/modal/Prop${Type}/0');"> + %endif + <p>Je propose mes service pour ${CurTitle}</p> + % if Type=='H': + ${dialogH.Heberg_Proposal(form)} + % elif Type=='C': + ${dialogC.Covoit_Proposal(form)} + % elif Type=='M': + ${dialogM.Matos_Proposal(form)} + % endif + </form> + </div> + <div class="modal-footer"> + <button class="btn" data-dismiss="modal" aria-hidden="true">Fermer</button> + <button class="btn btn-primary" onclick="javascript:document.forms['ModalForm'].submit();"> + <i class="${CurIcon} icon-white"></i> Proposer !</button> + </div> +</%def> \ +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +## Faire une Demande +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +<%def name="AddAsk(Type, form)"> \ +<% +if Type=='H': + CurTitle = u"un hébergement" + CurIcon = "icon-home" +elif Type=='C': + CurTitle = "un co-voiturage" + CurIcon = "icon-road" +elif Type=='M': + CurTitle = u"un prêt de matériel" + CurIcon = "icon-shopping-cart" +%> + <!-- Modal --> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h3 id="AddAsk${Type}ModalLabel"> Je demande ${CurTitle} !</h3> + </div> + <div class="modal-body"> + % if 'exch_id' in form._fields.keys(): + <form id="ModalForm" action="javascript:DoPost('/2015/modal/Ask${Type}/${form.exch_id.data}');"> + % else: + <form id="ModalForm" action="javascript:DoPost('/2015/modal/Ask${Type}/0');"> + %endif + <p>Je demande ${CurTitle}</p> + % if Type=='H': + ${dialogH.Heberg_Ask(form)} + % elif Type=='C': + ${dialogC.Covoit_Ask(form)} + % elif Type=='M': + ${dialogM.Matos_Ask(form)} + % endif + </form> + </div> + <div class="modal-footer"> + <button class="btn" data-dismiss="modal" aria-hidden="true">Fermer</button> + <button class="btn btn-primary" onclick="javascript:document.forms['ModalForm'].submit();"> + <i class="${CurIcon} icon-white"></i> Demander !</button> + </div> +</%def> \ +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +## Afficher les détails +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +<%def name="Show(Type, Exch)"> \ +<% +if Exch.exch_type=='H': + CurTitle = u"de l'hébergement" + CurIcon = "icon-home" +elif Exch.exch_type=='C': + CurTitle = "du co-voiturage" + CurIcon = "icon-road" +elif Exch.exch_type=='M': + CurTitle = u"du prêt de matériel" + CurIcon = "icon-shopping-cart" +%> + <!-- Modal --> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <i class="${CurIcon}"></i> <strong>Détails ${CurTitle}</strong> + </div> + <div class="modal-body"> + % if Type=='H': + ${dialogH.ShowH(Exch)} + % elif Type=='C': + ${dialogC.ShowC(Exch)} + % elif Type=='M': + ${dialogM.ShowM(Exch)} + % endif + % if Exch.exch_state=='Ask': + <form id="ModalForm" action="javascript:DoPost('/2015/exchange/Ask${Type}/${Exch.exch_id}/deal');"></form> + % elif Exch.exch_state=='Proposal': + <form id="ModalForm" action="javascript:DoPost('/2015/exchange/Prop${Type}/${Exch.exch_id}/deal');"></form> + % endif + </div> + <div class="modal-footer"> + % if not Exch.exch_done and (Exch.asker_id is None or Exch.provider_id is None): + % if Exch.exch_state=='Proposal' and Exch.provider_id!=request.user.uid: + <button class="btn btn-info" data-dismiss="modal" aria-hidden="true" + onclick="javascript:document.forms['ModalForm'].submit();"> + % if Type=='H': + Je lui demande pour dormir chez lui/elle ! + % elif Type=='C': + Je lui demande de venir me chercher ! + % elif Type=='M': + Je lui demande de me prêter son matériel ! + % endif + </button> + % elif Exch.exch_state=='Ask' and Exch.asker_id!=request.user.uid: + <button class="btn btn-info" data-dismiss="modal" aria-hidden="true" + onclick="javascript:document.forms['ModalForm'].submit();"> + % if Type=='H': + Je propose de l'héberger ! + % elif Type=='C': + Je propose de venir le/la chercher ! + % elif Type=='M': + Je lui propose mon matériel ! + % endif + </button> + % endif + % endif + <button class="btn" data-dismiss="modal" aria-hidden="true">Fermer</button> + </div> +</%def> \ diff --git a/jm2l/templates/Logistique/Dialog_Covoit.mako b/jm2l/templates/Logistique/Dialog_Covoit.mako new file mode 100644 index 0000000..7e2bf9b --- /dev/null +++ b/jm2l/templates/Logistique/Dialog_Covoit.mako @@ -0,0 +1,131 @@ +<%namespace name="helper" file="jm2l:templates/helpers.mako"/> +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +## Détail de l'échange de Co-voiturage +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +<%def name="ShowC(Exch)"> \ + <div class="tabbable" id="itin_tab"> + <ul class="nav nav-tabs"> + <li class="active"><a href="#Place_Detail" data-toggle="tab">Détail</a></li> + <li><a href="#Place_Info" data-toggle="tab">Informations</a></li> +% if Exch.Itin.start.gps_coord and Exch.Itin.arrival.gps_coord: + <li><a href="#Place_Plan" id="ItinMap" data-toggle="tab">Carte</a></li> + <li><a href="#Place_Itin" data-toggle="tab">Itineraire</a></li> +% endif + </ul> + <div class="tab-content"> + <div class="tab-pane fade active in" id="Place_Detail"> + ${helper.show_exchange(Exch, Exch.asker, Exch.provider)} + <table class="table table-bordered table-striped" style="width: 100%"> + <thead> + <tr> + <th style="width:50%;text-align:center;">Au départ de</th> + <th style="width:50%;text-align:center;">À destination de</th> + </tr> + </thead> + <tbody> + <tr> + <td>${helper.show_address(Exch.Itin.start)}</td> + <td>${helper.show_address(Exch.Itin.arrival)}</td> + </tr> + </tbody> + </table> + <center> + Pour un co-voiturage le <u>${Exch.start_time.strftime("%a %d %b").decode('utf-8')}</u> + vers <strong>${Exch.start_time.strftime("%H:%M")}</strong> + </center> + Temps de voyage estimé à <span id="summary"></span> + </div> + <div class="tab-pane fade in" id="Place_Info"> + <table class="table table-bordered table-striped" style="width: 100%"> + <thead> + <tr> + <th>Départ</th> + <th>Arrivée</th> + </tr> + </thead> + <tbody> + <tr> + <td style="width:50%">${helper.show_desc(Exch.Itin.start)}</td> + <td style="width:50%">${helper.show_desc(Exch.Itin.arrival)}</td> + </tr> + </tbody> + </table> + </div> +% if Exch.Itin.start.gps_coord and Exch.Itin.arrival.gps_coord: + <div class="tab-pane fade in" id="Place_Plan"> + <div id="map"></div> + <script type="text/javascript"> + var map = L.map('map'); + // create the tile layer with correct attribution + var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; + var osmAttrib='Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors'; + var osm = new L.TileLayer(osmUrl, {minZoom: 8, maxZoom: 17, attribution: osmAttrib}); + map.addLayer(osm); + var toast = L.Routing.control({ + containerClassName: '#map_Itineraire', + show:false, + waypoints: [ + L.latLng(${Exch.Itin.start.gps_coord}), + L.latLng(${Exch.Itin.arrival.gps_coord}) + ] + }); + toast.addTo(map); + + </script> + </div> + <div class="tab-pane fade in" id="Place_Itin"> + <div id="map_Itineraire"></div> + </div> +% endif + + </div> + </div> +</%def> \ +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +## Proposition de Co-voiturage +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +<%def name="Covoit_Proposal(form)"> \ +<% ## PlaceHolder, ContainerStyle, FieldStyle + DicFormat = { + "Day_start" :{'ContainerStyle':'float:left;', 'FieldStyle':'width:7em;'}, + "Confidence" :{'ContainerStyle':'float:left;', 'FieldStyle':'width:16em;'}, + "Hour_start" :{'PlaceHolder':'10:00', 'FieldStyle':'width:4em;margin: 0 2px;'}, + "start_place":{'ContainerStyle':'float:left;','FieldStyle':'width:15em;'}, + "arrival_place":{'ContainerStyle':'float:left;','FieldStyle':'width:15em;'}, + } +%> + ${helper.DisplayForm(form, DicFormat)} + <div clear="both"><br><br><br></div> + <div style="padding: 20px;"> + <small style="color:#999">Si je n´ai pas trouvé le lieu dont j´ai besoin dans ces listes...</small> + <br /> + <small style="color:#999">Je peux </small> + <a class="btn btn-mini btn-info" role="button" href="javascript:DoGetLieu('/2015/modal/Place/0');"> + <i class="icon-plus-sign icon-white"></i> Ajouter un lieu + </a> + </div> + </%def> \ +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +## Demande de Co-voiturage +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +<%def name="Covoit_Ask(form)"> \ +<% ## PlaceHolder, ContainerStyle, FieldStyle + DicFormat = { + "Day_start" :{'ContainerStyle':'float:left;', 'FieldStyle':'width:7em;'}, + "Confidence" :{'ContainerStyle':'float:left;', 'FieldStyle':'width:16em;'}, + "Hour_start" :{'PlaceHolder':'10:00', 'FieldStyle':'width:4em;margin: 0 2px;'}, + "start_place":{'ContainerStyle':'float:left;','FieldStyle':'width:15em;'}, + "arrival_place":{'ContainerStyle':'float:left;','FieldStyle':'width:15em;'}, + } +%> + ${helper.DisplayForm(form, DicFormat)} + <div clear="both"><br><br><br></div> + <div style="margin-top: 15px;"> + <small style="color:#999">Si je n´ai pas trouvé le lieu dont j´ai besoin dans ces listes...</small> + <br /> + <small style="color:#999">Je peux </small> + <a class="btn btn-mini btn-info" role="button" href="javascript:DoGetLieu('/2015/modal/Place/0');"> + <i class="icon-plus-sign icon-white"></i> Ajouter un lieu + </a> + </div> +</%def> \ diff --git a/jm2l/templates/Logistique/Dialog_Heberg.mako b/jm2l/templates/Logistique/Dialog_Heberg.mako new file mode 100644 index 0000000..75f6ce3 --- /dev/null +++ b/jm2l/templates/Logistique/Dialog_Heberg.mako @@ -0,0 +1,51 @@ +<%namespace name="helper" file="jm2l:templates/helpers.mako"/> +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +## Détail de l'échange d'hébergement +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +<%def name="ShowH(Exch)"> \ + ${helper.show_exchange(Exch, Exch.asker, Exch.provider)} + <dl> + <dt>Quoi</dt> + % if Exch.Category: + <dd>${Exch.Category.exch_subtype}</dd> + % else: + <dd>Un hébergement</dd> + % endif + <dt>Quand </dt> + <dd>La nuit du ${Exch.start_time.strftime('%A %d %b %Y').decode('utf-8')} jusqu'au lendemain</dd> + % if Exch.description: + <dt>Détails </dt> + <dd>${Exch.description}</dd> + % endif + </dl> +</%def> \ +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +## Proposition d'hébergement +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +<%def name="Heberg_Proposal(form)"> \ +<% ## PlaceHolder, ContainerStyle, FieldStyle + DicFormat = { + "Day_start" :{'ContainerStyle':'float:left;', 'FieldStyle':'width:13em;'}, + "exch_categ" :{'FieldStyle':'width:18em;'}, + "description":{'FieldStyle':'width:85%;'} + } +%> + ${helper.DisplayForm(form, DicFormat)} + NB: Vous devez faire une proposition différente pour chaque nuit que vous proposez. + <br> + <a class="btn btn-mini btn-info" role="button" href="javascript:DoGetLieu('/2015/modal/Place/0');"> + <i class="icon-plus-sign icon-white"></i> Indiquer l'adresse proposée. + </a> +</%def> \ +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +## Demande d'hébergement +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +<%def name="Heberg_Ask(form)"> \ +<% ## PlaceHolder, ContainerStyle, FieldStyle + DicFormat = { + "description":{'FieldStyle':'width:85%;'} + } +%> + ${helper.DisplayForm(form, DicFormat)} + NB: Vous devez faire une demande différente pour chaque nuit d'hébergement demandée. +</%def> \ diff --git a/jm2l/templates/Logistique/Dialog_Matos.mako b/jm2l/templates/Logistique/Dialog_Matos.mako new file mode 100644 index 0000000..4f2085c --- /dev/null +++ b/jm2l/templates/Logistique/Dialog_Matos.mako @@ -0,0 +1,49 @@ +<%namespace name="helper" file="jm2l:templates/helpers.mako"/> +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +## Détail de l'échange matériel +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +<%def name="ShowM(Exch)"> \ + ${helper.show_exchange(Exch, Exch.asker, Exch.provider)} + <dl> + <dt>Catégorie</dt> + <dd>${Exch.Category.exch_subtype}</dd> + <dt>Quand </dt> + <dd>de ${Exch.start_time.strftime('%A %d %b %Y').decode('utf-8')} vers ${Exch.start_time.strftime('%Hh%M')} + à ${Exch.end_time.strftime('%A %d %b %Y').decode('utf-8')} vers ${Exch.end_time.strftime('%Hh%M')} + </dd> + <dt>Détails </dt> + <dd>${Exch.description}</dd> + </dl> +</%def> \ +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +## Proposition de matériel +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +<%def name="Matos_Proposal(form)"> \ +<% ## PlaceHolder, ContainerStyle, FieldStyle + DicFormat = { + "Day_start" :{'ContainerStyle':'float:left;', 'FieldStyle':'width:8em;'}, + "Hour_start" :{'ContainerStyle':'float:left;width:8em;', 'PlaceHolder':'10:00', 'FieldStyle':'width:4em;margin: 0 2px;'}, + "Day_end" :{'ContainerStyle':'float:left;', 'FieldStyle':'width:8em;'}, + "Hour_end" :{'PlaceHolder':'19:00', 'FieldStyle':'width:4em;margin: 0 2px;'}, + "description":{'FieldStyle':'width:85%;'}, + "exch_categ":{'FieldStyle':'width:10em;'} + } +%> + ${helper.DisplayForm(form, DicFormat)} +</%def> \ +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +## Demande de matériel +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +<%def name="Matos_Ask(form)"> \ +<% ## PlaceHolder, ContainerStyle, FieldStyle + DicFormat = { + "Day_start" :{'ContainerStyle':'float:left;', 'FieldStyle':'width:8em;'}, + "Hour_start" :{'ContainerStyle':'float:left;width:8em;', 'PlaceHolder':'10:00', 'FieldStyle':'width:4em;margin: 0 2px;'}, + "Day_end" :{'ContainerStyle':'float:left;', 'FieldStyle':'width:8em;'}, + "Hour_end" :{'PlaceHolder':'19:00', 'FieldStyle':'width:4em;margin: 0 2px;'}, + "description":{'FieldStyle':'width:85%;'}, + "exch_categ":{'FieldStyle':'width:10em;'} + } +%> + ${helper.DisplayForm(form, DicFormat)} +</%def> \ diff --git a/jm2l/templates/Logistique/Logistique.mako b/jm2l/templates/Logistique/Logistique.mako new file mode 100644 index 0000000..2037973 --- /dev/null +++ b/jm2l/templates/Logistique/Logistique.mako @@ -0,0 +1,300 @@ +<%namespace name="h" file="jm2l:templates/helpers.mako"/> +<%namespace name="tables" file="jm2l:templates/Logistique/Tables.mako"/> +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +<%def name="Main(Exchanges)"> +<% +DicExch = Exchanges.get_overview( request.user.uid ) +%> + <div class="tabbable tabs-left" id="Intendance_tab"> + + <ul class="nav nav-tabs navbar" style="margin-bottom:0;background-color: #f7f7f7;"> + <li class="active"> <a href="#ResumeInt" data-toggle="tab">Resumé</a> </li> + <li> <a href="#Miam" data-toggle="tab">Miam</a> </li> + <li> <a href="#Covoiturage" data-toggle="tab"><i class="icon-road"></i> Covoiturage</a> </li> + <li> <a href="#Hebergement" data-toggle="tab"><i class="icon-home"></i> Hébergement</a> </li> + <li> <a href="#Materiel" data-toggle="tab"><i class="icon-shopping-cart"></i> Matériel</a> </li> + </ul> + + <div class="tab-content"> + <div class="tab-pane fade active in" id="ResumeInt">${Route_wrapper(DicExch)}</div> + <div class="tab-pane fade" id="Miam">${Miam_wrapper()}</div> + <div class="tab-pane fade" id="Covoiturage">${Exchange_wrapper('C', DicExch['C'])}</div> + <div class="tab-pane fade" id="Hebergement">${Exchange_wrapper('H', DicExch['H'])}</div> + <div class="tab-pane fade" id="Materiel">${Exchange_wrapper('M', DicExch['M'])}</div> + </div> + + </div> +</%def> +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +<%def name="Exchange_wrapper(Type, DicExch)"> + ${tables.DoTable(Type, 'Ask', DicExch)} + ${tables.DoTable(Type, 'Proposal', DicExch)} + <fieldset> + <legend>Tous les échanges</legend> + ${Missing(Type, DicExch['Missing'])} + </fieldset> +</%def> +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +<%def name="Miam_wrapper()"> + <fieldset> + <legend>Qu'est ce qu'on mange ?</legend> + </fieldset> +</%def> +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +<%def name="Missing(Type, Selection)"> +<% +if Type=='H': + CurTitle = u"d'hébergement" + CurIcon = "icon-home" +elif Type=='C': + CurTitle = "de co-voiturage" + CurIcon = "icon-road" +elif Type=='M': + CurTitle = u"de prêt de matériel" + CurIcon = "icon-shopping-cart" +%> + <table class="table table-striped table-bordered table-hover"> + <thead> + <tr> + <th colspan="5"> + Les échanges ${CurTitle} + % if 0: + <span style="float:right;"> + <a data-original-title="Afficher les demandes" data-toggle="tooltip" id="${Type}_Demande"> + <label class="checkbox inline"> + <input type="checkbox" id="Demandes"> + <i class="icon-comment"></i> + </input> + </label> + </a> + <a data-original-title="Afficher les propositions" data-toggle="tooltip" id="${Type}_Props"> + <label class="checkbox inline"> + <input type="checkbox" value="#"> + <i class="${CurIcon}"></i> + </input> + </label> + </a> + <span> + % endif + </th> + </tr> + + <tr> + <th style="width:1em;"></th> + <th>Détails</th> + <th style="width:1em;"></th> + <tr> + </thead> + <tbody id="Missing${Type}Table"> + % if len(Selection)==0: + <tr> + <td colspan="5" style="text-align:center;"> + <i>Il n'y a aucun échange ${CurTitle} proposé actuellement...</i> + </td> + </tr> + % else: + % for item in Selection: + <% + if (item.provider_id and item.asker_id): + continue + %> + <tr style="cursor:pointer;"> + % if item.exch_state=='Ask': + <td style="vertical-align: middle;"><i class="${CurIcon}"></i></td> + % elif item.exch_state=='Proposal': + <td style="vertical-align: middle;"><i class="icon-comment"></i></td> + % endif + <td> + <p style="text-align:center"> + %if item.asker and item.exch_state=='Ask': + <a href="/user/${item.asker.slug}"> ${item.asker.prenom} ${item.asker.nom} </a> demande + %elif item.provider and item.exch_state=='Proposal': + <a href="/user/${item.provider.slug}"> ${item.provider.prenom} ${item.provider.nom} </a> offre + % endif + % if item.exch_type=="C": + un co-voiturage le ${item.start_time.strftime('%a %d %b vers %Hh%M').decode('utf-8')} + de <a href="javascript:DoGetLieu('/2015/modal/Place/${item.Itin.start.place_id}')">${item.Itin.start.display_name}</a> + à <a href="javascript:DoGetLieu('/2015/modal/Place/${item.Itin.arrival.place_id}')">${item.Itin.arrival.display_name}</a> + % elif item.exch_type=="M": + % if item.Category: + <i>${item.Category.exch_subtype}</i> + % endif + % if item.description: + ${item.description[:30]} + % endif + de ${item.start_time.strftime('%a %d %b %Hh%M').decode('utf-8')} + à ${item.end_time.strftime('%a %d %b %Hh%M').decode('utf-8')} + % else: + % if item.Category: + <i>${item.Category.exch_subtype}</i> + % endif + % if item.description: + ${item.description[:30]} + % endif + ${item.start_time.strftime('%a %d %b').decode('utf-8')} soir + % endif + </p> + </td> + <td style="vertical-align: middle;"> + % if item.provider_id==request.user.uid or item.asker_id==request.user.uid: + <a class="btn btn-mini btn-primary" style="float:right" + href="javascript:DoGet('/2015/modal/Show${Type}/${item.exch_id}')"> + <i class="icon-search icon-white"></i> + </a> + % elif (item.provider_id and item.asker_id): + <a class="btn btn-mini btn-primary" style="float:right" + href="javascript:DoGet('/2015/modal/Show${Type}/${item.exch_id}')"> + <i class="icon-search icon-white"></i> + </a> <br/> <br/> + ## <a id="Ask${Type}-${item.exch_id}" + ## class="btn btn-mini btn-info" style="float:right" + ## data-original-title="En attente" + ## data-toggle="popover" data-placement="left" + ## data-content="Déjà en attente d'une réponse." + ## href="#Missing${Type}Table"> + ## <i class="icon-random icon-white"></i> + ## </a> + ## <script>$("#Ask${Type}-${item.exch_id}").popover();</script> + % else: + <a class="btn btn-mini btn-primary" style="float:right" + href="javascript:DoGet('/2015/modal/Show${Type}/${item.exch_id}')"> + <i class="icon-search icon-white"></i> + </a> <br/> <br/> + ## <a class="btn btn-mini btn-primary" style="float:right" + ## href="javascript:DoGet('/2015/exchange/Ask${Type}/${item.exch_id}/deal')"> + ## <i class="icon-random icon-white"></i> + ## </a> + % endif + </td> + </tr> + % endfor + % endif + </tbody> + </table> + + <script> + $('#${Type}_Props').tooltip() + $('#${Type}_Demande').tooltip() + </script> + +</%def> +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +<%def name="Route_wrapper(DicExch)"> +<% +AskSelection = Exchanges.get_my_counters( int(request.user.uid) ) +AllSelection = Exchanges.get_counters() +ListWrap = ["Co-voiturage",u"Hébergement","Matos"] +%> +<div class="accordion" id="AccordionCounter"> + <div class="accordion-group"> + <div class="accordion-heading"> + <a class="accordion-toggle" data-toggle="collapse" data-parent="#AccordionCounter" href="#collapseMe"> Mes compteurs </a> + </div> + <div id="collapseMe" class="accordion-body collapse in"> + <div class="accordion-inner"> + + <table width="100%" class="table table-striped table-bordered table-hover LogistiqueTable"> + <thead style="text-align:center"> + <tr> + <th>Section</th> + <th>Mes demandes</th> + <th>Mes offres</th> + <th>Accords</th> + </tr> + </thead> + <tbody id="MyCounters"> + <tr> + <td>Miam</td> + <td>?</td> + <td>-</td> + <td>?</td> + </tr> + % for Wrap in ListWrap: + <tr> + <td>${Wrap | h}</td> + <td> + <span class="badge"> + ${len(DicExch[Wrap[0]]['Ask'])} + </span> + </td> + <td> + <span class="badge"> + ${len(DicExch[Wrap[0]]['Proposal'])} + </span> + </td> + <td> + <span class="badge"> + ${len(DicExch[Wrap[0]]['Agree'])} + </span> + </td> + </tr> + % endfor + </tbody> + </table> + + </div> + </div> + </div> + <div class="accordion-group"> + <div class="accordion-heading"> + <a class="accordion-toggle" data-toggle="collapse" data-parent="#AccordionCounter" href="#collapseAll">Les compteur de l´évenement</a> + </div> + <div id="collapseAll" class="accordion-body collapse"> + <div class="accordion-inner"> + + <table width="100%" class="table table-striped table-bordered table-hover LogistiqueTable"> + <thead style="text-align:center"> + <tr> + <th>Section</th> + <th>Les demandes</th> + <th>Les propositions</th> + <th>Les Accords</th> + </tr> + </thead> + <tbody id="AllCounters"> + <tr> + <td>Miam</td> + <td>?</td> + <td>-</td> + <td>?</td> + </tr> + % for Wrap in ListWrap: + <tr> + <td>${Wrap | h}</td> + <td> + <span class="badge"> + ${DicExch[Wrap[0]]['Counters']['AllAsk']} + </span> + </td> + <td> + <span class="badge"> + ${DicExch[Wrap[0]]['Counters']['AllProp']} + </span> + </td> + <td> + <span class="badge"> + ${DicExch[Wrap[0]]['Counters']['AllAgree']} + </span> + </td> + </tr> + % endfor + </tbody> + </table> + + </div> + </div> + </div> +</div> + + <fieldset> + <legend>Mon Badge</legend> + </fieldset> +</%def> +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +## Handle the Javascript Refresh to live update Current Page +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +% if reload: + <% DicExch = Exchanges.get_overview( request.user.uid ) %> + ${Route_wrapper(DicExch)} + ${Exchange_wrapper(Type, DicExch[Type])} +%endif diff --git a/jm2l/templates/Logistique/Tables.mako b/jm2l/templates/Logistique/Tables.mako new file mode 100644 index 0000000..c97ea83 --- /dev/null +++ b/jm2l/templates/Logistique/Tables.mako @@ -0,0 +1,123 @@ +<%def name="DoTable(Type, Kind, Selection)"> +<% +if Kind=='Ask': + What = "demande" + Form = "Ask" + Me = "asker_id" + You = "provider_id" +elif Kind=='Proposal': + What = "offre" + Form = "Prop" + Me = "provider_id" + You = "asker_id" +if Type=='H': + CurTitle = u"d'hébergement" + CurIcon = "icon-home" +elif Type=='C': + CurTitle = "de co-voiturage" + CurIcon = "icon-road" +elif Type=='M': + CurTitle = u"de prêt de matériel" + CurIcon = "icon-shopping-cart" +%> + <table class="table table-striped table-bordered table-hover"> + <thead> + <tr> + <th colspan="3"><i class="${CurIcon}"></i> ${What}s ${CurTitle} + <a class="btn btn-mini btn-primary" Myhref="/2015/modal/${Form}${Type}/0" + role="button" data-target="#AjaxModal" style="float:right" handle="modal"> + <i class="icon-plus-sign icon-white"></i> Ajouter + </a> + </th> + </tr> + </thead> + <tbody id="${Form}${Type}Table"> + % if len(Selection['Ask'])==0 and len(Selection['Proposal'])==0: + <tr> + <td colspan="2" style="text-align:center;"> + <i>Vous n'avez fait aucune ${What}e ${CurTitle}</i> + </td> + </tr> + % else: + <tr> + <th style="width:7em;">Etat</th> + <th>Détails</th> + </tr> + % for CurKind in ['Ask', 'Proposal']: + % for item in Selection[CurKind]: + <% + if getattr(item, You)==request.user.uid: + continue + %> + <tr style="cursor:pointer;"> + <td> + % if item.exch_done: + <div class="btn-group"> + <a class="btn btn-small btn-success" href="javascript:DoGet('/2015/modal/Show${Type}/${item.exch_id}')"><i class="icon-ok icon-white"></i> Validé</a> + <a class="btn btn-small btn-success dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a> + <ul class="dropdown-menu"> + <li><a href="javascript:DoGet('/2015/modal/Show${Type}/${item.exch_id}')"><i class="icon-search"></i> Détails</a></li> + <li class="divider"></li> + <li><a href="javascript:DoGet('/2015/exchange/${Form}${Type}/${item.exch_id}/refuse')"><i class="icon-remove"></i> Annuler</a></li> + </ul> + % elif getattr(item, You) is None: + <div class="btn-group"> + <a class="btn btn-small"><i class="icon-signal"></i> Publié</a> + <a class="btn btn-small dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a> + <ul class="dropdown-menu"> + <li><a href="javascript:DoGet('/2015/modal/${Form}${Type}/${item.exch_id}')"><i class="icon-pencil"></i> Modifier</a></li> + <li><a href="javascript:DoGet('/2015/exchange/${Form}${Type}/${item.exch_id}/delete')"><i class="icon-trash"></i> Supprimer</a></li> + </ul> + % elif getattr(item, Me)==request.user.uid and item.exch_state==CurKind: + Je ${What} <br> + <div class="btn-group"> + <a class="btn btn-small btn-warning" href="javascript:DoGet('/2015/modal/Show${Type}/${item.exch_id}')"><i class="icon-question-sign icon-white"></i> Proposition</a> + <a class="btn btn-small btn-warning dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a> + <ul class="dropdown-menu"> + <li><a href="javascript:DoGet('/2015/modal/Show${Type}/${item.exch_id}')"><i class="icon-search"></i> Détails</a></li> + <li class="divider"></li> + <li><a href="javascript:DoGet('/2015/exchange/${Form}${Type}/${item.exch_id}/accept')"><i class="icon-ok"></i> Accepter</a></li> + <li><a href="javascript:DoGet('/2015/exchange/${Form}${Type}/${item.exch_id}/refuse')"><i class="icon-remove"></i> Refuser</a></li> + <li class="divider"></li> + <li><a href="javascript:DoGet('/2015/exchange/${Form}${Type}/${item.exch_id}/delete')"><i class="icon-trash"></i> Supprimer</a></li> + </ul> + % elif getattr(item, Me)==request.user.uid: + Je ${What} <br> + <div class="btn-group"> + <a class="btn btn-small btn-info" href="javascript:DoGet('/2015/modal/Show${Type}/${item.exch_id}')"><i class="icon-question-sign icon-white"></i> Négociation</a> + <a class="btn btn-small btn-info dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a> + <ul class="dropdown-menu"> + <li><a href="javascript:DoGet('/2015/modal/Show${Type}/${item.exch_id}')"><i class="icon-search"></i> Détails</a></li> + <li><a href="#"><i class="icon-question-sign"></i> En Attente de réponse </a></li> + <li><a href="javascript:DoGet('/2015/exchange/${Form}${Type}/${item.exch_id}/refuse')"><i class="icon-remove"></i> Se désister </a></li> + </ul> + % endif + </div> + </div> + </td> + <td> + %if Type=='C': + ${item.start_time.strftime('%A %d %b %Y').decode('utf-8')} vers ${item.start_time.strftime('%Hh%M')} + de <a href="javascript:DoGetLieu('/2015/modal/Place/${item.Itin.start.place_id}')">${item.Itin.start.display_name}</a> + à <a href="javascript:DoGetLieu('/2015/modal/Place/${item.Itin.arrival.place_id}')">${item.Itin.arrival.display_name}</a> + %elif Type=='H': + % if item.Category: + <i>${item.Category.exch_subtype}</i>, + % endif + La nuit du ${item.start_time.strftime('%A %d %b %Y').decode('utf-8')}<br> + %elif Type=='M': + de ${item.start_time.strftime('%A %d %b %Y').decode('utf-8')} vers ${item.start_time.strftime('%Hh%M')} + à ${item.end_time.strftime('%A %d %b %Y').decode('utf-8')} vers ${item.end_time.strftime('%Hh%M')}<br> + ${item.Category.exch_subtype} + %endif + %if item.description: + ${item.description} + %endif + </td> + </tr> + % endfor + % endfor + % endif + </tbody> + </table> +</%def> |