fixes: Tracking load & load edit
This commit is contained in:
@@ -5,6 +5,10 @@
|
||||
import NotificationBadge from './ui/NotificationBadge.vue';
|
||||
import { validateEmail } from '../helpers/validations';
|
||||
import Swal from 'sweetalert2';
|
||||
import { useAuthStore } from '../stores/auth';
|
||||
import { useNotificationsStore } from '../stores/notifications';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
const emailForm = reactive({
|
||||
email: '',
|
||||
email2: '',
|
||||
@@ -13,6 +17,9 @@
|
||||
const loading = ref(false)
|
||||
const msgError = ref('');
|
||||
const msgSuccess = ref('');
|
||||
const auth = useAuthStore();
|
||||
const notifications = useNotificationsStore();
|
||||
const router = useRouter();
|
||||
|
||||
const hangleSave = () => {
|
||||
msgError.value = '';
|
||||
@@ -32,7 +39,7 @@
|
||||
cancelButtonColor: "#d33",
|
||||
confirmButtonText: 'Confirmar',
|
||||
cancelButtonText: 'Cancelar',
|
||||
}).then(async(result) => {
|
||||
}).then( async(result) => {
|
||||
if(result.isConfirmed) {
|
||||
Swal.fire({
|
||||
title: 'Por favor espere!',
|
||||
@@ -42,8 +49,27 @@
|
||||
Swal.showLoading()
|
||||
},
|
||||
});
|
||||
// const resp = await companyStore.deleteUserCompany(props.user._id)
|
||||
|
||||
const userData = {
|
||||
"email" : emailForm.email,
|
||||
};
|
||||
console.log(userData);
|
||||
loading.value = true;
|
||||
const response = await auth.updateProfile(userData)
|
||||
loading.value = false;
|
||||
if (response.msg !== 'success') {
|
||||
msgError.value = response.msg;
|
||||
clearMessages();
|
||||
} else {
|
||||
clearMessages();
|
||||
notifications.$patch({
|
||||
text : 'Correo electrónico se ha cambiando exitosamente!',
|
||||
show : true,
|
||||
error: false
|
||||
});
|
||||
auth.logout();
|
||||
router.push({name: 'login'});
|
||||
}
|
||||
Swal.close()
|
||||
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
show : true,
|
||||
error: false
|
||||
});
|
||||
auth.logout();
|
||||
router.push({name: 'login'});
|
||||
} else {
|
||||
msgError.value = result.msg;
|
||||
|
||||
@@ -79,6 +79,7 @@
|
||||
formLoad.owner = auth.user?.first_name + ' ' + auth.user?.last_name;
|
||||
//origin_formatted_address
|
||||
if(loadStore.currentLoad){
|
||||
console.log(loadStore.currentLoad);
|
||||
formLoad.price = loadStore.currentLoad.actual_cost;
|
||||
formLoad.segment = loadStore.currentLoad.categories?.length <= 0 ? [] : loadStore.currentLoad.categories.map(m =>{
|
||||
return m;
|
||||
@@ -130,7 +131,7 @@
|
||||
|
||||
watch([originCoords, destinationCoords], async() => {
|
||||
if(originCoords.value && destinationCoords.value) {
|
||||
console.log('Se llama api direcciones ')
|
||||
// console.log('Se llama api direcciones ')
|
||||
polylines.value = await getDirections(originCoords.value, destinationCoords.value);
|
||||
}
|
||||
})
|
||||
@@ -160,12 +161,26 @@
|
||||
}
|
||||
|
||||
const getCoordsMap = async() => {
|
||||
if(loadStore.currentLoad.origin_formatted_address) {
|
||||
originCoords.value = await geocodeAddress(loadStore.currentLoad.origin_formatted_address);
|
||||
const destinationLat = loadStore.currentLoad.destination?.lat;
|
||||
const destinationLng = loadStore.currentLoad.destination?.lng;
|
||||
const originLat = loadStore.currentLoad.origin?.lat;
|
||||
const originLng = loadStore.currentLoad.origin?.lng;
|
||||
if(destinationLat && destinationLng) {
|
||||
destinationCoords.value = {lat: Number.parseFloat(destinationLat), lng: Number.parseFloat(destinationLng)}
|
||||
}
|
||||
if(loadStore.currentLoad.destination_formatted_address){
|
||||
destinationCoords.value = await geocodeAddress(loadStore.currentLoad.destination_formatted_address);
|
||||
if(originLat && originLng) {
|
||||
originCoords.value = {lat: Number.parseFloat(originLat), lng: Number.parseFloat(originLng)}
|
||||
}
|
||||
|
||||
if(originCoords.value && destinationCoords.value) {
|
||||
polylines.value = await getDirections(originCoords.value, destinationCoords.value);
|
||||
}
|
||||
// if(loadStore.currentLoad.origin_formatted_address) {
|
||||
// originCoords.value = await geocodeAddress(loadStore.currentLoad.origin_formatted_address);
|
||||
// }
|
||||
// if(loadStore.currentLoad.destination_formatted_address){
|
||||
// destinationCoords.value = await geocodeAddress(loadStore.currentLoad.destination_formatted_address);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user