fix: sidebar & navbar
This commit is contained in:
@@ -21,7 +21,7 @@ import { useNotificationsStore } from '../stores/notifications';
|
||||
const vehicleLastLocation = ref(null);
|
||||
const isLoadActive = ref(false);
|
||||
|
||||
const { getDirections } = useDirectionsRender()
|
||||
const { getDirections, geocodeAddress } = useDirectionsRender()
|
||||
|
||||
const props = defineProps({
|
||||
proposal: {
|
||||
@@ -46,20 +46,31 @@ import { useNotificationsStore } from '../stores/notifications';
|
||||
});
|
||||
|
||||
const initData = async() => {
|
||||
console.log(props.proposal)
|
||||
isLoading.value = true;
|
||||
const code = props.proposal.load.shipment_code;
|
||||
const filter = "?shipment_code[$in]=" + code;
|
||||
const resp = await loadStore.getLoad(filter);
|
||||
console.log(resp);
|
||||
if(resp.total > 0) {
|
||||
load.value = resp.data[0];
|
||||
try {
|
||||
const addressOrigin = load.value?.origin;
|
||||
const addressDestination = load.value?.destination;
|
||||
if(addressOrigin && addressDestination) {
|
||||
originCoords.value = {lat: Number.parseFloat(addressOrigin.lat), lng: Number.parseFloat(addressOrigin.lng)};
|
||||
destinationCoords.value = {lat: Number.parseFloat(addressDestination.lat), lng: Number.parseFloat(addressDestination.lng)};
|
||||
if(addressOrigin.lat && addressOrigin.lng) {
|
||||
originCoords.value = {lat: Number.parseFloat(addressOrigin.lat), lng: Number.parseFloat(addressOrigin.lng)};
|
||||
} else {
|
||||
console.log('No hay coords origin')
|
||||
let startLocation = addressOrigin.street_address1 + ', ' + addressOrigin.city + ', ' + addressOrigin.state + ', ' + addressOrigin.country + ', ' +addressOrigin.zipcode;
|
||||
originCoords.value = await geocodeAddress(startLocation);
|
||||
}
|
||||
|
||||
if(addressDestination.lat && addressDestination.lng) {
|
||||
destinationCoords.value = {lat: Number.parseFloat(addressDestination.lat), lng: Number.parseFloat(addressDestination.lng)};
|
||||
} else {
|
||||
console.log('No hay coords destinatiom')
|
||||
let endLocation = addressDestination.street_address1 + ', ' + addressDestination.city + ', ' + addressDestination.state + ', ' + addressDestination.country + ', ' +addressDestination.zipcode;
|
||||
destinationCoords.value = await geocodeAddress(endLocation);
|
||||
}
|
||||
|
||||
polylines.value = await getDirections(originCoords.value, destinationCoords.value);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user