modify some style and add the update file to delete passenger
This commit is contained in:
@@ -25,6 +25,11 @@
|
||||
<input id="ar" type="hidden" value="{{.ViewState.group.Data.arrive.geometry.coordinates}}">
|
||||
<input id="des" type="hidden" value="{{.ViewState.group.Data.depart.geometry.coordinates}}">
|
||||
<input id="arri" type="hidden" value="{{.ViewState.group.Data.arrive.geometry.coordinates}}">
|
||||
{{range .ViewState.beneficiaries}}
|
||||
{{if (index $.ViewState.groups .ID) }}
|
||||
<input id="passager" type="hidden"value="{{(index $.ViewState.groups .ID).Data.depart.geometry.coordinates}}">
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
<div>
|
||||
<span id="polyline-info-content"></span>
|
||||
@@ -100,7 +105,7 @@ function errorRoute() {
|
||||
var br = (wwr[0])
|
||||
destCoord = [r, br]
|
||||
map.setZoom(9);
|
||||
//console.log("Ici : " [depCoord[0],depCoord[1]],[destCoord[0],destCoord[1]])
|
||||
|
||||
map.fitBounds([[depCoord[0],depCoord[1]],[destCoord[0],destCoord[1]]],{padding: 40});
|
||||
}
|
||||
|
||||
@@ -115,10 +120,8 @@ function errorRoute() {
|
||||
if (rideDuration != null && rideDistance != null) {
|
||||
document.getElementById("polyline-info-content").innerHTML = "Durée : " + (Math.round(((rideDuration / 60) + Number.EPSILON) * 100) / 100) + " min<br/>Distance : " + rideDistance + " km";
|
||||
}
|
||||
// $("#polyline-str").val(polylineString);
|
||||
// $("#ride-duration").val(rideDuration);
|
||||
// $("#ride-distance").val(rideDistance);
|
||||
console.log("rideDuration :", rideDuration, ", rideDistance ",rideDistance)
|
||||
|
||||
// console.log("rideDuration :", rideDuration, ", rideDistance ",rideDistance)
|
||||
if(polylineCoord != null && polylineCoord.length > 0 ){
|
||||
|
||||
drawPolylineOnMap(polylineCoord)
|
||||
@@ -130,10 +133,9 @@ function createPolyline() {
|
||||
|
||||
destination = [r, br]
|
||||
|
||||
console.log("origin : ", origin)
|
||||
|
||||
if(origin != null && destination != null && origin != "" && destination != ""){
|
||||
console.log("Get polyline infos")
|
||||
|
||||
var hash_locs = [];
|
||||
hash_locs.push({
|
||||
'lat' : (origin[1]),
|
||||
@@ -156,17 +158,15 @@ function createPolyline() {
|
||||
success : retrievePolylineInfo,
|
||||
error: routeNotOptimized(body),
|
||||
});
|
||||
console.log("JSON.stringify(body)",JSON.stringify(body))
|
||||
|
||||
}
|
||||
}
|
||||
var depCoord = []
|
||||
var destCoord = []
|
||||
var other = []
|
||||
var a, b
|
||||
depCoord = [a, b]
|
||||
console.log("yeeesss: ", a)
|
||||
//////////////////////////////
|
||||
|
||||
//mapboxgl.accessToken = 'pk.eyJ1Ijoic291a2FpbmFsYWZkaWxpIiwiYSI6ImNsYjB1djUxNjAwaWQzdm82dnJ5OXJrZzcifQ.0i8xkskwRps3W1PFwApL_Q';
|
||||
|
||||
const map = new maplibregl.Map({
|
||||
container: 'map',
|
||||
style: 'https://api.maptiler.com/maps/streets/style.json?key=get_your_own_OpIi9ZULNHzrESv6T2vL',
|
||||
@@ -175,9 +175,24 @@ function createPolyline() {
|
||||
});
|
||||
map.addControl(new maplibregl.NavigationControl(), 'bottom-right');
|
||||
var markers = []
|
||||
var pass = []
|
||||
|
||||
//////////////////Code to add position in the map///////////////
|
||||
var ii = document.querySelectorAll("#passager")
|
||||
for (var i = 0; i < ii.length; i++){
|
||||
var v = ii[i].value
|
||||
var val = ii[i].value.split(' ')
|
||||
const wl = val[0].split('[')
|
||||
const wwl = val[1].split(']')
|
||||
al = (wl[1]);
|
||||
bl = (wwl[0])
|
||||
other = [al, bl]
|
||||
{var marker = new maplibregl.Marker()
|
||||
.setLngLat([al, bl])//position of passager
|
||||
.addTo(map);
|
||||
pass.push(marker)}
|
||||
}
|
||||
|
||||
//destination
|
||||
var i = document.getElementById('de').value
|
||||
var words = i.split(' ');
|
||||
const w = words[0].split('[')
|
||||
@@ -185,8 +200,6 @@ function createPolyline() {
|
||||
a = (w[1]);
|
||||
b = (ww[0])
|
||||
depCoord = [a, b]
|
||||
console.log("yeeesss: ", depCoord[0])
|
||||
console.log(b)
|
||||
//arrive
|
||||
var ar = document.getElementById('ar').value
|
||||
var wordsr = ar.split(' ');
|
||||
@@ -195,7 +208,7 @@ function createPolyline() {
|
||||
var r = (wr[1]);
|
||||
var br = (wwr[0])
|
||||
destCoord = [r, br]
|
||||
console.log(br)
|
||||
|
||||
/////
|
||||
{var marker = new maplibregl.Marker();
|
||||
marker.setLngLat([a, b])//starting position
|
||||
@@ -205,7 +218,7 @@ function createPolyline() {
|
||||
center: [a, b]
|
||||
|
||||
});
|
||||
console.log("again: ", a , b)
|
||||
|
||||
markers.push(marker)
|
||||
createPolyline()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user