fixes: vehicles & offers

This commit is contained in:
Alexandro Uc Santos
2024-07-29 13:39:57 -06:00
parent d9a0cd626f
commit 0870d96f73
9 changed files with 101 additions and 51 deletions

View File

@@ -7,14 +7,16 @@
import { useI18n } from 'vue-i18n';
import useCalendar from '../composables/useCalendar';
import CustomPopup from '../components/CustomPopup.vue';
import { watch } from 'vue';
import { watch } from 'vue';
const events = ref([]);
const router = useRouter();
const { t, locale } = useI18n()
const { getCalendarDate, loading, loads } = useCalendar()
const filter = ref({value: 'general', label: t('calendar.general')})
const filter = ref({value: 'my', label: t('calendar.my')})
const startDate = ref('');
const endDate = ref('');
const optionsFilter = ref([])
const openPopup = ref(false);
@@ -33,13 +35,25 @@ import { watch } from 'vue';
style: {
fontFamily: 'Nunito',
colorSchemes: {
meetings: {
published: {
color: "#fff",
backgroundColor: "#131313",
backgroundColor: "#A9B0B2",
},
sports: {
loading: {
color: "#fff",
backgroundColor: "#ff4081",
backgroundColor: "#F44336",
},
transit: {
color: "#ffd22b",
backgroundColor: "#ffd22b",
},
downloading: {
color: "#fff",
backgroundColor: "#428502",
},
delivered: {
color: "#fff",
backgroundColor: "#1B70AF",
},
},
},
@@ -56,10 +70,12 @@ import { watch } from 'vue';
const year = currentDate.getFullYear();
const month = currentDate.getMonth();
const startDate = new Date(year, month, 1);
const endDate = new Date(year, month + 1, 0);
await getCalendarDate(formatOnlyDate(startDate), formatOnlyDate(endDate));
// console.log(loads.value)
const startDateTemp = new Date(year, month, 1);
const endDateTemp = new Date(year, month + 1, 0);
startDate.value = formatOnlyDate(startDateTemp);
endDate.value = formatOnlyDate(endDateTemp);
await getCalendarDate(startDate.value, endDate.value, 0);
console.log(loads.value)
optionsFilter.value = [
{value: 'general',label: t('calendar.general')},
{value: 'my',label: t('calendar.my')},
@@ -79,20 +95,18 @@ import { watch } from 'vue';
})
const handleUpdateMode = (ev) => {
console.log(ev)
console.log('clic en el calendario');
}
const handleClickDate = (ev) => {
console.log(ev);
console.log('clic en la fecha');
}
const handleUpdatedPeriod = async(ev) => {
console.log(ev);
const start = formatOnlyDate(ev.start)
const end = formatOnlyDate(ev.end)
await getCalendarDate(start, end);
// console.log(ev);
const global = filter.value.value === 'general' ? 1 : 0;
startDate.value = formatOnlyDate(ev.start)
endDate.value = formatOnlyDate(ev.end)
console.log(startDate.value, endDate.value);
await getCalendarDate(startDate.value, endDate.value, global);
console.log('LOADS: ', loads.value)
mapLoadsToEvents()
}
@@ -101,21 +115,26 @@ import { watch } from 'vue';
events.value = [];
loads.value.forEach((e) => {
const indicator = eventStatusLoad(e.load_status);
const dateStart = getDateTime(e.load_status_updated, 0);
const dateEnd = getDateTime(e.load_status_updated, 1);
const dateStart = getDateTime(e.est_loading_date, 0);
const dateEnd = getDateTime(e.est_loading_date, 1);
// console.log('dateStart', dateStart)
// console.log('dateEnd', dateEnd)
events.value.push({
id: e._id,
title: e.shipment_code,
with: indicator.status,
start: e.est_loading_date,
end: e.est_unloading_date,
description: indicator.load_status,
colorScheme: e.load_status.toLowerCase(),
color: indicator.color,
time: {
start: dateStart,
end: dateEnd
}
},
})
console.log(events.value);
});
}
@@ -124,9 +143,12 @@ import { watch } from 'vue';
openPopup.value = false
}
const selectedFilter = (type) => {
const selectedFilter = async (type) => {
filter.value = type
const global = type.value === 'general' ? 1 : 0;
openPopup.value = false
await getCalendarDate(startDate.value, endDate.value, global);
mapLoadsToEvents()
}
</script>
@@ -149,11 +171,11 @@ import { watch } from 'vue';
<h2>{{ t('calendar.helpText') }}</h2>
<div class="header">
<div class="indicators">
<span><i class="fa-solid fa-circle" style="color: yellow"></i> {{ t('global.published') }}</span>
<span><i class="fa-solid fa-circle" style="color: green"></i> {{ t('global.loading') }}</span>
<span><i class="fa-solid fa-circle" style="color: red"></i> {{ t('global.transit') }}</span>
<span><i class="fa-solid fa-circle" style="color: blue"></i> {{ t('global.downloading') }}</span>
<span><i class="fa-solid fa-circle" style="color: blue"></i> {{ t('global.delivered') }}</span>
<span><i class="fa-solid fa-circle" style="color: #A9B0B2"></i> {{ t('global.published') }}</span>
<span><i class="fa-solid fa-circle" style="color: #F44336"></i> {{ t('global.loading') }}</span>
<span><i class="fa-solid fa-circle" style="color: #ffd22b"></i> {{ t('global.transit') }}</span>
<span><i class="fa-solid fa-circle" style="color: #428502"></i> {{ t('global.downloading') }}</span>
<span><i class="fa-solid fa-circle" style="color: #1B70AF"></i> {{ t('global.delivered') }}</span>
</div>
<div class="box-filter"
@click="openPopup = true"