add: post load
This commit is contained in:
@@ -92,8 +92,25 @@
|
|||||||
<div class="card-fixed card-load mt-4">
|
<div class="card-fixed card-load mt-4">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6 col-sm-12">
|
<div class="col-lg-6 col-sm-12">
|
||||||
<p><span>Origen:</span> {{ load.origin.company_name }}, {{ load.origin_formatted_address }}</p>
|
<p>
|
||||||
<p><span>Destino:</span> {{ load.destination.company_name }}, {{ load.destination_formatted_address }}</p>
|
<span>Origen: </span>
|
||||||
|
<template v-if="load.origin.company_name"> {{ load.origin.company_name }}, </template>
|
||||||
|
<template v-if="load.origin.street_address1">{{ load.origin.street_address1 }}, </template>
|
||||||
|
<template v-if="load.origin.city">{{ load.origin.city }}, </template>
|
||||||
|
<template v-if="load.origin.state">{{ load.origin.state }}, </template>
|
||||||
|
<template v-if="load.origin.country">{{ load.origin.country }}, </template>
|
||||||
|
<template v-if="load.origin.zipcode">{{ load.origin.zipcode }} </template>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<span>Destino: </span>
|
||||||
|
<template v-if="load.destination.company_name"> {{ load.destination.company_name }}, </template>
|
||||||
|
<template v-if="load.destination.street_address1">{{ load.destination.street_address1 }}, </template>
|
||||||
|
<template v-if="load.destination.city">{{ load.destination.city }}, </template>
|
||||||
|
<template v-if="load.destination.state">{{ load.destination.state }}, </template>
|
||||||
|
<template v-if="load.destination.country">{{ load.destination.country }}, </template>
|
||||||
|
<template v-if="load.destination.zipcode">{{ load.destination.zipcode }} </template>
|
||||||
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-sm-12">
|
<div class="col-lg-6 col-sm-12">
|
||||||
<p><span>Status de la publicación:</span> <span>{{ getStatusPublished(load) }}</span></p>
|
<p><span>Status de la publicación:</span> <span>{{ getStatusPublished(load) }}</span></p>
|
||||||
|
|||||||
@@ -12,8 +12,10 @@
|
|||||||
import useDirectionsRender from '../composables/useDirectionRender';
|
import useDirectionsRender from '../composables/useDirectionRender';
|
||||||
import { useAuthStore } from '../stores/auth';
|
import { useAuthStore } from '../stores/auth';
|
||||||
import Swal from 'sweetalert2';
|
import Swal from 'sweetalert2';
|
||||||
|
import { useNotificationsStore } from '../stores/notifications';
|
||||||
|
|
||||||
const loadStore = useLoadsStore();
|
const loadStore = useLoadsStore();
|
||||||
|
const notyStore = useNotificationsStore();
|
||||||
const auth = useAuthStore();
|
const auth = useAuthStore();
|
||||||
const windowWidth = ref(window.innerWidth);
|
const windowWidth = ref(window.innerWidth);
|
||||||
const zoom = ref(6);
|
const zoom = ref(6);
|
||||||
@@ -23,7 +25,18 @@
|
|||||||
const startLocation = ref(null);
|
const startLocation = ref(null);
|
||||||
const endLocation = ref(null);
|
const endLocation = ref(null);
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
|
const submited = ref(false);
|
||||||
const { geocodeAddress } = useDirectionsRender();
|
const { geocodeAddress } = useDirectionsRender();
|
||||||
|
const formRef = ref(null);
|
||||||
|
const errors = ref({
|
||||||
|
segment: null,
|
||||||
|
product: null,
|
||||||
|
truckType: null,
|
||||||
|
cityOrigin: null,
|
||||||
|
stateOrigin: null,
|
||||||
|
cityDestination: null,
|
||||||
|
stateDestination: null,
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
const clearLoad = () => {
|
const clearLoad = () => {
|
||||||
@@ -85,12 +98,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
watch(origin, async() => {
|
watch(origin, async() => {
|
||||||
console.log(origin);
|
// console.log(origin);
|
||||||
if(origin.address && origin.city && origin.state) {
|
if(origin.address && origin.city && origin.state) {
|
||||||
startLocation.value = origin.address + ', ' + origin.city.city_name + ', ' + origin.state.state_name + ', ' + origin.country + ', ' +origin.postalCode;
|
startLocation.value = origin.address + ', ' + origin.city.city_name + ', ' + origin.state.state_name + ', ' + origin.country + ', ' +origin.postalCode;
|
||||||
originCoords.value = await geocodeAddress(startLocation.value);
|
originCoords.value = await geocodeAddress(startLocation.value);
|
||||||
console.log('Origin:')
|
// console.log('Origin:')
|
||||||
console.log(originCoords.value)
|
// console.log(originCoords.value)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -98,8 +111,8 @@
|
|||||||
if(destination.address && destination.city && destination.state) {
|
if(destination.address && destination.city && destination.state) {
|
||||||
endLocation.value = destination.address + ', ' + destination.city.city_name + ', ' + destination.state.state_name + ', ' + destination.country + ', ' +destination.postalCode;
|
endLocation.value = destination.address + ', ' + destination.city.city_name + ', ' + destination.state.state_name + ', ' + destination.country + ', ' +destination.postalCode;
|
||||||
destinationCoords.value = await geocodeAddress(endLocation.value);
|
destinationCoords.value = await geocodeAddress(endLocation.value);
|
||||||
console.log('Destination:')
|
// console.log('Destination:')
|
||||||
console.log(destinationCoords.value);
|
// console.log(destinationCoords.value);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -154,7 +167,7 @@
|
|||||||
est_unloading_date : formLoad.dateDownload,
|
est_unloading_date : formLoad.dateDownload,
|
||||||
notes : formLoad.notes,
|
notes : formLoad.notes,
|
||||||
weight : formLoad.weight,
|
weight : formLoad.weight,
|
||||||
product: formLoad.terms || null,
|
product: formLoad.terms.length <= 0 ? null : formLoad.terms,
|
||||||
categories: formLoad.segment || null,
|
categories: formLoad.segment || null,
|
||||||
origin:{
|
origin:{
|
||||||
company_name : origin.locationName,
|
company_name : origin.locationName,
|
||||||
@@ -190,13 +203,12 @@
|
|||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
if(loadStore.currentLoad){
|
if(loadStore.currentLoad){
|
||||||
const resp = await loadStore.updateLoad(loadStore.currentLoad._id, loadData);
|
const resp = await loadStore.updateLoad(loadStore.currentLoad._id, loadData);
|
||||||
console.log({resp});
|
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
if(resp) {
|
if(resp) {
|
||||||
const index = loadStore.loads.findIndex((load) => load._id === resp._id);
|
const index = loadStore.loads.findIndex((load) => load._id === resp._id);
|
||||||
loadStore.loads[index] = {
|
loadStore.loads[index] = {
|
||||||
...loadStore.loads[index],
|
...loadStore.loads[index],
|
||||||
resp
|
...resp
|
||||||
};
|
};
|
||||||
return 'success';
|
return 'success';
|
||||||
} else {
|
} else {
|
||||||
@@ -206,7 +218,10 @@
|
|||||||
const resp = await loadStore.saveLoad(loadData);
|
const resp = await loadStore.saveLoad(loadData);
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
if(resp) {
|
if(resp) {
|
||||||
loadStore.loads.unshift(resp);
|
loadStore.loads.push({
|
||||||
|
...resp,
|
||||||
|
...loadData
|
||||||
|
});
|
||||||
return 'success';
|
return 'success';
|
||||||
} else {
|
} else {
|
||||||
return 'error';
|
return 'error';
|
||||||
@@ -215,12 +230,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleSave = async() => {
|
const handleSave = async() => {
|
||||||
|
submited.value = false;
|
||||||
const loadData = setLoadData();
|
const loadData = setLoadData();
|
||||||
|
|
||||||
// console.log('loadData: ', loadData);
|
|
||||||
const resp = await updateLoad(loadData);
|
const resp = await updateLoad(loadData);
|
||||||
if(resp === 'success') {
|
if(resp === 'success') {
|
||||||
|
notyStore.show = 'true';
|
||||||
|
notyStore.text = 'Carga guardada!'
|
||||||
document.getElementById('btnCloseFormLoadModal').click();
|
document.getElementById('btnCloseFormLoadModal').click();
|
||||||
} else {
|
} else {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
@@ -231,7 +246,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const validations = () => {
|
||||||
|
errors.value = {
|
||||||
|
segment: formLoad.segment.length <= 0 ? 'Seleccione segmento' : null,
|
||||||
|
product: formLoad.terms.length <= 0 ? 'Seleccione producto' : null,
|
||||||
|
truckType: formLoad.truckType.length <= 0 ? 'Seleccione tipo de transporte' : null,
|
||||||
|
cityOrigin: origin.city.length <= 0 ? 'Seleccione ciudad' : null,
|
||||||
|
stateOrigin: origin.state.length <= 0 ? 'Seleccione estado' : null,
|
||||||
|
cityDestination: destination.city.length <= 0 ? 'Seleccione ciudad' : null,
|
||||||
|
stateDestination: destination.state.length <= 0 ? 'Seleccione estado' : null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const handlePostLoad = async() => {
|
const handlePostLoad = async() => {
|
||||||
|
submited.value = true;
|
||||||
let loadData = setLoadData();
|
let loadData = setLoadData();
|
||||||
|
|
||||||
loadData = {
|
loadData = {
|
||||||
@@ -240,16 +269,31 @@
|
|||||||
load_status: "Published"
|
load_status: "Published"
|
||||||
}
|
}
|
||||||
|
|
||||||
const resp = await updateLoad(loadData);
|
setTimeout(async() => {
|
||||||
if(resp === 'success') {
|
const formValid = formRef.value.checkValidity();
|
||||||
document.getElementById('btnCloseFormLoadModal').click();
|
validations()
|
||||||
} else {
|
console.log(formValid);
|
||||||
Swal.fire({
|
if(formValid){
|
||||||
title: "Error!",
|
const hasError = Object.values(errors.value).some(val => val != null);
|
||||||
text: "No se pudo publicar carga, intente más tarde",
|
console.log(hasError);
|
||||||
icon: "error"
|
if(!hasError) {
|
||||||
});
|
const resp = await updateLoad(loadData);
|
||||||
}
|
if(resp === 'success') {
|
||||||
|
notyStore.show = 'true';
|
||||||
|
notyStore.text = 'Carga publicada!'
|
||||||
|
document.getElementById('btnCloseFormLoadModal').click();
|
||||||
|
} else {
|
||||||
|
Swal.fire({
|
||||||
|
title: "Error!",
|
||||||
|
text: "No se pudo publicar carga, intente más tarde",
|
||||||
|
icon: "error"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('Hay errores');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 200)
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -271,7 +315,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<form class="form-content">
|
<form class="form-content" ref="formRef">
|
||||||
<div class="form-box">
|
<div class="form-box">
|
||||||
<div class="form-section">
|
<div class="form-section">
|
||||||
<div class="mb-4 mt-3">
|
<div class="mb-4 mt-3">
|
||||||
@@ -279,18 +323,22 @@
|
|||||||
<Segments
|
<Segments
|
||||||
v-model="formLoad.segment"
|
v-model="formLoad.segment"
|
||||||
/>
|
/>
|
||||||
|
<span class="error-msg" v-if="submited && errors.segment">{{ errors.segment }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-4 mt-3">
|
<div class="mb-4 mt-3">
|
||||||
<label class="custom-label">Tipo de transporte*</label>
|
<label class="custom-label">Tipo de transporte*</label>
|
||||||
<TruckTypes
|
<TruckTypes
|
||||||
v-model="formLoad.truckType"
|
v-model="formLoad.truckType"
|
||||||
/>
|
/>
|
||||||
|
<span class="error-msg" v-if="submited && errors.truckType">{{ errors.truckType }}</span>
|
||||||
</div>
|
</div>
|
||||||
<Custominput
|
<Custominput
|
||||||
label="Fecha de carga*"
|
label="Fecha de carga*"
|
||||||
type="date"
|
type="date"
|
||||||
:filled="false"
|
:filled="false"
|
||||||
name="date-load"
|
name="date-load"
|
||||||
|
:required="submited ? true : false"
|
||||||
|
:error="(submited && !formLoad.dateLoad) ? 'Fecha es requerida' : null"
|
||||||
v-model:field="formLoad.dateLoad"
|
v-model:field="formLoad.dateLoad"
|
||||||
/>
|
/>
|
||||||
<Custominput
|
<Custominput
|
||||||
@@ -298,6 +346,8 @@
|
|||||||
type="date"
|
type="date"
|
||||||
:filled="false"
|
:filled="false"
|
||||||
name="date-download"
|
name="date-download"
|
||||||
|
:required="submited ? true : false"
|
||||||
|
:error="(submited && !formLoad.dateDownload) ? 'Fecha es requerida' : null"
|
||||||
v-model:field="formLoad.dateDownload"
|
v-model:field="formLoad.dateDownload"
|
||||||
/>
|
/>
|
||||||
<Custominput
|
<Custominput
|
||||||
@@ -305,6 +355,8 @@
|
|||||||
type="number"
|
type="number"
|
||||||
:filled="false"
|
:filled="false"
|
||||||
name="weight"
|
name="weight"
|
||||||
|
:required="submited ? true : false"
|
||||||
|
:error="(submited && !formLoad.weight) ? 'Ingrese peso en KG' : null"
|
||||||
v-model:field="formLoad.weight"
|
v-model:field="formLoad.weight"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -314,6 +366,7 @@
|
|||||||
<Products
|
<Products
|
||||||
v-model="formLoad.terms"
|
v-model="formLoad.terms"
|
||||||
/>
|
/>
|
||||||
|
<span class="error-msg" v-if="submited && errors.product">{{ errors.product }}</span>
|
||||||
</div>
|
</div>
|
||||||
<Custominput
|
<Custominput
|
||||||
label="Precio*"
|
label="Precio*"
|
||||||
@@ -321,6 +374,8 @@
|
|||||||
:filled="false"
|
:filled="false"
|
||||||
name="price"
|
name="price"
|
||||||
v-model:field="formLoad.price"
|
v-model:field="formLoad.price"
|
||||||
|
:required="submited ? true : false"
|
||||||
|
:error="(submited && !formLoad.price) ? 'Ingrese precio en MXN' : null"
|
||||||
/>
|
/>
|
||||||
<Custominput
|
<Custominput
|
||||||
label="Notas"
|
label="Notas"
|
||||||
@@ -348,6 +403,8 @@
|
|||||||
:filled="false"
|
:filled="false"
|
||||||
name="name-location-origin"
|
name="name-location-origin"
|
||||||
v-model:field="origin.locationName"
|
v-model:field="origin.locationName"
|
||||||
|
:required="submited ? true : false"
|
||||||
|
:error="(submited && !origin.locationName) ? 'Ingrese nombre' : null"
|
||||||
/>
|
/>
|
||||||
<Custominput
|
<Custominput
|
||||||
label="Dirección*"
|
label="Dirección*"
|
||||||
@@ -355,18 +412,22 @@
|
|||||||
:filled="false"
|
:filled="false"
|
||||||
name="address-origin"
|
name="address-origin"
|
||||||
v-model:field="origin.address"
|
v-model:field="origin.address"
|
||||||
|
:required="submited ? true : false"
|
||||||
|
:error="(submited && !origin.address) ? 'Ingrese dirección' : null"
|
||||||
/>
|
/>
|
||||||
<div class="mb-4 mt-3">
|
<div class="mb-4 mt-3">
|
||||||
<label class="custom-label">Ciudad*</label>
|
<label class="custom-label">Ciudad*</label>
|
||||||
<Cities
|
<Cities
|
||||||
v-model="origin.city"
|
v-model="origin.city"
|
||||||
/>
|
/>
|
||||||
|
<span class="error-msg" v-if="submited && errors.cityOrigin">{{ errors.cityOrigin }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-4 mt-3">
|
<div class="mb-4 mt-3">
|
||||||
<label class="custom-label">Estado*</label>
|
<label class="custom-label">Estado*</label>
|
||||||
<States
|
<States
|
||||||
v-model="origin.state"
|
v-model="origin.state"
|
||||||
/>
|
/>
|
||||||
|
<span class="error-msg" v-if="submited && errors.stateOrigin">{{ errors.stateOrigin }}</span>
|
||||||
</div>
|
</div>
|
||||||
<Custominput
|
<Custominput
|
||||||
label="País*"
|
label="País*"
|
||||||
@@ -374,6 +435,8 @@
|
|||||||
:filled="false"
|
:filled="false"
|
||||||
name="country-origin"
|
name="country-origin"
|
||||||
v-model:field="origin.country"
|
v-model:field="origin.country"
|
||||||
|
:required="submited ? true : false"
|
||||||
|
:error="(submited && !origin.country) ? 'Ingrese país' : null"
|
||||||
/>
|
/>
|
||||||
<Custominput
|
<Custominput
|
||||||
label="Código Postal*"
|
label="Código Postal*"
|
||||||
@@ -381,6 +444,8 @@
|
|||||||
:filled="false"
|
:filled="false"
|
||||||
name="postalCode-origin"
|
name="postalCode-origin"
|
||||||
v-model:field="origin.postalCode"
|
v-model:field="origin.postalCode"
|
||||||
|
:required="submited ? true : false"
|
||||||
|
:error="(submited && !origin.postalCode) ? 'Ingrese Código postal' : null"
|
||||||
/>
|
/>
|
||||||
<Custominput
|
<Custominput
|
||||||
label="Punto de referencia"
|
label="Punto de referencia"
|
||||||
@@ -398,6 +463,8 @@
|
|||||||
:filled="false"
|
:filled="false"
|
||||||
name="name-location-destination"
|
name="name-location-destination"
|
||||||
v-model:field="destination.locationName"
|
v-model:field="destination.locationName"
|
||||||
|
:required="submited ? true : false"
|
||||||
|
:error="(submited && !destination.locationName) ? 'Ingrese nombre' : null"
|
||||||
/>
|
/>
|
||||||
<Custominput
|
<Custominput
|
||||||
label="Dirección"
|
label="Dirección"
|
||||||
@@ -405,18 +472,22 @@
|
|||||||
:filled="false"
|
:filled="false"
|
||||||
name="address-destination"
|
name="address-destination"
|
||||||
v-model:field="destination.address"
|
v-model:field="destination.address"
|
||||||
|
:required="submited ? true : false"
|
||||||
|
:error="(submited && !destination.address) ? 'Ingrese dirección' : null"
|
||||||
/>
|
/>
|
||||||
<div class="mb-4 mt-3">
|
<div class="mb-4 mt-3">
|
||||||
<label class="custom-label">Ciudad*</label>
|
<label class="custom-label">Ciudad*</label>
|
||||||
<Cities
|
<Cities
|
||||||
v-model="destination.city"
|
v-model="destination.city"
|
||||||
/>
|
/>
|
||||||
|
<span class="error-msg" v-if="submited && errors.cityDestination">{{ errors.cityDestination }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-4 mt-3">
|
<div class="mb-4 mt-3">
|
||||||
<label class="custom-label">Estado*</label>
|
<label class="custom-label">Estado*</label>
|
||||||
<States
|
<States
|
||||||
v-model="destination.state"
|
v-model="destination.state"
|
||||||
/>
|
/>
|
||||||
|
<span class="error-msg" v-if="submited && errors.stateDestination">{{ errors.stateDestination }}</span>
|
||||||
</div>
|
</div>
|
||||||
<Custominput
|
<Custominput
|
||||||
label="País*"
|
label="País*"
|
||||||
@@ -424,6 +495,8 @@
|
|||||||
:filled="false"
|
:filled="false"
|
||||||
name="country-destination"
|
name="country-destination"
|
||||||
v-model:field="destination.country"
|
v-model:field="destination.country"
|
||||||
|
:required="submited ? true : false"
|
||||||
|
:error="(submited && !destination.country) ? 'Ingrese país' : null"
|
||||||
/>
|
/>
|
||||||
<Custominput
|
<Custominput
|
||||||
label="Código Postal*"
|
label="Código Postal*"
|
||||||
@@ -431,6 +504,8 @@
|
|||||||
:filled="false"
|
:filled="false"
|
||||||
name="postalCode-destination"
|
name="postalCode-destination"
|
||||||
v-model:field="destination.postalCode"
|
v-model:field="destination.postalCode"
|
||||||
|
:required="submited ? true : false"
|
||||||
|
:error="(submited && !destination.postalCode) ? 'Ingrese código postal' : null"
|
||||||
/>
|
/>
|
||||||
<Custominput
|
<Custominput
|
||||||
label="Punto de referencia"
|
label="Punto de referencia"
|
||||||
@@ -483,9 +558,9 @@
|
|||||||
@click="handleSave"
|
@click="handleSave"
|
||||||
>Guardar</button>
|
>Guardar</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="submit"
|
||||||
|
@click.prevent="handlePostLoad"
|
||||||
class="btn-primary-sm radius-sm"
|
class="btn-primary-sm radius-sm"
|
||||||
@click="handlePostLoad"
|
|
||||||
>Publicar</button>
|
>Publicar</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -522,6 +597,12 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.error-msg {
|
||||||
|
color: red;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 300;
|
||||||
|
}
|
||||||
|
|
||||||
.btns-footer {
|
.btns-footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
|
|||||||
@@ -28,6 +28,13 @@
|
|||||||
helpText: {
|
helpText: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
|
},
|
||||||
|
required: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
error: {
|
||||||
|
type: String,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -47,8 +54,10 @@
|
|||||||
:value="field"
|
:value="field"
|
||||||
:disabled="readonly"
|
:disabled="readonly"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:required="required"
|
||||||
@input="$event => $emit('update:field', $event.target.value)">
|
@input="$event => $emit('update:field', $event.target.value)">
|
||||||
<span class="help" v-if="helpText.length > 0">{{ helpText }}</span>
|
<span class="help" v-if="helpText.length > 0">{{ helpText }}</span>
|
||||||
|
<span class="error-msg" v-if="error">{{ error }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -58,4 +67,10 @@
|
|||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
color: rgb(108, 92, 92);
|
color: rgb(108, 92, 92);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.error-msg {
|
||||||
|
color: red;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 300;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -23,7 +23,6 @@ export const useLoadsStore = defineStore('load', () => {
|
|||||||
try {
|
try {
|
||||||
const endpoint = `/loads?company=${companyid}&${filterStr}`;
|
const endpoint = `/loads?company=${companyid}&${filterStr}`;
|
||||||
const {data} = await api.get(endpoint);
|
const {data} = await api.get(endpoint);
|
||||||
// console.log(data);
|
|
||||||
loads.value = data.data;
|
loads.value = data.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
loads.value = [];
|
loads.value = [];
|
||||||
@@ -47,7 +46,6 @@ export const useLoadsStore = defineStore('load', () => {
|
|||||||
try {
|
try {
|
||||||
const endpoint = `/loads/`;
|
const endpoint = `/loads/`;
|
||||||
const {data} = await api.post(endpoint, load);
|
const {data} = await api.post(endpoint, load);
|
||||||
// console.log(data);
|
|
||||||
return data;
|
return data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
@@ -96,7 +94,6 @@ export const useLoadsStore = defineStore('load', () => {
|
|||||||
const endpoint = `/loads/${loadId}`;
|
const endpoint = `/loads/${loadId}`;
|
||||||
console.log(endpoint);
|
console.log(endpoint);
|
||||||
const {data} = await api.delete(endpoint);
|
const {data} = await api.delete(endpoint);
|
||||||
console.log(data);
|
|
||||||
return data;
|
return data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
@@ -108,7 +105,6 @@ export const useLoadsStore = defineStore('load', () => {
|
|||||||
try {
|
try {
|
||||||
const endpoint = `/loads/${filterQuery}`;
|
const endpoint = `/loads/${filterQuery}`;
|
||||||
const {data} = await api.get(endpoint);
|
const {data} = await api.get(endpoint);
|
||||||
console.log(data);
|
|
||||||
return data;
|
return data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|||||||
Reference in New Issue
Block a user