0
0
Fork 0
This commit is contained in:
Alexandre Riera 2023-04-26 12:04:55 +02:00
parent 7b57568d8e
commit 554c09155f
4 changed files with 113 additions and 114 deletions

View File

@ -70,7 +70,7 @@ async function saveDarkMode(value) {
} }
async function saveLanguage(value) { async function saveLanguage(value) {
const query = `/Accounts/${user.value.id}`; const query = `/VnUsers/${user.value.id}`;
await axios.patch(query, { await axios.patch(query, {
lang: value, lang: value,
}); });

View File

@ -5,7 +5,7 @@ export function useRole() {
const state = useState(); const state = useState();
async function fetch() { async function fetch() {
const { data } = await axios.get('Accounts/acl'); const { data } = await axios.get('VnUsers/acl');
const roles = data.roles.map((userRoles) => userRoles.role.name); const roles = data.roles.map((userRoles) => userRoles.role.name);
const userData = { const userData = {

View File

@ -27,16 +27,20 @@ const time = ref({
}); });
async function fetch() { async function fetch() {
const filter = { try {
where: { const filter = {
ticketFk: entityId.value, where: {
}, ticketFk: entityId.value,
}; },
const { data } = await axios.get(`/Expeditions/filter`, { };
params: { filter }, const { data } = await axios.get(`/Expeditions/filter`, {
}); params: { filter },
});
if (data) expeditions.value = data; if (data) expeditions.value = data;
} catch (e) {
//
}
} }
async function getVideoList(expeditionId, timed) { async function getVideoList(expeditionId, timed) {
@ -46,115 +50,110 @@ async function getVideoList(expeditionId, timed) {
}; };
if (timed) { if (timed) {
if (timed.max == timed.min) {
if (timed.max != 24) timed.max += 1;
else timed.min -= 1;
}
Object.assign(params, { from: timed.min, to: timed.max }); Object.assign(params, { from: timed.min, to: timed.max });
} }
const { data } = await axios.get(`/Boxings/getVideoList`, { params: params }); await axios.get(`/Boxings/getVideoList`, { params: params }).then((res) => {
const data = res.data;
if (!data.length) {
return quasar.notify({
message: t('ticket.boxing.notFound'),
type: 'negative',
});
}
const list = [];
for (const video of data) {
const videoName = video.split('.')[0].split('T')[1].replace(/-/g, ':');
list.push({
label: videoName,
value: video,
url: `api/Boxings/getVideo?id=${expeditionId}&filename=${video}`,
});
}
const list = []; videoList.value = list.reverse();
for (const video of data) { if (list[0]) {
const videName = video.split('.')[0].split('T')[1].replaceAll('-', ':'); slide.value = list[0].value;
list.push({ time.value = {
label: videName, min: parseInt(list[0].label.split(':')[0]),
value: video, max: parseInt(list[list.length - 1].label.split(':')[0]) + 1,
url: `api/Boxings/getVideo?id=${expeditionId}&filename=${video}`, };
}); }
} });
videoList.value = list.reverse();
if (list[0]) {
slide.value = list[0].value;
time.value = {
min: parseInt(list[0].label.split(':')[0]),
max: parseInt(list[list.length - 1].label.split(':')[0]),
};
}
if (!data.length) {
return quasar.notify({
message: t('ticket.boxing.notFound'),
type: 'negative',
});
}
} }
</script> </script>
<template> <template>
<teleport to=".q-layout"> <QDrawer show-if-above side="right">
<QDrawer show-if-above side="right"> <QScrollArea class="fit">
<QScrollArea class="fit"> <QList bordered separator style="max-width: 318px">
<QList bordered separator style="max-width: 318px"> <QItem v-if="lastExpedition && videoList.length">
<QItem v-if="lastExpedition && videoList.length"> <QItemSection>
<QItemSection> <QItemLabel class="text-h6">
<QItemLabel class="text-h6"> {{ t('ticket.boxing.selectTime') }} ({{ time.min }}-{{
{{ t('ticket.boxing.selectTime') }} ({{ time.min }}-{{ time.max
time.max }})
}}) </QItemLabel>
</QItemLabel> <QRange
<QRange v-model="time"
v-model="time" @change="getVideoList(lastExpedition, time)"
@change="getVideoList(lastExpedition, time)" :min="0"
:min="0" :max="24"
:max="24" :step="1"
:step="1" :left-label-value="time.min + ':00'"
:left-label-value="time.min + ':00'" :right-label-value="time.max + ':00'"
:right-label-value="time.max + ':00'" label
label markers
markers snap
snap color="orange"
color="orange" />
/> </QItemSection>
</QItemSection> </QItem>
</QItem> <QItem v-if="lastExpedition && videoList.length">
<QItem v-if="lastExpedition && videoList.length"> <QItemSection>
<QItemSection> <QSelect
<QSelect color="orange"
color="orange" v-model="slide"
v-model="slide" :options="videoList"
:options="videoList" :label="t('ticket.boxing.selectVideo')"
:label="t('ticket.boxing.selectVideo')" emit-value
emit-value map-options
map-options >
> <template #prepend>
<template #prepend> <QIcon name="schedule" />
<QIcon name="schedule" /> </template>
</template> </QSelect>
</QSelect> </QItemSection>
</QItemSection> </QItem>
</QItem> <QItem
<QItem v-for="expedition in expeditions"
v-for="expedition in expeditions" :key="expedition.id"
:key="expedition.id" @click="getVideoList(expedition.id)"
@click="getVideoList(expedition.id)" clickable
clickable v-ripple
v-ripple >
> <QItemSection>
<QItemSection> <QItemLabel class="text-h6">#{{ expedition.id }}</QItemLabel>
<QItemLabel class="text-h6">#{{ expedition.id }}</QItemLabel> </QItemSection>
</QItemSection> <QItemSection>
<QItemSection> <QItemLabel caption>{{ t('ticket.boxing.created') }}</QItemLabel>
<QItemLabel caption>{{ <QItemLabel>
t('ticket.boxing.created') {{
}}</QItemLabel> date.formatDate(expedition.created, 'YYYY-MM-DD HH:mm:ss')
<QItemLabel> }}
{{ </QItemLabel>
date.formatDate( <QItemLabel caption>{{ t('ticket.boxing.item') }}</QItemLabel>
expedition.created, <QItemLabel>{{ expedition.packagingItemFk }}</QItemLabel>
'YYYY-MM-DD HH:mm:ss' <QItemLabel caption>{{ t('ticket.boxing.worker') }}</QItemLabel>
) <QItemLabel>{{ expedition.userName }}</QItemLabel>
}} </QItemSection>
</QItemLabel> </QItem>
<QItemLabel caption>{{ t('ticket.boxing.item') }}</QItemLabel> </QList>
<QItemLabel>{{ expedition.packagingItemFk }}</QItemLabel> </QScrollArea>
<QItemLabel caption>{{ </QDrawer>
t('ticket.boxing.worker')
}}</QItemLabel>
<QItemLabel>{{ expedition.userName }}</QItemLabel>
</QItemSection>
</QItem>
</QList>
</QScrollArea>
</QDrawer>
</teleport>
<QCard> <QCard>
<QCarousel animated v-model="slide" height="max-content"> <QCarousel animated v-model="slide" height="max-content">

View File

@ -4,7 +4,7 @@ import TicketBoxing from 'pages/Ticket/Card/TicketBoxing.vue';
// #4836 - Investigate how to test q-drawer outside // #4836 - Investigate how to test q-drawer outside
// q-layout or how to teleport q-drawer inside // q-layout or how to teleport q-drawer inside
describe.skip('TicketBoxing', () => { describe('TicketBoxing', () => {
let vm; let vm;
beforeAll(() => { beforeAll(() => {
vm = createWrapper(TicketBoxing).vm; vm = createWrapper(TicketBoxing).vm;