fixes: vehicles & proposals
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { getDayMonthYear } from '../helpers/date_formats';
|
import { getDateOnly } from '../helpers/date_formats';
|
||||||
import { getStatusPublished } from '../helpers/status';
|
import { getStatusPublished } from '../helpers/status';
|
||||||
import { getStatusLoad } from '../helpers/status';
|
import { getStatusLoad } from '../helpers/status';
|
||||||
import { useLoadsStore } from '../stores/loads';
|
import { useLoadsStore } from '../stores/loads';
|
||||||
@@ -84,13 +84,6 @@
|
|||||||
const handleTracking = () => {
|
const handleTracking = () => {
|
||||||
let code = props.load._id;
|
let code = props.load._id;
|
||||||
window.open('/publico/tracking/' + code, '_blank');
|
window.open('/publico/tracking/' + code, '_blank');
|
||||||
// router.push({
|
|
||||||
// name: 'tracking-load',
|
|
||||||
// params: {code},
|
|
||||||
// }
|
|
||||||
// ).then(() => {
|
|
||||||
// window.open('/publico/tracking/' + code, '_blank');
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@@ -117,7 +110,12 @@
|
|||||||
<template v-if="load.destination.country">{{ load.destination.country }}, </template>
|
<template v-if="load.destination.country">{{ load.destination.country }}, </template>
|
||||||
<template v-if="load.destination.zipcode">{{ load.destination.zipcode }} </template>
|
<template v-if="load.destination.zipcode">{{ load.destination.zipcode }} </template>
|
||||||
</p>
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 col-sm-12" v-if="readOnly">
|
||||||
|
<p>
|
||||||
|
<span>{{t('loads.company')}}: </span>
|
||||||
|
{{ load.company.company_name }}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-sm-12" v-if="authStore.user?.permissions === 'role_shipper'">
|
<div class="col-lg-6 col-sm-12" v-if="authStore.user?.permissions === 'role_shipper'">
|
||||||
<p><span>{{t('loads.postStatus')}}:</span> <span class="simple">{{ getStatusPublished(load) }}</span></p>
|
<p><span>{{t('loads.postStatus')}}:</span> <span class="simple">{{ getStatusPublished(load) }}</span></p>
|
||||||
@@ -130,16 +128,16 @@
|
|||||||
<div class="col-lg-4 col-sm-12">
|
<div class="col-lg-4 col-sm-12">
|
||||||
<p><span>{{t('loads.truckType')}}: </span> {{ load.truck_type }}</p>
|
<p><span>{{t('loads.truckType')}}: </span> {{ load.truck_type }}</p>
|
||||||
<p><span>{{t('loads.weight')}}: </span> {{ load.weight }} KG</p>
|
<p><span>{{t('loads.weight')}}: </span> {{ load.weight }} KG</p>
|
||||||
<p><span>{{t('loads.dateLoad')}}: </span> {{ getDayMonthYear(load.est_loading_date) }}</p>
|
<p><span>{{t('loads.dateLoad')}}: </span> {{ getDateOnly(load.est_loading_date) }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-4 col-sm-12">
|
<div class="col-lg-4 col-sm-12">
|
||||||
<p><span>{{t('loads.product')}}: </span> {{ load?.product?.name }}</p>
|
<p><span>{{t('loads.product')}}: </span> {{ load?.product?.name }}</p>
|
||||||
<p><span>{{t('loads.cost')}}: </span> {{ load.actual_cost }}</p>
|
<p><span>{{t('loads.cost')}}: </span> {{ load.actual_cost }}</p>
|
||||||
<p><span>{{t('loads.dateDownload')}}: </span> {{getDayMonthYear(load.est_unloading_date) }}</p>
|
<p><span>{{t('loads.dateDownload')}}: </span> {{getDateOnly(load.est_unloading_date) }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-4 col-sm-12">
|
<div class="col-lg-4 col-sm-12">
|
||||||
<p><span>{{t('global.segment')}}: </span> {{ load.categories?.map((e) => e.name).join(', ') }}</p>
|
<p><span>{{t('global.segment')}}: </span> {{ load.categories?.map((e) => e.name).join(', ') }}</p>
|
||||||
<p><span>{{t('loads.loadCode')}}: </span> {{ load.shipment_code }}
|
<p><span>{{t('loads.loadCode')}}: </span> {{ load.shipment_code?.toUpperCase() }}
|
||||||
<span
|
<span
|
||||||
v-if="load.load_status !== 'Draft' && !readOnly"
|
v-if="load.load_status !== 'Draft' && !readOnly"
|
||||||
class="tracking-icon"
|
class="tracking-icon"
|
||||||
|
|||||||
@@ -104,7 +104,7 @@
|
|||||||
class="code-enruta"
|
class="code-enruta"
|
||||||
@click="$emit('set-proposal', {proposal: proposal, modal: 'detail'})"
|
@click="$emit('set-proposal', {proposal: proposal, modal: 'detail'})"
|
||||||
data-toggle="modal" data-target="#loadDetailModal"
|
data-toggle="modal" data-target="#loadDetailModal"
|
||||||
>{{proposal.load.shipment_code}}</span></p>
|
>{{proposal.load.shipment_code.toUpperCase()}}</span></p>
|
||||||
<p v-if="proposal.vehicle" :style="{color: getStatusLoad(proposal.load, locale).color}"><span>{{ t('loads.loadStatus') }}:</span> {{ getStatusLoad(proposal.load, locale).status}}</p>
|
<p v-if="proposal.vehicle" :style="{color: getStatusLoad(proposal.load, locale).color}"><span>{{ t('loads.loadStatus') }}:</span> {{ getStatusLoad(proposal.load, locale).status}}</p>
|
||||||
<p v-if="proposal._driver">{{ t('labels.operator') }}: {{proposal._driver}}</p>
|
<p v-if="proposal._driver">{{ t('labels.operator') }}: {{proposal._driver}}</p>
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
console.log(props.vehicle);
|
|
||||||
defineEmits(['set-vehicle']);
|
defineEmits(['set-vehicle']);
|
||||||
|
|
||||||
const { t, locale } = useI18n()
|
const { t, locale } = useI18n()
|
||||||
@@ -59,6 +58,11 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleTracking = () => {
|
||||||
|
let code = props.vehicle.active_load._id;
|
||||||
|
window.open('/publico/tracking/' + code, '_blank');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -66,7 +70,7 @@
|
|||||||
<div class="card-fixed card-vehicle">
|
<div class="card-fixed card-vehicle">
|
||||||
<div class="row my-2">
|
<div class="row my-2">
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<p>{{ t('labels.codeId') }}: <span>{{ vehicle?.vehicle_code }}</span></p>
|
<p>{{ t('labels.codeId') }}: <span>{{ vehicle?.vehicle_code.toUpperCase() }}</span></p>
|
||||||
<p>{{ t('directory.typeTruck') }}: <span>{{ vehicle.truck_type }}</span></p>
|
<p>{{ t('directory.typeTruck') }}: <span>{{ vehicle.truck_type }}</span></p>
|
||||||
<p>{{ t('vehicles.serialNumber') }}: <span>{{ vehicle.vehicle_number }}</span></p>
|
<p>{{ t('vehicles.serialNumber') }}: <span>{{ vehicle.vehicle_number }}</span></p>
|
||||||
<p>{{ t('global.segment') }}: <span>{{vehicle.categories?.map((e) => e.name).join(', ')}}</span></p>
|
<p>{{ t('global.segment') }}: <span>{{vehicle.categories?.map((e) => e.name).join(', ')}}</span></p>
|
||||||
@@ -88,7 +92,8 @@
|
|||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<p>{{ t('vehicles.trailerPlates') }} 2: <span>{{ vehicle.trailer_plate_2 }}</span></p>
|
<p>{{ t('vehicles.trailerPlates') }} 2: <span>{{ vehicle.trailer_plate_2 }}</span></p>
|
||||||
<p>{{ t('vehicles.chargingBase') }}: <span>{{ vehicle.city }}, {{ vehicle.state }}</span></p>
|
<p>{{ t('vehicles.chargingBase') }}: <span>{{ vehicle.city }}, {{ vehicle.state }}</span></p>
|
||||||
<p v-if="vehicle.is_available">{{ t('vehicles.availableIn') }}: <span>{{ vehicle.destino }}</span></p>
|
<p v-if="vehicle.destino">{{ t('loads.destination') }}: <span>{{ vehicle.destino.replace(';', ', ') }}</span></p>
|
||||||
|
<p v-if="vehicle.available_in">{{ t('vehicles.availableIn') }}: <span>{{ vehicle.available_in.replace(';', ', ') }}</span></p>
|
||||||
<p>Status:
|
<p>Status:
|
||||||
<span>{{ vehicle.is_available ? t('vehicles.available') : t('vehicles.reserved')}}
|
<span>{{ vehicle.is_available ? t('vehicles.available') : t('vehicles.reserved')}}
|
||||||
<i
|
<i
|
||||||
@@ -100,7 +105,14 @@
|
|||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<p v-if="vehicle.is_available">{{ t('vehicles.availableDate') }}: <span>{{ getDateMonthDayEs(vehicle.available_date, false) }}</span></p>
|
<p v-if="vehicle.is_available">{{ t('vehicles.availableDate') }}: <span>{{ getDateMonthDayEs(vehicle.available_date, false) }}</span></p>
|
||||||
<p v-if="vehicle.active_load">{{ t('loads.loadCode') }}: <span>{{ vehicle.active_load.shipment_code}}</span></p>
|
<p v-if="vehicle.active_load">
|
||||||
|
{{ t('loads.loadCode') }}:
|
||||||
|
<span
|
||||||
|
class="code-enruta"
|
||||||
|
@click="handleTracking"
|
||||||
|
data-target="_blank"
|
||||||
|
>{{ vehicle.active_load.shipment_code?.toUpperCase() }}</span>
|
||||||
|
</p>
|
||||||
<p v-if="vehicle.active_load">{{ t('loads.loadStatus') }}: <span>{{ getStatusLoad(vehicle.active_load, locale).status}}</span></p>
|
<p v-if="vehicle.active_load">{{ t('loads.loadStatus') }}: <span>{{ getStatusLoad(vehicle.active_load, locale).status}}</span></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -165,4 +177,9 @@
|
|||||||
background-color: aqua;
|
background-color: aqua;
|
||||||
border-radius: 13px;
|
border-radius: 13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.code-enruta {
|
||||||
|
cursor: pointer;
|
||||||
|
color: rgb(107, 107, 227);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -30,7 +30,8 @@
|
|||||||
trailer_plate_2: '',
|
trailer_plate_2: '',
|
||||||
circulation_serial_number: '',
|
circulation_serial_number: '',
|
||||||
notes: '',
|
notes: '',
|
||||||
destino: '',
|
destinoCity: '',
|
||||||
|
destinoState: '',
|
||||||
}
|
}
|
||||||
|
|
||||||
const errors = ref({
|
const errors = ref({
|
||||||
@@ -39,7 +40,8 @@
|
|||||||
vehicle_number: null,
|
vehicle_number: null,
|
||||||
state: null,
|
state: null,
|
||||||
city: null,
|
city: null,
|
||||||
destino: null,
|
destinoCity: null,
|
||||||
|
destinoState: null,
|
||||||
})
|
})
|
||||||
|
|
||||||
const vehicleForm = reactive({
|
const vehicleForm = reactive({
|
||||||
@@ -50,6 +52,9 @@
|
|||||||
const vehicleStore = useVehiclesStore();
|
const vehicleStore = useVehiclesStore();
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
||||||
|
const [destinoCityName = '', destinoStateName = ''] = props.vehicle.destino?.split(';') || [];
|
||||||
|
|
||||||
if(props.vehicle) {
|
if(props.vehicle) {
|
||||||
vehicleForm.truck_type = {
|
vehicleForm.truck_type = {
|
||||||
meta_value: props.vehicle.truck_type
|
meta_value: props.vehicle.truck_type
|
||||||
@@ -62,7 +67,8 @@
|
|||||||
vehicleForm.trailer_plate_2 = props.vehicle.trailer_plate_2;
|
vehicleForm.trailer_plate_2 = props.vehicle.trailer_plate_2;
|
||||||
vehicleForm.circulation_serial_number = props.vehicle.circulation_serial_number;
|
vehicleForm.circulation_serial_number = props.vehicle.circulation_serial_number;
|
||||||
vehicleForm.notes = props.vehicle.notes;
|
vehicleForm.notes = props.vehicle.notes;
|
||||||
vehicleForm.destino = props.vehicle.destino;
|
vehicleForm.destinoCity = destinoCityName ? {city_name: destinoCityName} : '';
|
||||||
|
vehicleForm.destinoState = destinoStateName ? { state_name: destinoStateName} : '';
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -77,7 +83,7 @@
|
|||||||
const handleSaveVehicle = async() => {
|
const handleSaveVehicle = async() => {
|
||||||
validations();
|
validations();
|
||||||
|
|
||||||
if(errors.value.vehicle_number || errors.value.truck_type || errors.value.categories || errors.value.city || errors.value.state || errors.value.destino ) return;
|
if(errors.value.vehicle_number || errors.value.truck_type || errors.value.categories || errors.value.city || errors.value.state || errors.value.destinoCity || errors.value.destinoState ) return;
|
||||||
let vehicleData ={
|
let vehicleData ={
|
||||||
vehicle_number : vehicleForm.vehicle_number,
|
vehicle_number : vehicleForm.vehicle_number,
|
||||||
city : vehicleForm.city?.city_name,
|
city : vehicleForm.city?.city_name,
|
||||||
@@ -90,7 +96,7 @@
|
|||||||
company: authStore.user.company,
|
company: authStore.user.company,
|
||||||
posted_by: authStore.user._id,
|
posted_by: authStore.user._id,
|
||||||
categories: vehicleForm.categories.length <= 0 ? null : vehicleForm.categories?.map((e) => e._id),
|
categories: vehicleForm.categories.length <= 0 ? null : vehicleForm.categories?.map((e) => e._id),
|
||||||
destino: vehicleForm.destino,
|
destino: vehicleForm.destinoCity.city_name + ';' + vehicleForm.destinoState.state_name,
|
||||||
available_date: new Date()
|
available_date: new Date()
|
||||||
};
|
};
|
||||||
let localData = {};
|
let localData = {};
|
||||||
@@ -134,7 +140,8 @@
|
|||||||
vehicle_number: (!vehicleForm.vehicle_number) ? t('errors.required') : null,
|
vehicle_number: (!vehicleForm.vehicle_number) ? t('errors.required') : null,
|
||||||
state: (!vehicleForm.state) ? t('errors.state') : null,
|
state: (!vehicleForm.state) ? t('errors.state') : null,
|
||||||
city: (!vehicleForm.city) ? t('errors.city') : null,
|
city: (!vehicleForm.city) ? t('errors.city') : null,
|
||||||
destino: (!vehicleForm.destino) ? t('errors.destination') : null,
|
destinoCity: (!vehicleForm.destinoCity) ? t('errors.city') : null,
|
||||||
|
destinoState: (!vehicleForm.destinoState) ? t('errors.state') : null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -210,14 +217,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6 col-12">
|
<div class="col-lg-6 col-12 mb-4">
|
||||||
<label class="custom-label">{{ t('labels.stateBase') }}*</label>
|
<label class="custom-label">{{ t('labels.stateBase') }}*</label>
|
||||||
<States
|
<States
|
||||||
v-model="vehicleForm.state"
|
v-model="vehicleForm.state"
|
||||||
/>
|
/>
|
||||||
<span class="error-msg" v-if="errors.state">{{ errors.state }}</span>
|
<span class="error-msg" v-if="errors.state">{{ errors.state }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-12">
|
<div class="col-lg-6 col-12 mb-4">
|
||||||
<label class="custom-label">{{ t('labels.cityBase') }}*</label>
|
<label class="custom-label">{{ t('labels.cityBase') }}*</label>
|
||||||
<Cities
|
<Cities
|
||||||
v-model="vehicleForm.city"
|
v-model="vehicleForm.city"
|
||||||
@@ -225,15 +232,21 @@
|
|||||||
<span class="error-msg" v-if="errors.city">{{ errors.city }}</span>
|
<span class="error-msg" v-if="errors.city">{{ errors.city }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-12 mt-4">
|
<div class="row">
|
||||||
<CustomInput
|
<div class="col-lg-6 col-12 mb-4">
|
||||||
:label="t('loads.destination') + '*'"
|
<label class="custom-label">{{t('vehicles.destinationState')}}*</label>
|
||||||
type="text"
|
<States
|
||||||
:filled="false"
|
v-model="vehicleForm.destinoState"
|
||||||
name="destino"
|
|
||||||
:error="errors.destino"
|
|
||||||
v-model:field="vehicleForm.destino"
|
|
||||||
/>
|
/>
|
||||||
|
<span class="error-msg" v-if="errors.destinoState">{{ errors.destinoState }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 col-12 mb-4">
|
||||||
|
<label class="custom-label">{{t('vehicles.destinationCity')}}*</label>
|
||||||
|
<Cities
|
||||||
|
v-model="vehicleForm.destinoCity"
|
||||||
|
/>
|
||||||
|
<span class="error-msg" v-if="errors.destinoCity">{{ errors.destinoCity }}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex flex-column mt-4">
|
<div class="d-flex flex-column mt-4">
|
||||||
<label class="custom-label" for="notes">{{ t('vehicles.additionalInfoVehicle') }}:</label>
|
<label class="custom-label" for="notes">{{ t('vehicles.additionalInfoVehicle') }}:</label>
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
import { useCompanyStore } from '../stores/company';
|
import { useCompanyStore } from '../stores/company';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
import {getDateTime, getDateOnly } from '../helpers/date_formats';
|
||||||
|
|
||||||
|
|
||||||
const loadStore = useLoadsStore();
|
const loadStore = useLoadsStore();
|
||||||
const notyStore = useNotificationsStore();
|
const notyStore = useNotificationsStore();
|
||||||
@@ -84,6 +86,11 @@
|
|||||||
formLoad.owner = auth.user?.first_name + ' ' + auth.user?.last_name;
|
formLoad.owner = auth.user?.first_name + ' ' + auth.user?.last_name;
|
||||||
//origin_formatted_address
|
//origin_formatted_address
|
||||||
if(loadStore.currentLoad){
|
if(loadStore.currentLoad){
|
||||||
|
// console.log(loadStore.currentLoad)
|
||||||
|
const dateStart = getDateTime(loadStore.currentLoad.est_loading_date, 0);
|
||||||
|
const dateEnd = getDateTime(loadStore.currentLoad.est_unloading_date, 0);
|
||||||
|
console.log(dateStart)
|
||||||
|
console.log(dateEnd)
|
||||||
formLoad.price = loadStore.currentLoad.actual_cost;
|
formLoad.price = loadStore.currentLoad.actual_cost;
|
||||||
formLoad.segment = loadStore.currentLoad.categories?.length <= 0 ? [] : loadStore.currentLoad.categories.map(m =>{
|
formLoad.segment = loadStore.currentLoad.categories?.length <= 0 ? [] : loadStore.currentLoad.categories.map(m =>{
|
||||||
return m;
|
return m;
|
||||||
@@ -97,8 +104,10 @@
|
|||||||
formLoad.owner = loadStore.currentLoad.posted_by_name;
|
formLoad.owner = loadStore.currentLoad.posted_by_name;
|
||||||
formLoad.notes = loadStore.currentLoad.notes;
|
formLoad.notes = loadStore.currentLoad.notes;
|
||||||
formLoad.weight = loadStore.currentLoad.weight;
|
formLoad.weight = loadStore.currentLoad.weight;
|
||||||
formLoad.dateLoad = loadStore.currentLoad.est_loading_date?.substring(0, 10);
|
formLoad.dateLoad = dateStart.substring(0, 10);
|
||||||
formLoad.dateDownload = loadStore.currentLoad.est_unloading_date?.substring(0, 10);
|
formLoad.dateDownload = dateEnd.substring(0, 10);
|
||||||
|
// formLoad.dateLoad = loadStore.currentLoad.est_loading_date?.substring(0, 10);
|
||||||
|
// formLoad.dateDownload = loadStore.currentLoad.est_unloading_date?.substring(0, 10);
|
||||||
formLoad.truckType = loadStore.currentLoad.truck_type ? {meta_value: loadStore.currentLoad.truck_type} : null;
|
formLoad.truckType = loadStore.currentLoad.truck_type ? {meta_value: loadStore.currentLoad.truck_type} : null;
|
||||||
|
|
||||||
origin.locationName = loadStore.currentLoad.origin.company_name;
|
origin.locationName = loadStore.currentLoad.origin.company_name;
|
||||||
@@ -179,12 +188,6 @@
|
|||||||
if(originCoords.value && destinationCoords.value) {
|
if(originCoords.value && destinationCoords.value) {
|
||||||
polylines.value = await getDirections(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);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -221,11 +224,17 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
const setLoadData = () => {
|
const setLoadData = () => {
|
||||||
|
const currentDate = new Date();
|
||||||
|
const hours = currentDate.getHours().toString().padStart(2, '0');
|
||||||
|
const minutes = currentDate.getMinutes().toString().padStart(2, '0');
|
||||||
|
const seconds = currentDate.getSeconds().toString().padStart(2, '0');
|
||||||
|
const startDate = formLoad.dateLoad === "" ? "" : new Date(`${formLoad.dateLoad}T${hours}:${minutes}:${seconds}`).toISOString();
|
||||||
|
const endDate = formLoad.dateDownload === "" ? "" : new Date(`${formLoad.dateDownload}T${hours}:${minutes}:${seconds}`).toISOString();
|
||||||
let loadData = {
|
let loadData = {
|
||||||
actual_cost: formLoad.price,
|
actual_cost: formLoad.price,
|
||||||
truck_type: formLoad.truckType?.meta_value || null,
|
truck_type: formLoad.truckType?.meta_value || null,
|
||||||
est_loading_date : formLoad.dateLoad,
|
est_loading_date : startDate,
|
||||||
est_unloading_date : formLoad.dateDownload,
|
est_unloading_date : endDate,
|
||||||
notes : formLoad.notes,
|
notes : formLoad.notes,
|
||||||
weight : formLoad.weight,
|
weight : formLoad.weight,
|
||||||
product: formLoad.terms?.length <= 0 ? null : formLoad.terms,
|
product: formLoad.terms?.length <= 0 ? null : formLoad.terms,
|
||||||
@@ -286,7 +295,7 @@
|
|||||||
...loadData,
|
...loadData,
|
||||||
categories: [loadData.categories]
|
categories: [loadData.categories]
|
||||||
}
|
}
|
||||||
loadStore.loads.push(load);
|
loadStore.loads.unshift(load);
|
||||||
return 'success';
|
return 'success';
|
||||||
} else {
|
} else {
|
||||||
return 'error';
|
return 'error';
|
||||||
|
|||||||
@@ -21,9 +21,14 @@
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
statusSelected.value = props.vehicle.is_available === true ? 'Availiable' : 'Booked'
|
statusSelected.value = props.vehicle.is_available === true ? 'Availiable' : 'Booked'
|
||||||
formAvailiable.state = {state_name: props.vehicle.state};
|
|
||||||
formAvailiable.destino = props.vehicle.destino;
|
const [destinoCityName = '', destinoStateName = ''] = props.vehicle.destino?.split(';') || [];
|
||||||
formAvailiable.city = {city_name: props.vehicle.city};
|
const [availableCityName = '', availableStateName = ''] = props.vehicle.available_in?.split(';') || [];
|
||||||
|
|
||||||
|
formAvailiable.destinoCity = destinoCityName ? { city_name: destinoCityName } : '';
|
||||||
|
formAvailiable.destinoState = destinoStateName ? { state_name: destinoStateName } : '';
|
||||||
|
formAvailiable.availableCity = availableCityName ? { city_name: availableCityName } : '';
|
||||||
|
formAvailiable.availableState = availableStateName ? { state_name: availableStateName } : '';
|
||||||
formAvailiable.available_date = props.vehicle.available_date?.substring(0, 10);
|
formAvailiable.available_date = props.vehicle.available_date?.substring(0, 10);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -33,15 +38,17 @@
|
|||||||
|
|
||||||
const formAvailiable = reactive({
|
const formAvailiable = reactive({
|
||||||
available_date: new Date(),
|
available_date: new Date(),
|
||||||
destino: '',
|
availableCity: '',
|
||||||
city : '',
|
availableState: '',
|
||||||
state : '',
|
destinoCity: '',
|
||||||
|
destinoState: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
const errors = ref({
|
const errors = ref({
|
||||||
destino: null,
|
destinoState: null,
|
||||||
city : null,
|
destinoCity: null,
|
||||||
state : null,
|
availableState : null,
|
||||||
|
availableCity : null,
|
||||||
})
|
})
|
||||||
|
|
||||||
const handleSetStatusVehicle = async() => {
|
const handleSetStatusVehicle = async() => {
|
||||||
@@ -50,14 +57,14 @@
|
|||||||
if(statusSelected.value === 'Availiable') {
|
if(statusSelected.value === 'Availiable') {
|
||||||
// console.log('check validations');
|
// console.log('check validations');
|
||||||
validations();
|
validations();
|
||||||
if(errors.value.city || errors.value.state || errors.value.destino ) return;
|
if(errors.value.availableCity || errors.value.availableState || errors.value.destinoCity || errors.value.destinoState ) return;
|
||||||
vehicleData = {
|
vehicleData = {
|
||||||
available_date : formAvailiable.available_date,
|
available_date : formAvailiable.available_date,
|
||||||
destino: formAvailiable.destino,
|
destino: formAvailiable.destinoCity.city_name + ';' + formAvailiable.destinoState.state_name,
|
||||||
city : formAvailiable.city.city_name,
|
available_in: formAvailiable.availableCity.city_name + ';' + formAvailiable.availableState.state_name,
|
||||||
state : formAvailiable.state.state_name,
|
|
||||||
is_available : true
|
is_available : true
|
||||||
}
|
}
|
||||||
|
console.log(vehicleData);
|
||||||
} else {
|
} else {
|
||||||
vehicleData = {
|
vehicleData = {
|
||||||
available_date : null,
|
available_date : null,
|
||||||
@@ -87,9 +94,10 @@
|
|||||||
|
|
||||||
const validations = () => {
|
const validations = () => {
|
||||||
errors.value = {
|
errors.value = {
|
||||||
state: (!formAvailiable.state) ? t('errors.state') : null,
|
destinoState: (formAvailiable.destinoState === null || formAvailiable.destinoState === '') ? t('errors.state') : null,
|
||||||
city: (!formAvailiable.city) ? t('errors.city') : null,
|
destinoCity: (formAvailiable.destinoCity === null || formAvailiable.destinoCity === '') ? t('errors.city') : null,
|
||||||
destino: (!formAvailiable.destino) ? t('errors.destination') : null,
|
availableState: (!formAvailiable.availableState) ? t('errors.state') : null,
|
||||||
|
availableCity: (!formAvailiable.availableCity) ? t('errors.city') : null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,34 +141,44 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="statusSelected === 'Availiable'">
|
<div v-if="statusSelected === 'Availiable'">
|
||||||
<CustomInput
|
<CustomInput
|
||||||
:label="t('loads.dateLoad') + '*'"
|
:label="t('vehicles.availableDate') + '*'"
|
||||||
type="date"
|
type="date"
|
||||||
:filled="false"
|
:filled="false"
|
||||||
name="date-load"
|
name="date-load"
|
||||||
v-model:field="formAvailiable.available_date"
|
v-model:field="formAvailiable.available_date"
|
||||||
/>
|
/>
|
||||||
|
<p>Disponible en:</p>
|
||||||
<div class="mb-4 mt-3">
|
<div class="mb-4 mt-3">
|
||||||
<label class="custom-label">{{ t('labels.stateBase') }}</label>
|
<label class="custom-label">{{ t('global.state') }}</label>
|
||||||
<States
|
<States
|
||||||
v-model="formAvailiable.state"
|
v-model="formAvailiable.availableState"
|
||||||
/>
|
/>
|
||||||
<span class="error-msg" v-if="errors.state">{{ errors.state }}</span>
|
<span class="error-msg" v-if="errors.availableState">{{ errors.availableState }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-4 mt-3">
|
<div class="mb-4 mt-3">
|
||||||
<label class="custom-label">{{ t('labels.cityBase') }}</label>
|
<label class="custom-label">{{ t('global.city') }}</label>
|
||||||
<Cities
|
<Cities
|
||||||
v-model="formAvailiable.city"
|
v-model="formAvailiable.availableCity"
|
||||||
/>
|
/>
|
||||||
<span class="error-msg" v-if="errors.city">{{ errors.city }}</span>
|
<span class="error-msg" v-if="errors.availableCity">{{ errors.availableCity }}</span>
|
||||||
</div>
|
</div>
|
||||||
<CustomInput
|
<p>Destino:</p>
|
||||||
:label="t('vehicles.availableIn') + '*'"
|
<div class="mb-4 mt-3">
|
||||||
type="text"
|
<label class="custom-label">{{ t('global.state') }}</label>
|
||||||
:filled="false"
|
<States
|
||||||
name="destino"
|
key="destinoState"
|
||||||
v-model:field="formAvailiable.destino"
|
v-model="formAvailiable.destinoState"
|
||||||
:error="errors.destino"
|
|
||||||
/>
|
/>
|
||||||
|
<span class="error-msg" v-if="errors.destinoState">{{ errors.destinoState }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="mb-4 mt-3">
|
||||||
|
<label class="custom-label">{{ t('global.city') }}</label>
|
||||||
|
<Cities
|
||||||
|
key="destinoCity"
|
||||||
|
v-model="formAvailiable.destinoCity"
|
||||||
|
/>
|
||||||
|
<span class="error-msg" v-if="errors.destinoCity">{{ errors.destinoCity }}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-4 text-center">
|
<div class="mt-4 text-center">
|
||||||
<Spiner v-if="loading === true"/>
|
<Spiner v-if="loading === true"/>
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ import { useI18n } from 'vue-i18n';
|
|||||||
<!-- <h2 class="my-3">Información del vehiculo</h2> -->
|
<!-- <h2 class="my-3">Información del vehiculo</h2> -->
|
||||||
<div class="row my-2">
|
<div class="row my-2">
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<p>{{ t('labels.codeId') }}: <span>{{ vehicle.vehicle_code }}</span></p>
|
<p>{{ t('labels.codeId') }}: <span>{{ vehicle.vehicle_code.toUpperCase() }}</span></p>
|
||||||
<p>{{ t('directory.typeTruck') }}: <span>{{ vehicle.truck_type }}</span></p>
|
<p>{{ t('directory.typeTruck') }}: <span>{{ vehicle.truck_type }}</span></p>
|
||||||
<p>{{ t('vehicles.serialNumber') }}: <span>{{ vehicle.vehicle_number }}</span></p>
|
<p>{{ t('vehicles.assignedDriver') }}: <span>{{ vehicle.driver.first_name + ' ' + vehicle.driver.last_name }}</span></p>
|
||||||
<p>{{ t('global.segment') }}: <span>{{ vehicle._categories }}</span></p>
|
<p>{{ t('global.segment') }}: <span>{{ vehicle._categories }}</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ export const getDateMonthDay = (value) => {
|
|||||||
|
|
||||||
export const getDateMonthDayEs = (value, isFull = false) => {
|
export const getDateMonthDayEs = (value, isFull = false) => {
|
||||||
const date = new Date(value)
|
const date = new Date(value)
|
||||||
|
// date.setHours(date.getHours());
|
||||||
let month = '';
|
let month = '';
|
||||||
if(isFull) {
|
if(isFull) {
|
||||||
month = months[date.getMonth()];
|
month = months[date.getMonth()];
|
||||||
@@ -75,10 +76,10 @@ export const getDateTime = (value, hour) => {
|
|||||||
|
|
||||||
// Obtener los componentes de la fecha
|
// Obtener los componentes de la fecha
|
||||||
const year = date.getFullYear();
|
const year = date.getFullYear();
|
||||||
const month = ('0' + (date.getMonth() + 1)).slice(-2); // Agrega cero al principio si es necesario
|
const month = ('0' + (date.getMonth() + 1)).slice(-2);
|
||||||
const day = ('0' + date.getDate()).slice(-2); // Agrega cero al principio si es necesario
|
const day = ('0' + date.getDate()).slice(-2);
|
||||||
const hours = ('0' + date.getHours()).slice(-2); // Agrega cero al principio si es necesario
|
const hours = ('0' + date.getHours()).slice(-2);
|
||||||
const minutes = ('0' + date.getMinutes()).slice(-2); // Agrega cero al principio si es necesario
|
const minutes = ('0' + date.getMinutes()).slice(-2);
|
||||||
|
|
||||||
// Crear la cadena de fecha formateada
|
// Crear la cadena de fecha formateada
|
||||||
const dateFormat = `${year}-${month}-${day} ${hours}:${minutes}`;
|
const dateFormat = `${year}-${month}-${day} ${hours}:${minutes}`;
|
||||||
@@ -86,6 +87,21 @@ export const getDateTime = (value, hour) => {
|
|||||||
return dateFormat;
|
return dateFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const getDateOnly = (value) => {
|
||||||
|
|
||||||
|
const date = new Date(value);
|
||||||
|
date.setHours(date.getHours());
|
||||||
|
|
||||||
|
// Obtener los componentes de la fecha
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = ('0' + (date.getMonth() + 1)).slice(-2);
|
||||||
|
const day = ('0' + date.getDate()).slice(-2);
|
||||||
|
|
||||||
|
const dateFormat = `${day}/${month}/${year}`;
|
||||||
|
|
||||||
|
return dateFormat;
|
||||||
|
}
|
||||||
|
|
||||||
export const formatOnlyDate = (date) => {
|
export const formatOnlyDate = (date) => {
|
||||||
const year = date.getFullYear();
|
const year = date.getFullYear();
|
||||||
const month = String(date.getMonth() + 1).padStart(2, '0'); // Agregar cero si es necesario
|
const month = String(date.getMonth() + 1).padStart(2, '0'); // Agregar cero si es necesario
|
||||||
|
|||||||
@@ -258,6 +258,7 @@ const en = {
|
|||||||
loads: {
|
loads: {
|
||||||
title: 'My published loads',
|
title: 'My published loads',
|
||||||
history: 'History',
|
history: 'History',
|
||||||
|
company: 'Publishing company',
|
||||||
querySearch: 'Name of person who posted',
|
querySearch: 'Name of person who posted',
|
||||||
empty: 'No loads added',
|
empty: 'No loads added',
|
||||||
origin: 'Origin',
|
origin: 'Origin',
|
||||||
@@ -363,6 +364,8 @@ const en = {
|
|||||||
reserved: 'Reserved',
|
reserved: 'Reserved',
|
||||||
availableDate: 'Available date',
|
availableDate: 'Available date',
|
||||||
segments: 'Transportation segment',
|
segments: 'Transportation segment',
|
||||||
|
destinationState: 'Destination state',
|
||||||
|
destinationCity: 'Destination city',
|
||||||
|
|
||||||
titleDel: 'Delete vehicle',
|
titleDel: 'Delete vehicle',
|
||||||
textDel: 'Are you sure to delete this vehicle?',
|
textDel: 'Are you sure to delete this vehicle?',
|
||||||
|
|||||||
@@ -263,6 +263,7 @@ const es = {
|
|||||||
loads: {
|
loads: {
|
||||||
title: 'Mis cargas publicadas',
|
title: 'Mis cargas publicadas',
|
||||||
history: 'Historial',
|
history: 'Historial',
|
||||||
|
company: 'Empresa que publica',
|
||||||
querySearch: 'Nombre de la persona quien publica',
|
querySearch: 'Nombre de la persona quien publica',
|
||||||
empty: 'No hay cargas agregadas',
|
empty: 'No hay cargas agregadas',
|
||||||
origin: 'Origen',
|
origin: 'Origen',
|
||||||
@@ -369,6 +370,8 @@ const es = {
|
|||||||
reserved: 'Reservado',
|
reserved: 'Reservado',
|
||||||
availableDate: 'Fecha disponible',
|
availableDate: 'Fecha disponible',
|
||||||
segments: 'Segmento del transporte',
|
segments: 'Segmento del transporte',
|
||||||
|
destinationState: 'Estado de destino',
|
||||||
|
destinationCity: 'Ciudad de destino',
|
||||||
|
|
||||||
titleDel: 'Eliminar vehiculo',
|
titleDel: 'Eliminar vehiculo',
|
||||||
textDel: '¿Estás seguro de eliminar este vehiculo?',
|
textDel: '¿Estás seguro de eliminar este vehiculo?',
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ export const useCompanyStore = defineStore('company', () => {
|
|||||||
try {
|
try {
|
||||||
if(proposals.value.length <= 0 || reload) {
|
if(proposals.value.length <= 0 || reload) {
|
||||||
const endpoint = `/v1/proposals/find?carrier=${companyId}&${filter}&$sort%5BcreatedAt%5D=-1`;
|
const endpoint = `/v1/proposals/find?carrier=${companyId}&${filter}&$sort%5BcreatedAt%5D=-1`;
|
||||||
// console.log(endpoint)
|
console.log(endpoint)
|
||||||
const {data} = await api.get(endpoint);
|
const {data} = await api.get(endpoint);
|
||||||
proposals.value = data.data;
|
proposals.value = data.data;
|
||||||
proposalsTotal.value = data.total;
|
proposalsTotal.value = data.total;
|
||||||
|
|||||||
@@ -75,7 +75,6 @@
|
|||||||
startDate.value = formatOnlyDate(startDateTemp);
|
startDate.value = formatOnlyDate(startDateTemp);
|
||||||
endDate.value = formatOnlyDate(endDateTemp);
|
endDate.value = formatOnlyDate(endDateTemp);
|
||||||
await getCalendarDate(startDate.value, endDate.value, 0);
|
await getCalendarDate(startDate.value, endDate.value, 0);
|
||||||
console.log(loads.value)
|
|
||||||
optionsFilter.value = [
|
optionsFilter.value = [
|
||||||
{value: 'general',label: t('calendar.general')},
|
{value: 'general',label: t('calendar.general')},
|
||||||
{value: 'my',label: t('calendar.my')},
|
{value: 'my',label: t('calendar.my')},
|
||||||
@@ -101,27 +100,23 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleUpdatedPeriod = async(ev) => {
|
const handleUpdatedPeriod = async(ev) => {
|
||||||
// console.log(ev);
|
|
||||||
const global = filter.value.value === 'general' ? 1 : 0;
|
const global = filter.value.value === 'general' ? 1 : 0;
|
||||||
startDate.value = formatOnlyDate(ev.start)
|
startDate.value = formatOnlyDate(ev.start)
|
||||||
endDate.value = formatOnlyDate(ev.end)
|
endDate.value = formatOnlyDate(ev.end)
|
||||||
console.log(startDate.value, endDate.value);
|
|
||||||
await getCalendarDate(startDate.value, endDate.value, global);
|
await getCalendarDate(startDate.value, endDate.value, global);
|
||||||
console.log('LOADS: ', loads.value)
|
|
||||||
mapLoadsToEvents()
|
mapLoadsToEvents()
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapLoadsToEvents = () => {
|
const mapLoadsToEvents = () => {
|
||||||
events.value = [];
|
events.value = [];
|
||||||
|
console.log(loads.value)
|
||||||
loads.value.forEach((e) => {
|
loads.value.forEach((e) => {
|
||||||
const indicator = eventStatusLoad(e.load_status);
|
const indicator = eventStatusLoad(e.load_status);
|
||||||
const dateStart = getDateTime(e.est_loading_date, 0);
|
const dateStart = getDateTime(e.est_loading_date, 0);
|
||||||
const dateEnd = getDateTime(e.est_loading_date, 1);
|
const dateEnd = getDateTime(e.est_loading_date, 1);
|
||||||
// console.log('dateStart', dateStart)
|
|
||||||
// console.log('dateEnd', dateEnd)
|
|
||||||
events.value.push({
|
events.value.push({
|
||||||
id: e._id,
|
id: e._id,
|
||||||
title: e.shipment_code,
|
title: e.shipment_code.toUpperCase(),
|
||||||
with: indicator.status,
|
with: indicator.status,
|
||||||
start: e.est_loading_date,
|
start: e.est_loading_date,
|
||||||
end: e.est_unloading_date,
|
end: e.est_unloading_date,
|
||||||
@@ -134,7 +129,6 @@
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log(events.value);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user