Merge pull request 'fixes #5255 Revisar ticket/boxing' (!49) from 5255-revisar-ticketBoxing into dev
gitea/salix-front/pipeline/head This commit looks good
Details
gitea/salix-front/pipeline/head This commit looks good
Details
Reviewed-on: #49 Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
commit
b674bc4d41
|
@ -58,9 +58,12 @@ const onResponseError = (error) => {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session.isLoggedIn && response.status === 401) {
|
if (session.isLoggedIn() && response.status === 401) {
|
||||||
session.destroy();
|
session.destroy();
|
||||||
Router.push({ path: '/login' });
|
Router.push({ path: '/login' });
|
||||||
|
} else if(!session.isLoggedIn())
|
||||||
|
{
|
||||||
|
message = 'login.loginError';
|
||||||
}
|
}
|
||||||
|
|
||||||
Notify.create({
|
Notify.create({
|
||||||
|
|
|
@ -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,
|
||||||
});
|
});
|
||||||
|
|
|
@ -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 = {
|
||||||
|
|
|
@ -48,6 +48,7 @@ const password = ref('');
|
||||||
const keepLogin = ref(true);
|
const keepLogin = ref(true);
|
||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
|
try {
|
||||||
const { data } = await axios.post('Accounts/login', {
|
const { data } = await axios.post('Accounts/login', {
|
||||||
user: username.value,
|
user: username.value,
|
||||||
password: password.value,
|
password: password.value,
|
||||||
|
@ -68,6 +69,9 @@ async function onSubmit() {
|
||||||
} else {
|
} else {
|
||||||
router.push({ name: 'Dashboard' });
|
router.push({ name: 'Dashboard' });
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
//
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import { computed, ref, onMounted } from 'vue';
|
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { date, useQuasar } from 'quasar';
|
import { date, useQuasar } from 'quasar';
|
||||||
|
import { computed, onMounted, reactive, ref } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -21,12 +21,12 @@ const expeditions = ref({});
|
||||||
const lastExpedition = ref();
|
const lastExpedition = ref();
|
||||||
const slide = ref(null);
|
const slide = ref(null);
|
||||||
const videoList = ref([]);
|
const videoList = ref([]);
|
||||||
const time = ref({
|
const time = reactive({
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 24,
|
max: 24,
|
||||||
});
|
});
|
||||||
|
|
||||||
async function fetch() {
|
async function fetch() {
|
||||||
|
try {
|
||||||
const filter = {
|
const filter = {
|
||||||
where: {
|
where: {
|
||||||
ticketFk: entityId.value,
|
ticketFk: entityId.value,
|
||||||
|
@ -37,6 +37,9 @@ async function fetch() {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (data) expeditions.value = data;
|
if (data) expeditions.value = data;
|
||||||
|
} catch (e) {
|
||||||
|
//
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getVideoList(expeditionId, timed) {
|
async function getVideoList(expeditionId, timed) {
|
||||||
|
@ -46,15 +49,25 @@ 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 = [];
|
const list = [];
|
||||||
for (const video of data) {
|
for (const video of data) {
|
||||||
const videName = video.split('.')[0].split('T')[1].replaceAll('-', ':');
|
const videoName = video.split('.')[0].split('T')[1].replace(/-/g, ':');
|
||||||
list.push({
|
list.push({
|
||||||
label: videName,
|
label: videoName,
|
||||||
value: video,
|
value: video,
|
||||||
url: `api/Boxings/getVideo?id=${expeditionId}&filename=${video}`,
|
url: `api/Boxings/getVideo?id=${expeditionId}&filename=${video}`,
|
||||||
});
|
});
|
||||||
|
@ -63,23 +76,14 @@ async function getVideoList(expeditionId, timed) {
|
||||||
videoList.value = list.reverse();
|
videoList.value = list.reverse();
|
||||||
if (list[0]) {
|
if (list[0]) {
|
||||||
slide.value = list[0].value;
|
slide.value = list[0].value;
|
||||||
time.value = {
|
time.min = parseInt(list[0].label.split(':')[0]);
|
||||||
min: parseInt(list[0].label.split(':')[0]),
|
time.max = parseInt(list[list.length - 1].label.split(':')[0]) + 1;
|
||||||
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">
|
||||||
|
@ -132,29 +136,21 @@ async function getVideoList(expeditionId, timed) {
|
||||||
<QItemLabel class="text-h6">#{{ expedition.id }}</QItemLabel>
|
<QItemLabel class="text-h6">#{{ expedition.id }}</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel caption>{{
|
<QItemLabel caption>{{ t('ticket.boxing.created') }}</QItemLabel>
|
||||||
t('ticket.boxing.created')
|
|
||||||
}}</QItemLabel>
|
|
||||||
<QItemLabel>
|
<QItemLabel>
|
||||||
{{
|
{{
|
||||||
date.formatDate(
|
date.formatDate(expedition.created, 'YYYY-MM-DD HH:mm:ss')
|
||||||
expedition.created,
|
|
||||||
'YYYY-MM-DD HH:mm:ss'
|
|
||||||
)
|
|
||||||
}}
|
}}
|
||||||
</QItemLabel>
|
</QItemLabel>
|
||||||
<QItemLabel caption>{{ t('ticket.boxing.item') }}</QItemLabel>
|
<QItemLabel caption>{{ t('ticket.boxing.item') }}</QItemLabel>
|
||||||
<QItemLabel>{{ expedition.packagingItemFk }}</QItemLabel>
|
<QItemLabel>{{ expedition.packagingItemFk }}</QItemLabel>
|
||||||
<QItemLabel caption>{{
|
<QItemLabel caption>{{ t('ticket.boxing.worker') }}</QItemLabel>
|
||||||
t('ticket.boxing.worker')
|
|
||||||
}}</QItemLabel>
|
|
||||||
<QItemLabel>{{ expedition.userName }}</QItemLabel>
|
<QItemLabel>{{ expedition.userName }}</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</QList>
|
</QList>
|
||||||
</QScrollArea>
|
</QScrollArea>
|
||||||
</QDrawer>
|
</QDrawer>
|
||||||
</teleport>
|
|
||||||
|
|
||||||
<QCard>
|
<QCard>
|
||||||
<QCarousel animated v-model="slide" height="max-content">
|
<QCarousel animated v-model="slide" height="max-content">
|
||||||
|
|
|
@ -43,13 +43,13 @@ describe('ClaimPhoto', () => {
|
||||||
cy.get(
|
cy.get(
|
||||||
'.multimediaParent > :nth-child(3) > .q-btn > .q-btn__content > .q-icon'
|
'.multimediaParent > :nth-child(3) > .q-btn > .q-btn__content > .q-icon'
|
||||||
).click();
|
).click();
|
||||||
cy.get('.q-btn--standard > .q-btn__content > .block').click();
|
cy.get('.q-btn--unelevated > .q-btn__content > .block').click();
|
||||||
cy.get('.q-notification__message').should('have.text', 'Data deleted');
|
cy.get('.q-notification__message').should('have.text', 'Data deleted');
|
||||||
|
|
||||||
cy.get(
|
cy.get(
|
||||||
'.multimediaParent > :nth-child(3) > .q-btn > .q-btn__content > .q-icon'
|
'.multimediaParent > :nth-child(3) > .q-btn > .q-btn__content > .q-icon'
|
||||||
).click();
|
).click();
|
||||||
cy.get('.q-btn--standard > .q-btn__content > .block').click();
|
cy.get('.q-btn--unelevated > .q-btn__content > .block').click();
|
||||||
cy.get('.q-notification__message').should('have.text', 'Data deleted');
|
cy.get('.q-notification__message').should('have.text', 'Data deleted');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
xdescribe('TicketBoxing', () => {
|
describe('TicketBoxing', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
const ticketId = 1;
|
const ticketId = 1;
|
||||||
cy.viewport(1280, 720);
|
cy.viewport(1280, 720);
|
||||||
|
@ -26,9 +26,9 @@ xdescribe('TicketBoxing', () => {
|
||||||
},
|
},
|
||||||
['2022-01-01T01-01-00.mp4', '2022-02-02T02-02-00.mp4', '2022-03-03T03-03-00.mp4']
|
['2022-01-01T01-01-00.mp4', '2022-02-02T02-02-00.mp4', '2022-03-03T03-03-00.mp4']
|
||||||
).as('getVideoList');
|
).as('getVideoList');
|
||||||
cy.get('.q-list > :nth-child(3)').click();
|
cy.get('.q-list').eq(3).find('.q-item').eq(2).click();
|
||||||
|
|
||||||
cy.get('.q-list > :nth-child(1)').should('be.visible');
|
cy.get('.q-list').eq(3).find('.q-item').eq(0).find('.q-range');
|
||||||
cy.get('.q-list > :nth-child(2)').should('be.visible');
|
cy.get('.q-list').eq(3).find('.q-item').eq(1).find('.q-select');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,7 +12,10 @@ describe('WorkerList', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should open the worker summary', () => {
|
it('should open the worker summary', () => {
|
||||||
cy.get('div[class="q-item__section column q-item__section--side justify-center q-pa-md"]').eq(0).click();
|
cy.get('div.text-h6')
|
||||||
|
.parentsUntil('div.q-card')
|
||||||
|
.find('div.q-card__actions')
|
||||||
|
.find('button').first().click();
|
||||||
cy.get('div[class="header bg-primary q-pa-sm q-mb-md"').should('have.text', '1110 - Jessica Jones');
|
cy.get('div[class="header bg-primary q-pa-sm q-mb-md"').should('have.text', '1110 - Jessica Jones');
|
||||||
cy.get('div[class="q-item__label q-item__label--header text-h6"]').eq(0).should('have.text', 'Basic data');
|
cy.get('div[class="q-item__label q-item__label--header text-h6"]').eq(0).should('have.text', 'Basic data');
|
||||||
cy.get('div[class="q-item__label q-item__label--header text-h6"]').eq(1).should('have.text', 'User data');
|
cy.get('div[class="q-item__label q-item__label--header text-h6"]').eq(1).should('have.text', 'User data');
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe('WorkerSummary', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should load worker summary', () => {
|
it('should load worker summary', () => {
|
||||||
cy.get('div[class="header bg-primary q-pa-sm q-mb-md"').should('have.text', '19 - salesBoss');
|
cy.get('div[class="header bg-primary q-pa-sm q-mb-md"').should('have.text', '19 - salesBoss salesBoss');
|
||||||
cy.get('div[class="q-item__label q-item__label--header text-h6"]').eq(0).should('have.text', 'Basic data');
|
cy.get('div[class="q-item__label q-item__label--header text-h6"]').eq(0).should('have.text', 'Basic data');
|
||||||
cy.get('div[class="q-item__label q-item__label--header text-h6"]').eq(1).should('have.text', 'User data');
|
cy.get('div[class="q-item__label q-item__label--header text-h6"]').eq(1).should('have.text', 'User data');
|
||||||
cy.get('div[class="q-item__section column q-item__section--main justify-center"]').eq(0).should('have.text', 'NamesalesBossNick');
|
cy.get('div[class="q-item__section column q-item__section--main justify-center"]').eq(0).should('have.text', 'NamesalesBossNick');
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import { vi, describe, expect, it } from 'vitest';
|
import { Notify } from 'quasar';
|
||||||
import { onRequest, onResponseError } from 'src/boot/axios';
|
import { onRequest, onResponseError } from 'src/boot/axios';
|
||||||
import { Notify } from 'quasar'
|
import { describe, expect, it, vi } from 'vitest';
|
||||||
|
|
||||||
vi.mock('src/composables/useSession', () => ({
|
vi.mock('src/composables/useSession', () => ({
|
||||||
useSession: () => ({
|
useSession: () => ({
|
||||||
getToken: () => 'DEFAULT_TOKEN'
|
getToken: () => 'DEFAULT_TOKEN',
|
||||||
}),
|
isLoggedIn: () => vi.fn(),
|
||||||
|
destroy: () => vi.fn(),
|
||||||
|
})
|
||||||
}));
|
}));
|
||||||
|
|
||||||
vi.mock('src/router', () => ({}));
|
|
||||||
|
|
||||||
describe('Axios boot', () => {
|
describe('Axios boot', () => {
|
||||||
|
|
||||||
describe('onRequest()', async () => {
|
describe('onRequest()', async () => {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue