+
{{ t(`${module.name}.pageTitles.${module.title}`) }}
diff --git a/src/pages/Login/Login.vue b/src/pages/Login/Login.vue
index 4166c10b0..850d598b1 100644
--- a/src/pages/Login/Login.vue
+++ b/src/pages/Login/Login.vue
@@ -17,40 +17,25 @@ const password = ref('');
const keepLogin = ref(true);
async function onSubmit() {
- try {
- const { data } = await axios.post('/api/accounts/login', {
- user: username.value,
- password: password.value,
- });
+ const { data } = await axios.post('Accounts/login', {
+ user: username.value,
+ password: password.value,
+ });
- await session.login(data.token, keepLogin.value);
+ if (!data) return;
- quasar.notify({
- message: t('login.loginSuccess'),
- type: 'positive',
- });
+ await session.login(data.token, keepLogin.value);
- const currentRoute = router.currentRoute.value;
- if (currentRoute.query && currentRoute.query.redirect) {
- router.push(currentRoute.query.redirect);
- } else {
- router.push({ name: 'Dashboard' });
- }
- } catch (error) {
- if (axios.isAxiosError(error)) {
- const errorCode = error.response && error.response.status;
- if (errorCode === 401) {
- quasar.notify({
- message: t('login.loginError'),
- type: 'negative',
- });
- }
- } else {
- quasar.notify({
- message: t('errors.statusInternalServerError'),
- type: 'negative',
- });
- }
+ quasar.notify({
+ message: t('login.loginSuccess'),
+ type: 'positive',
+ });
+
+ const currentRoute = router.currentRoute.value;
+ if (currentRoute.query && currentRoute.query.redirect) {
+ router.push(currentRoute.query.redirect);
+ } else {
+ router.push({ name: 'Dashboard' });
}
}
diff --git a/src/pages/Login/__tests__/Login.spec.js b/src/pages/Login/__tests__/Login.spec.js
index 970ff138f..ee5ef237b 100644
--- a/src/pages/Login/__tests__/Login.spec.js
+++ b/src/pages/Login/__tests__/Login.spec.js
@@ -17,6 +17,10 @@ describe('Login', () => {
vm = createWrapper(Login).vm;
});
+ afterEach(() => {
+ jest.clearAllMocks();
+ });
+
it('should successfully set the token into session', async () => {
const expectedUser = {
id: 999,
@@ -29,7 +33,7 @@ describe('Login', () => {
}
jest.spyOn(axios, 'post').mockResolvedValue({ data: { token: 'token' } });
jest.spyOn(axios, 'get').mockResolvedValue({ data: { roles: [], user: expectedUser } });
- jest.spyOn(vm.quasar, 'notify')
+ jest.spyOn(vm.quasar, 'notify');
expect(vm.session.getToken()).toEqual('');
@@ -43,15 +47,11 @@ describe('Login', () => {
});
it('should not set the token into session if any error occurred', async () => {
- jest.spyOn(axios, 'post').mockRejectedValue(new Error('error'));
- jest.spyOn(vm.quasar, 'notify')
-
- expect(vm.session.getToken()).toEqual('');
+ jest.spyOn(axios, 'post').mockReturnValue({ data: null });
+ jest.spyOn(vm.quasar, 'notify');
await vm.onSubmit();
- expect(vm.quasar.notify).toHaveBeenCalledWith(expect.objectContaining(
- { 'type': 'negative' }
- ));
+ expect(vm.quasar.notify).not.toHaveBeenCalled();
});
});
diff --git a/src/pages/Ticket/Card/TicketBoxing.vue b/src/pages/Ticket/Card/TicketBoxing.vue
new file mode 100644
index 000000000..81d6fa77b
--- /dev/null
+++ b/src/pages/Ticket/Card/TicketBoxing.vue
@@ -0,0 +1,159 @@
+
+
+
+
+
+
+
+
+
+
+ {{ t('ticket.boxing.selectTime') }} ({{ time.min }}-{{ time.max }})
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ #{{ expedition.id }}
+
+
+ {{ t('ticket.boxing.created') }}
+
+ {{ date.formatDate(expedition.created, 'YYYY-MM-DD HH:mm:ss') }}
+
+ {{ t('ticket.boxing.item') }}
+ {{ expedition.packagingItemFk }}
+ {{ t('ticket.boxing.worker') }}
+ {{ expedition.userName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/Ticket/Card/TicketCard.vue b/src/pages/Ticket/Card/TicketCard.vue
index 7ac41ebf4..625cf9689 100644
--- a/src/pages/Ticket/Card/TicketCard.vue
+++ b/src/pages/Ticket/Card/TicketCard.vue
@@ -1,24 +1,185 @@
-
-
-
-
-
- Customer ID: {{ entityId }}
-
-
+
+
+
+
+
+
+
+ {{ ticket.nickname }}
+ {{ ticket.nickname }}
+
+
+
+ {{ t('ticket.card.ticketId') }}
+ #{{ ticket.id }}
+
+
+ {{ t('ticket.card.state') }}
+
+ {{ ticket.ticketState.state.name }}
+
+
+
+
+
+ {{ t('ticket.card.customerId') }}
+ {{ ticket.clientFk }}
+
+
+ {{ t('ticket.card.salesPerson') }}
+ {{ ticket.client.salesPersonUser.name }}
+
+
+
+
+ {{ t('ticket.card.agency') }}
+ {{ ticket.agencyMode.name }}
+
+
+ {{ t('ticket.card.shipped') }}
+ {{ toDate(ticket.shipped) }}
+
+
+
+
+ {{ t('ticket.card.warehouse') }}
+ {{ ticket.warehouse.name }}
+
+
+
+
+
+
+ {{ t('ticket.card.customerCard') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -->
+
+
+
+
diff --git a/src/pages/Ticket/Card/TicketSummary.vue b/src/pages/Ticket/Card/TicketSummary.vue
new file mode 100644
index 000000000..e69de29bb
diff --git a/src/pages/Ticket/Card/__tests__/TicketBoxing.spec.js b/src/pages/Ticket/Card/__tests__/TicketBoxing.spec.js
new file mode 100644
index 000000000..078350471
--- /dev/null
+++ b/src/pages/Ticket/Card/__tests__/TicketBoxing.spec.js
@@ -0,0 +1,69 @@
+import { jest, describe, expect, it, beforeAll } from '@jest/globals';
+import { createWrapper, axios } from 'app/tests/jest/jestHelpers';
+import TicketBoxing from '../TicketBoxing.vue';
+
+const mockPush = jest.fn();
+
+jest.mock('vue-router', () => ({
+ useRouter: () => ({
+ push: mockPush,
+ currentRoute: {
+ value: {
+ params: {
+ id: 1
+ }
+ }
+ }
+ }),
+}));
+
+describe('TicketBoxing', () => {
+ let vm;
+ beforeAll(() => {
+ vm = createWrapper(TicketBoxing).vm;
+ });
+
+ afterEach(() => {
+ jest.clearAllMocks();
+ });
+
+ describe('getVideoList()', () => {
+ it('should when response videoList use to list', async () => {
+ const expeditionId = 1;
+ const timed = {
+ min: 1,
+ max: 2
+ }
+ const videoList = [
+ "2022-01-01T01-01-00.mp4",
+ "2022-02-02T02-02-00.mp4",
+ "2022-03-03T03-03-00.mp4",
+ ]
+
+ jest.spyOn(axios, 'get').mockResolvedValue({ data: videoList });
+ jest.spyOn(vm.quasar, 'notify');
+
+ await vm.getVideoList(expeditionId, timed);
+
+ expect(vm.videoList.length).toEqual(videoList.length);
+ expect(vm.slide).toEqual(videoList.reverse()[0]);
+ });
+
+ it('should if not have video show notify', async () => {
+ const expeditionId = 1;
+ const timed = {
+ min: 1,
+ max: 2
+ }
+
+ jest.spyOn(axios, 'get').mockResolvedValue({ data: [] });
+ jest.spyOn(vm.quasar, 'notify')
+
+ await vm.getVideoList(expeditionId, timed);
+
+ expect(vm.quasar.notify).toHaveBeenCalledWith(expect.objectContaining(
+ { 'type': 'negative' }
+ ));
+ });
+ });
+});
diff --git a/src/pages/Ticket/TicketList.vue b/src/pages/Ticket/TicketList.vue
index ebc291933..2683ed42a 100644
--- a/src/pages/Ticket/TicketList.vue
+++ b/src/pages/Ticket/TicketList.vue
@@ -1,110 +1,140 @@
-
-
-
-
-
- {{ customer.name }}
- @{{ customer.username }}
-
-
-
-
- Email
- {{ customer.email }}
-
-
-
-
- Phone
- {{ customer.phone }}
-
-
-
-
-
-
-
-
-
- Action 1
-
-
- Action 2
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Address
- Avenue 11
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+ {{ t('ticket.list.nickname') }}
+ {{ row.nickname }}
+
+
+ {{ t('ticket.list.state') }}
+
+
+ {{ row.ticketState.state.name }}
+
+
+
+
+
+
+ {{ t('ticket.list.shipped') }}
+ {{ toDate(row.shipped) }}
+
+
+ {{ t('ticket.list.landed') }}
+ {{ toDate(row.landed) }}
+
+
+
+
+ {{ t('ticket.list.salesPerson') }}
+ {{ row.client.salesPersonUser.name }}
+
+
+ {{ t('ticket.list.total') }}
+ {{ toCurrency(row.totalWithVat) }}
+
+
+
+
+
+
+ {{ t('customer.list.moreOptions') }}
+
+
+
+
+
+
+ Add a note
+
+
+
+
+
+ Display customer history
+
+
+
+
-
+
+ {{ t('components.smartCard.openCard') }}
+
+
+ {{ t('components.smartCard.openSummary') }}
+
+
+ {{ t('customer.list.customerOrders') }}
+
+
+
+
+
+
diff --git a/src/pages/Ticket/TicketMain.vue b/src/pages/Ticket/TicketMain.vue
index 9787fc415..ed84a7ca6 100644
--- a/src/pages/Ticket/TicketMain.vue
+++ b/src/pages/Ticket/TicketMain.vue
@@ -1,7 +1,7 @@