<%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>
            <div class="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>
            </div>            
            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('/${CurrentYear}/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('/${CurrentYear}/modal/Place/0');">
            <i class="icon-plus-sign icon-white"></i> Ajouter un lieu
        </a>
    </div>    
</%def> \
