0
0
Fork 0

Merge pull request 'dev to test update' (#17) from dev into test

Reviewed-on: verdnatura/salix-front#17
This commit is contained in:
Carlos Jimenez Ruiz 2022-06-09 15:24:13 +00:00
commit de05cb5298
28 changed files with 648 additions and 2555 deletions

View File

@ -5,7 +5,6 @@
"editor.defaultFormatter": "johnsoncodehk.volar",
"editor.codeActionsOnSave": ["source.fixAll.eslint"],
"eslint.validate": ["javascript", "javascriptreact", "typescript", "vue"],
"jest.jestCommandLine": "jest",
"json.schemas": [
{
"fileMatch": ["cypress.json"],

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 859 B

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 735 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1,55 @@
<script setup>
import { onMounted } from 'vue';
import { useI18n } from 'vue-i18n';
import { useNavigation } from 'src/composables/useNavigation';
const { t } = useI18n();
const navigation = useNavigation();
onMounted(() => {
navigation.fetchFavorites();
});
</script>
<template>
<q-menu
anchor="bottom left"
class="row q-pa-md q-col-gutter-lg"
max-width="350px"
max-height="400px"
v-if="navigation.favorites.value.length"
>
<div v-for="module of navigation.favorites.value" :key="module.title" class="row no-wrap q-pa-xs flex-item">
<q-btn
align="evenly"
padding="16px"
flat
stack
size="lg"
:icon="module.icon"
color="orange-6"
class="col-4 button"
:to="{ name: module.stateName }"
>
<div class="text-center text-orange-6 button-text">
{{ t(`${module.name}.pageTitles.${module.title}`) }}
</div>
</q-btn>
</div>
</q-menu>
</template>
<style lang="scss" scoped>
.flex-item {
width: 100px;
}
.button {
width: 100%;
line-height: normal;
align-items: center;
}
.button-text {
font-size: 10px;
margin-top: 5px;
}
</style>

View File

@ -1,91 +1,175 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRole } from 'src/composables/useRole';
import routes from 'src/router/routes';
import { useQuasar } from 'quasar';
import { useNavigation } from 'src/composables/useNavigation';
const { t } = useI18n();
const { hasAny } = useRole();
const navigation = useNavigation();
const mainRoute = routes.find((route) => route.path === '/');
const moduleRoutes = (mainRoute && mainRoute.children) || [];
const quasar = useQuasar();
const modules = ref([]);
for (const route of moduleRoutes) {
const module = {
stateName: route.name,
name: route.name.toLowerCase(),
roles: [],
};
async function onToggleFavoriteModule(moduleName, event) {
await navigation.toggleFavorite(moduleName, event);
if (route.meta) {
Object.assign(module, route.meta);
}
if (route.children && route.children.length) {
const [moduleMain] = route.children;
const routes = moduleMain.children;
module.children = routes.map((route) => {
const submodule = {
stateName: route.name,
name: route.name,
};
Object.assign(submodule, route.meta);
return submodule;
});
}
modules.value.push(module);
quasar.notify({
message: t('globals.dataSaved'),
type: 'positive',
});
}
</script>
<template>
<q-list padding>
<template v-for="module in modules" :key="module.title">
<template v-if="!module.children">
<q-item
clickable
v-ripple
active-class="text-orange"
:key="module.title"
:to="{ name: module.stateName }"
v-if="!module.roles || !module.roles.length || hasAny(module.roles)"
>
<q-item-section avatar :if="module.icon">
<q-icon :name="module.icon" />
</q-item-section>
<q-item-section>{{ t(`${module.name}.pageTitles.${module.title}`) }}</q-item-section>
</q-item>
</template>
<q-expansion-item
:default-opened="true"
:label="t('globals.favoriteModules')"
v-if="navigation.favorites.value.length"
>
<q-list padding>
<template v-for="module in navigation.favorites.value" :key="module.title">
<div class="module" v-if="!module.children">
<q-item
clickable
v-ripple
active-class="text-orange"
:key="module.title"
:to="{ name: module.stateName }"
v-if="!module.roles || !module.roles.length || hasAny(module.roles)"
>
<q-item-section avatar :if="module.icon">
<q-icon :name="module.icon" />
</q-item-section>
<q-item-section>{{ t(`${module.name}.pageTitles.${module.title}`) }}</q-item-section>
<q-item-section side>
<div @click="onToggleFavoriteModule(module.name, $event)" class="row items-center">
<q-icon name="vn:pin_off"></q-icon>
</div>
</q-item-section>
</q-item>
</div>
<template v-if="module.children">
<q-expansion-item
expand-separator
active-class="text-orange"
:icon="module.icon"
:label="t(`${module.name}.pageTitles.${module.title}`)"
v-if="!module.roles || !module.roles.length || hasAny(module.roles)"
:to="{ name: module.stateName }"
>
<template v-for="section in module.children" :key="section.title">
<q-item
clickable
v-ripple
active-class="text-orange"
:to="{ name: section.stateName }"
v-if="!section.roles || !section.roles.length || hasAny(section.roles)"
>
<q-item-section avatar :if="section.icon">
<q-icon :name="section.icon" />
<template v-if="module.children">
<q-expansion-item
class="module"
active-class="text-orange"
:label="t(`${module.name}.pageTitles.${module.title}`)"
v-if="!module.roles || !module.roles.length || hasAny(module.roles)"
:to="{ name: module.stateName }"
>
<template #header>
<q-item-section avatar>
<q-icon :name="module.icon"></q-icon>
</q-item-section>
<q-item-section>{{ t(`${module.name}.pageTitles.${section.title}`) }}</q-item-section>
</q-item>
</template>
</q-expansion-item>
<q-item-section>{{ t(`${module.name}.pageTitles.${module.title}`) }}</q-item-section>
<q-item-section side>
<div @click="onToggleFavoriteModule(module.name, $event)" class="row items-center">
<q-icon name="vn:pin_off"></q-icon>
</div>
</q-item-section>
</template>
<template v-for="section in module.children" :key="section.title">
<q-item
clickable
v-ripple
active-class="text-orange"
:to="{ name: section.stateName }"
v-if="!section.roles || !section.roles.length || hasAny(section.roles)"
>
<q-item-section avatar :if="section.icon">
<q-icon :name="section.icon" />
</q-item-section>
<q-item-section>{{ t(`${module.name}.pageTitles.${section.title}`) }}</q-item-section>
</q-item>
</template>
</q-expansion-item>
</template>
</template>
</template>
</q-list>
</q-list>
</q-expansion-item>
<q-separator />
<q-expansion-item :label="t('moduleIndex.allModules')">
<q-list padding>
<template v-for="module in navigation.modules.value" :key="module.title">
<div class="module" v-if="!module.children">
<q-item
class="module"
clickable
v-ripple
active-class="text-orange"
:key="module.title"
:to="{ name: module.stateName }"
v-if="!module.roles || !module.roles.length || hasAny(module.roles)"
>
<q-item-section avatar :if="module.icon">
<q-icon :name="module.icon" />
</q-item-section>
<q-item-section>{{ t(`${module.name}.pageTitles.${module.title}`) }}</q-item-section>
<q-item-section side>
<div
@click="onToggleFavoriteModule(module.name, $event)"
class="row items-center"
v-if="module.name != 'dashboard'"
>
<q-icon name="vn:pin"></q-icon>
</div>
</q-item-section>
</q-item>
</div>
<template v-if="module.children">
<q-expansion-item
class="module"
active-class="text-orange"
:label="t(`${module.name}.pageTitles.${module.title}`)"
v-if="!module.roles || !module.roles.length || hasAny(module.roles)"
:to="{ name: module.stateName }"
>
<template #header>
<q-item-section avatar>
<q-icon :name="module.icon"></q-icon>
</q-item-section>
<q-item-section>{{ t(`${module.name}.pageTitles.${module.title}`) }}</q-item-section>
<q-item-section side>
<div
@click="onToggleFavoriteModule(module.name, $event)"
class="row items-center"
v-if="module.name != 'dashboard'"
>
<q-icon name="vn:pin"></q-icon>
</div>
</q-item-section>
</template>
<template v-for="section in module.children" :key="section.title">
<q-item
clickable
v-ripple
active-class="text-orange"
:to="{ name: section.stateName }"
v-if="!section.roles || !section.roles.length || hasAny(section.roles)"
>
<q-item-section avatar :if="section.icon">
<q-icon :name="section.icon" />
</q-item-section>
<q-item-section>{{ t(`${module.name}.pageTitles.${section.title}`) }}</q-item-section>
</q-item>
</template>
</q-expansion-item>
</template>
</template>
</q-list>
</q-expansion-item>
</template>
<style>
.module .icon-pin,
.module .icon-pin_off {
visibility: hidden;
}
.module:hover .icon-pin,
.module:hover .icon-pin_off {
visibility: visible;
}
</style>

View File

@ -3,6 +3,7 @@ import { useI18n } from 'vue-i18n';
import { useState } from 'src/composables/useState';
import { useSession } from 'src/composables/useSession';
import UserPanel from 'src/components/UserPanel.vue';
import FavoriteModules from './FavoriteModules.vue';
const { t } = useI18n();
const session = useSession();
@ -36,8 +37,7 @@ function onToggleDrawer() {
<q-toolbar-title shrink class="text-weight-bold">Salix</q-toolbar-title>
<q-space></q-space>
<div class="q-pl-sm q-gutter-sm row items-center no-wrap">
<q-btn v-if="$q.screen.gt.xs" dense flat size="md" icon="add">
<q-icon name="arrow_drop_down" size="s" />
<!-- <q-btn v-if="$q.screen.gt.xs" dense flat size="md" icon="add">
<q-menu>
<q-list style="min-width: 150px">
<q-item :to="{ path: '/customer/create' }" clickable>
@ -48,8 +48,8 @@ function onToggleDrawer() {
</q-item>
</q-list>
</q-menu>
</q-btn>
<q-btn v-if="$q.screen.gt.xs" dense flat round size="md" icon="notifications">
</q-btn> -->
<!-- <q-btn v-if="$q.screen.gt.xs" dense flat round size="md" icon="notifications">
<q-badge color="red" text-color="white" floating> 2 </q-badge>
<q-tooltip bottom>
{{ t('globals.notifications') }}
@ -61,8 +61,17 @@ function onToggleDrawer() {
<q-spinner-puff color="orange" />
</div>
</q-menu>
</q-btn> -->
<q-btn dense flat no-wrap id="favoriteModules">
<q-avatar size="lg">
<q-icon name="apps" size="s" />
</q-avatar>
<q-tooltip bottom>
{{ t('globals.favoriteModules') }}
</q-tooltip>
<FavoriteModules />
</q-btn>
<q-btn dense flat no-wrap>
<q-btn dense flat no-wrap id="user">
<q-avatar size="lg">
<q-img
:src="`/api/Images/user/160x160/${user.id}/download?access_token=${token}`"

View File

@ -100,6 +100,7 @@ function logout() {
<div class="text-subtitle3 text-grey-7 q-mb-xs">@{{ user.name }}</div>
<q-btn
id="logout"
color="orange"
flat
:label="t('globals.logOut')"

View File

@ -63,7 +63,7 @@ describe('Leftmenu', () => {
vm = createWrapper(Leftmenu).vm;
});
it('should return a proper formated object without the children property', async () => {
it('should return the proper formated object without the children property', async () => {
const expectedMenuItem = {
stateName: 'Dashboard',
name: 'dashboard',
@ -72,7 +72,7 @@ describe('Leftmenu', () => {
title: 'dashboard'
}
const firstMenuItem = vm.modules[0];
const firstMenuItem = vm.navigation.modules.value[0];
expect(firstMenuItem.children).toBeUndefined();
expect(firstMenuItem).toEqual(expect.objectContaining(expectedMenuItem));
});
@ -91,7 +91,7 @@ describe('Leftmenu', () => {
stateName: 'CustomerCreate'
}];
const secondMenuItem = vm.modules[1];
const secondMenuItem = vm.navigation.modules.value[1];
expect(secondMenuItem.children).toEqual(expect.arrayContaining(expectedMenuItem));
expect(secondMenuItem.children.length).toEqual(2)
});

View File

@ -0,0 +1,42 @@
import { describe, expect, it } from '@jest/globals';
import { useNavigation } from '../useNavigation';
const navigation = useNavigation();
describe('useNavigation', () => {
it('should return the routes for all modules', async () => {
expect(navigation.modules.value.length).toEqual(3);
});
it('should return a proper formated object without the children property', async () => {
const expectedMenuItem = {
stateName: 'Dashboard',
name: 'dashboard',
roles: [],
icon: 'dashboard',
title: 'dashboard'
}
const firstMenuItem = navigation.modules.value[0]
expect(firstMenuItem.children).toBeUndefined();
expect(firstMenuItem).toEqual(expect.objectContaining(expectedMenuItem));
});
it('should return a proper formated object with two child items', async () => {
const expectedMenuItem = [{
name: 'CustomerList',
title: 'list',
icon: 'view_list',
stateName: 'CustomerList'
},
{
name: 'CustomerCreate',
title: 'createCustomer',
icon: 'vn:addperson',
stateName: 'CustomerCreate'
}];
const secondMenuItem = navigation.modules.value[1]
expect(secondMenuItem.children).toEqual(expect.arrayContaining(expectedMenuItem));
expect(secondMenuItem.children.length).toEqual(2)
});
});

View File

@ -0,0 +1,92 @@
import routes from 'src/router/routes';
import { ref } from 'vue';
import axios from 'axios';
const favorites = ref([]);
const modules = ref([]);
const mainRoute = routes.find((route) => route.path === '/');
const moduleRoutes = (mainRoute && mainRoute.children) || [];
for (const route of moduleRoutes) {
const module = {
stateName: route.name,
name: route.name.toLowerCase(),
roles: [],
};
if (route.meta) {
Object.assign(module, route.meta);
}
if (route.children && route.children.length) {
const [moduleMain] = route.children;
const routes = moduleMain.children;
module.children = routes.map((route) => {
const submodule = {
stateName: route.name,
name: route.name,
};
Object.assign(submodule, route.meta);
return submodule;
});
}
modules.value.push(module);
}
export function useNavigation() {
const salixModules = {
customer: 'Clients',
claim: 'Claims',
entry: 'Entries',
invoiceIn: 'Invoices In',
invoiceOut: 'Invoices Out',
item: 'Items',
monitor: 'Monitors',
order: 'Orders',
route: 'Routes',
supplier: 'Suppliers',
ticket: 'Tickets',
travel: 'Travels',
user: 'Users',
worker: 'Workers',
zone: 'Zones',
};
async function fetchFavorites() {
const response = await axios.get('api/starredModules/getStarredModules');
const filteredModules = modules.value.filter((module) => {
return response.data.find((element) => element.moduleFk == salixModules[module.name]);
});
return (favorites.value = filteredModules);
}
async function toggleFavorite(moduleName, event) {
if (event.defaultPrevented) return;
event.preventDefault();
event.stopPropagation();
const params = { moduleName: salixModules[moduleName] };
const query = 'api/starredModules/toggleStarredModule';
await axios.post(query, params);
updateFavorites(moduleName);
}
function updateFavorites(name) {
if (!favorites.value.find((module) => module.name == name)) {
const newStarreModule = modules.value.find((module) => module.name == name);
favorites.value.push(newStarreModule);
} else {
const moduleToRemove = favorites.value.find((module) => module.name == name);
favorites.value.splice(favorites.value.indexOf(moduleToRemove), 1);
}
}
return { modules, favorites, toggleFavorite, fetchFavorites, updateFavorites };
}

Binary file not shown.

View File

@ -87,6 +87,7 @@
<glyph unicode="&#xe94d;" glyph-name="albaran" d="M819.2 960h-622.933c-55.467 0-102.4-46.933-102.4-102.4v-819.2c0-55.467 46.933-102.4 102.4-102.4h622.933c55.467 0 102.4 46.933 102.4 102.4v819.2c0 55.467-46.933 102.4-102.4 102.4zM358.4 174.933h-102.4v102.4h503.467v-102.4h-401.067zM256 379.733v102.4h503.467v-102.4h-503.467zM759.467 584.533h-503.467v102.4h503.467v-102.4z" />
<glyph unicode="&#xe94e;" glyph-name="solunion" d="M759.467 870.4v-136.533h-601.6c0 0-128-341.333 106.667-341.333s469.333 0 469.333 0 34.133 0 34.133-34.133-8.533-98.133-8.533-98.133h-541.867c0 0-247.467 29.867-204.8 320 0 0 8.533 140.8 72.533 298.667 0 0 21.333-8.533 85.333-8.533h588.8zM853.333 25.6c64 0 85.333-8.533 85.333-8.533 64 153.6 72.533 298.667 72.533 298.667 42.667 290.133-204.8 320-204.8 320h-541.867c0 0-8.533-64-8.533-98.133s34.133-34.133 34.133-34.133 238.933 0 469.333 0 106.667-341.333 106.667-341.333h-601.6v-136.533h588.8z" />
<glyph unicode="&#xe94f;" glyph-name="stowaway" d="M1006.933 452.267l-260.267 106.667 29.867 29.867c4.267 4.267 4.267 12.8 4.267 17.067-4.267 4.267-8.533 8.533-12.8 8.533h-157.867c0 93.867 76.8 157.867 174.933 157.867 4.267 0 8.533 4.267 12.8 8.533s4.267 8.533 0 17.067l-81.067 153.6c-4.267 0-12.8 4.267-17.067 4.267-46.933 0-93.867-17.067-132.267-42.667-21.333-17.067-42.667-38.4-55.467-59.733-12.8 21.333-29.867 42.667-55.467 59.733-34.133 12.8-81.067 34.133-128 34.133-4.267 0-12.8-4.267-12.8-8.533l-85.333-153.6c-4.267-4.267-4.267-4.267 0-12.8 4.267-4.267 8.533-8.533 12.8-8.533 98.133 0 174.933-59.733 174.933-153.6v0h-140.8c-4.267 0-12.8-4.267-12.8-8.533-8.533-4.267-4.267-17.067 0-21.333l21.333-21.333-277.333-110.933c-8.533-8.533-12.8-12.8-8.533-21.333 0-8.533 8.533-12.8 17.067-12.8v0l98.133 4.267-81.067-85.333c0-4.267-4.267-8.533 0-12.8 0-4.267 4.267-8.533 8.533-8.533l85.333-34.133v-179.2c0-8.533 4.267-12.8 8.533-12.8l358.4-145.067h8.533l358.4 145.067c4.267 4.267 8.533 8.533 8.533 12.8v179.2l85.333 34.133c4.267 0 8.533 4.267 8.533 8.533s0 8.533-4.267 12.8l-68.267 98.133 102.4-4.267c8.533 0 12.8 4.267 17.067 12.8 8.533 0 4.267 4.267-4.267 12.8zM110.933 456.533l196.267 76.8 8.533-8.533-166.4-64-38.4-4.267zM153.6 285.867v0l-68.267 34.133 68.267 98.133 328.533-132.267-68.267-98.133-260.267 98.133zM490.667-29.867l-328.533 132.267v153.6l243.2-98.133h12.8c0 0 0 0 4.267 0v0c0 0 4.267 0 4.267 4.267l64 85.333c0-4.267 0-277.333 0-277.333zM490.667 324.267l-298.667 115.2 149.333 64 153.6-157.867v-17.067h-4.267zM529.067 337.067l157.867 157.867 140.8-55.467-298.667-115.2c0 0 0 12.8 0 12.8zM849.067 102.4l-328.533-132.267v281.6l64-85.333c0 0 0-4.267 4.267-4.267v0h17.067l243.2 98.133v-157.867zM938.667 324.267l-324.267-132.267-68.267 98.133 328.533 132.267 64-98.133zM870.4 460.8l-157.867 64 12.8 8.533 187.733-76.8-42.667 4.267z" />
<glyph unicode="&#xe950;" glyph-name="pin" d="M739.556 732.444v113.778h-455.111v-113.778h56.889v-284.444l-85.333-85.333v-85.333h199.111v-227.556l56.889-56.889 56.889 56.889v227.556h199.111v85.333l-85.333 85.333v284.444z" />
<glyph unicode="&#xe951;" glyph-name="apps" d="M0 704h256v256h-256v-256zM384-64h256v256h-256v-256zM0-64h256v256h-256v-256zM0 320h256v256h-256v-256zM384 320h256v256h-256v-256zM768 960v-256h256v256h-256zM384 704h256v256h-256v-256zM768 320h256v256h-256v-256zM768-64h256v256h-256v-256z" />
<glyph unicode="&#xe952;" glyph-name="info" d="M512 960c-281.6 0-512-230.4-512-512s230.4-512 512-512 512 230.4 512 512-230.4 512-512 512zM563.2 192h-102.4v307.2h102.4v-307.2zM563.2 601.6h-102.4v102.4h102.4v-102.4z" />
<glyph unicode="&#xe953;" glyph-name="columndelete" d="M0 960h256v-256h-256v256zM0 192h256v-256h-256v256zM0 576h256v-256h-256v256zM785.067 686.933l93.867-98.133-140.8-140.8 140.8-145.067-93.867-98.133-145.067 145.067-145.067-145.067-93.867 98.133 140.8 145.067-140.8 140.8 93.867 98.133 145.067-145.067z" />
@ -97,6 +98,7 @@
<glyph unicode="&#xe958;" glyph-name="headercol" d="M362.667-64h302.933v678.4h-302.933v-678.4zM0-64h302.933v678.4h-302.933v-678.4zM721.067 614.4v-678.4h302.933v678.4h-302.933zM362.667 678.4h302.933v281.6h-302.933v-281.6zM0 678.4h302.933v281.6h-302.933v-281.6zM721.067 960v-281.6h302.933v281.6h-302.933z" />
<glyph unicode="&#xe959;" glyph-name="reserva" d="M841.6 864c48 0 86.4-38.4 86.4-86.4v-662.4c0-48-38.4-86.4-86.4-86.4h-659.2c-48 3.2-86.4 41.6-86.4 89.6v659.2c0 48 38.4 86.4 86.4 86.4h659.2zM841.6 960h-659.2c-99.2 0-182.4-83.2-182.4-182.4v-662.4c0-96 83.2-179.2 182.4-179.2h662.4c99.2 0 182.4 83.2 182.4 182.4v659.2c-3.2 99.2-86.4 182.4-185.6 182.4v0zM611.2 192l-99.2 144h-108.8v-144h-118.4v512h220.8c44.8 0 83.2-6.4 118.4-22.4 32-16 57.6-35.2 76.8-64s25.6-60.8 25.6-99.2c0-38.4-9.6-70.4-28.8-99.2s-44.8-48-76.8-64l115.2-163.2h-124.8zM582.4 585.6c-19.2 16-44.8 22.4-80 22.4h-96v-179.2h96c35.2 0 64 6.4 80 22.4 19.2 16 28.8 38.4 28.8 67.2-3.2 28.8-9.6 51.2-28.8 67.2z" />
<glyph unicode="&#xe95a;" glyph-name="100" d="M640 38.4l-17.067-17.067h-213.333v153.6h-153.6v102.4h200.533l102.4 102.4h-302.933v102.4h405.333l102.4 102.4h-507.733v102.4h520.533v-89.6l72.533 72.533c17.067 17.067 42.667 29.867 68.267 29.867 4.267 0 8.533 0 8.533 0v157.867c0 55.467-46.933 102.4-102.4 102.4h-627.2c-55.467 0-102.4-46.933-102.4-102.4v-819.2c0-55.467 46.933-102.4 102.4-102.4h627.2c55.467 0 102.4 46.933 102.4 102.4v285.867l-285.867-285.867zM917.333 635.733c8.533 0 17.067-4.267 21.333-8.533l76.8-76.8c12.8-12.8 12.8-34.133 0-46.933l-64-64-119.467 119.467 64 64c4.267 8.533 12.8 12.8 21.333 12.8zM797.867 529.067l119.467-123.733-320-320h-123.733v119.467l324.267 324.267z" />
<glyph unicode="&#xe95b;" glyph-name="pin_off" d="M860.729 89.031l-704.853 705.422-52.907-52.907 238.364-236.658v-12.516l-85.333-87.040v-85.333h213.333v-256l42.667-42.667 42.667 42.667v227.556l253.724-253.724zM341.333 714.809l394.809-394.809h31.858v85.333l-85.333 85.333v298.667h42.098v85.333h-426.098v-85.333h42.667z" />
<glyph unicode="&#xe95d;" glyph-name="sign" d="M725.333 960c72.533-72.533 145.067-145.067 217.6-217.6-4.267-4.267-8.533-12.8-17.067-17.067-179.2-179.2-358.4-362.667-537.6-541.867-8.533-8.533-25.6-17.067-38.4-21.333-81.067-21.333-166.4-42.667-247.467-64-4.267 0-12.8-4.267-21.333-4.267 0 8.533 0 17.067 4.267 21.333 21.333 85.333 42.667 166.4 64 251.733 4.267 8.533 8.533 21.333 17.067 25.6 183.467 187.733 371.2 371.2 554.667 554.667 0 8.533 0 12.8 4.267 12.8zM849.067 25.6c-25.6-21.333-46.933-42.667-72.533-59.733-29.867-17.067-59.733-25.6-89.6-29.867-21.333-4.267-42.667 0-55.467 12.8-12.8 8.533-25.6 46.933-38.4 51.2-4.267 0-12.8 0-17.067-4.267-68.267-25.6-145.067-55.467-221.867-55.467-106.667 0-209.067 0-315.733 0-4.267 0-8.533 0-12.8 0-4.267 4.267-12.8 8.533-12.8 12.8s8.533 12.8 12.8 17.067c4.267 4.267 12.8 0 21.333 0 102.4 0 204.8 0 307.2 4.267 76.8 0 153.6 25.6 221.867 64 8.533 4.267 12.8 12.8 12.8 21.333 4.267 55.467 12.8 106.667 42.667 153.6 17.067 29.867 42.667 51.2 81.067 55.467 55.467 0 85.333-38.4 64-89.6-17.067-34.133-42.667-64-64-89.6-21.333-21.333-51.2-38.4-72.533-55.467-4.267-4.267-8.533-17.067-8.533-21.333 8.533-34.133 29.867-51.2 59.733-42.667 29.867 4.267 59.733 17.067 81.067 34.133 25.6 17.067 46.933 42.667 72.533 64 8.533 8.533 17.067 21.333 29.867 25.6 8.533 4.267 21.333 8.533 29.867 4.267 4.267-4.267 8.533-21.333 4.267-29.867-8.533-21.333-17.067-42.667-25.6-64-4.267-8.533-8.533-25.6 0-34.133s29.867-4.267 38.4 4.267c25.6 17.067 51.2 34.133 72.533 55.467 8.533 8.533 17.067 17.067 25.6 8.533 4.267-4.267 4.267-21.333 0-29.867-25.6-34.133-59.733-59.733-102.4-72.533-46.933-12.8-76.8 17.067-68.267 64-4.267 12.8-4.267 17.067 0 25.6zM618.667 72.533c0 0 0-4.267 0-4.267s4.267 0 4.267 0c29.867 25.6 59.733 51.2 85.333 81.067 12.8 12.8 21.333 34.133 29.867 51.2 8.533 21.333 0 34.133-21.333 38.4-25.6 4.267-42.667-8.533-55.467-25.6-29.867-46.933-38.4-93.867-42.667-140.8z" />
<glyph unicode="&#xe95e;" glyph-name="polizon" d="M1011.2 456.533l-264.533 106.667 29.867 29.867c4.267 4.267 4.267 12.8 4.267 17.067-4.267 4.267-8.533 8.533-12.8 8.533h-157.867c0 93.867 76.8 157.867 174.933 157.867 4.267 0 8.533 4.267 12.8 8.533s4.267 8.533 0 17.067l-81.067 153.6c-4.267 0-12.8 4.267-17.067 4.267-46.933 0-93.867-17.067-132.267-42.667-25.6-17.067-42.667-38.4-55.467-59.733-12.8 25.6-29.867 42.667-55.467 59.733-38.4 25.6-85.333 42.667-132.267 42.667-4.267 0-12.8-4.267-12.8-8.533l-81.067-153.6c-4.267-4.267-4.267-8.533 0-17.067 4.267-4.267 8.533-8.533 12.8-8.533 98.133 0 174.933-59.733 174.933-153.6v0h-140.8c-4.267 0-12.8-4.267-12.8-8.533-4.267-4.267 0-12.8 4.267-17.067l21.333-21.333-277.333-110.933c-8.533-8.533-12.8-12.8-8.533-21.333 0-8.533 8.533-12.8 17.067-12.8 0 0 0 0 0 0l98.133 4.267-76.8-98.133c0-4.267-4.267-8.533 0-12.8 0-4.267 4.267-8.533 8.533-8.533l85.333-34.133v-179.2c0-8.533 4.267-12.8 8.533-12.8l362.667-145.067c0 0 4.267 0 4.267 0s4.267 0 4.267 0l362.667 145.067c4.267 4.267 8.533 8.533 8.533 12.8v179.2l85.333 34.133c4.267 0 8.533 4.267 8.533 8.533s0 8.533-4.267 12.8l-72.533 98.133 102.4-4.267c8.533 0 12.8 4.267 17.067 12.8 0 8.533-4.267 12.8-12.8 17.067zM110.933 460.8l200.533 81.067 8.533-8.533-170.667-68.267-38.4-4.267zM153.6 294.4v4.267l-72.533 29.867 72.533 98.133 328.533-132.267-72.533-98.133-256 102.4v-4.267zM494.933-25.6l-328.533 132.267v153.6l243.2-98.133c0 0 4.267 0 4.267 0h4.267c0 0 4.267 0 4.267 0v0c0 0 0 0 4.267 0v0c0 0 4.267 0 4.267 4.267l64 85.333v-277.333zM494.933 328.533l-302.933 119.467 149.333 59.733 153.6-162.133v-17.067zM529.067 345.6l162.133 157.867 140.8-55.467-302.933-119.467v17.067zM857.6 106.667l-328.533-132.267v281.6l64-85.333c0 0 0-4.267 4.267-4.267v0c0 0 4.267 0 4.267 0v0c0 0 4.267 0 4.267 0v0 0c0 0 4.267 0 4.267 0l243.2 98.133v-157.867zM942.933 328.533l-328.533-132.267-72.533 98.133 328.533 132.267 72.533-98.133zM874.667 465.067l-162.133 64 12.8 8.533 187.733-76.8-38.4 4.267z" />
<glyph unicode="&#xe95f;" glyph-name="solclaim" d="M1024 917.333v-938.667h-938.667v68.267h234.667v51.2h38.4c8.533-4.267 17.067-4.267 29.867-4.267h298.667c42.667 0 76.8 34.133 76.8 76.8 0 0 0 0 0 0 29.867 12.8 46.933 38.4 46.933 72.533 0 0 0 0 0 0 29.867 12.8 46.933 38.4 46.933 72.533s-21.333 59.733-46.933 72.533c0 0 0 0 0 0 0 42.667-34.133 76.8-76.8 76.8h-106.667c21.333 21.333 29.867 55.467 17.067 89.6-12.8 25.6-38.4 42.667-68.267 42.667-12.8 0-21.333-4.267-34.133-8.533l-217.6-98.133v29.867h-238.933v396.8h362.667v-209.067h209.067v209.067h366.933zM0 89.6h281.6v51.2h89.6c4.267-4.267 12.8-4.267 17.067-4.267h298.667c21.333 0 34.133 12.8 34.133 34.133s-12.8 34.133-34.133 34.133h-136.533v12.8h183.467c21.333 0 34.133 12.8 34.133 29.867 0 21.333-12.8 29.867-34.133 29.867h-179.2v12.8h234.667c21.333 0 34.133 8.533 34.133 29.867s-12.8 29.867-34.133 29.867h-230.4v12.8h183.467c21.333 0 29.867 12.8 29.867 34.133s-12.8 34.133-34.133 34.133h-230.4l93.867 64c12.8 8.533 21.333 29.867 12.8 46.933s-29.867 25.6-51.2 17.067l-251.733-119.467c-4.267 0-4.267-4.267-8.533-4.267-4.267-4.267-8.533-8.533-12.8-12.8h-8.533v55.467h-281.6v-388.267z" />

Before

Width:  |  Height:  |  Size: 158 KiB

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -1,393 +1,399 @@
@font-face {
font-family: 'icomoon';
src: url('fonts/icomoon.eot?cjtmya');
src: url('fonts/icomoon.eot?cjtmya#iefix') format('embedded-opentype'),
url('fonts/icomoon.ttf?cjtmya') format('truetype'), url('fonts/icomoon.woff?cjtmya') format('woff'),
url('fonts/icomoon.svg?cjtmya#icomoon') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
font-family: 'icomoon';
src: url('fonts/icomoon.eot?g6kvgn');
src: url('fonts/icomoon.eot?g6kvgn#iefix') format('embedded-opentype'),
url('fonts/icomoon.ttf?g6kvgn') format('truetype'),
url('fonts/icomoon.woff?g6kvgn') format('woff'),
url('fonts/icomoon.svg?g6kvgn#icomoon') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
}
[class^='icon-'],
[class*=' icon-'] {
/* use !important to prevent issues with browser extensions that change fonts */
font-family: 'icomoon' !important;
speak: never;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
[class^="icon-"], [class*=" icon-"] {
/* use !important to prevent issues with browser extensions that change fonts */
font-family: 'icomoon' !important;
speak: never;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-pin:before {
content: "\e950";
}
.icon-pin_off:before {
content: "\e95b";
}
.icon-frozen:before {
content: '\e900';
content: "\e900";
}
.icon-Person:before {
content: '\e901';
content: "\e901";
}
.icon-handmadeArtificial:before {
content: '\e902';
content: "\e902";
}
.icon-fruit:before {
content: '\e903';
content: "\e903";
}
.icon-funeral:before {
content: '\e904';
content: "\e904";
}
.icon-noPayMethod:before {
content: '\e905';
content: "\e905";
}
.icon-preserved:before {
content: '\e906';
content: "\e906";
}
.icon-greenery:before {
content: '\e907';
content: "\e907";
}
.icon-planta:before {
content: '\e908';
content: "\e908";
}
.icon-handmade:before {
content: '\e909';
content: "\e909";
}
.icon-accessory:before {
content: '\e90a';
content: "\e90a";
}
.icon-artificial:before {
content: '\e90b';
content: "\e90b";
}
.icon-flower:before {
content: '\e90c';
content: "\e90c";
}
.icon-fixedPrice:before {
content: '\e90d';
content: "\e90d";
}
.icon-addperson:before {
content: '\e90e';
content: "\e90e";
}
.icon-supplierfalse:before {
content: '\e90f';
content: "\e90f";
}
.icon-invoice-out:before {
content: '\e910';
content: "\e910";
}
.icon-invoice-in:before {
content: '\e911';
content: "\e911";
}
.icon-invoice-in-create:before {
content: '\e912';
content: "\e912";
}
.icon-basketadd:before {
content: '\e913';
content: "\e913";
}
.icon-basket:before {
content: '\e914';
content: "\e914";
}
.icon-uniE915:before {
content: '\e915';
content: "\e915";
}
.icon-uniE916:before {
content: '\e916';
content: "\e916";
}
.icon-uniE917:before {
content: '\e917';
content: "\e917";
}
.icon-uniE918:before {
content: '\e918';
content: "\e918";
}
.icon-uniE919:before {
content: '\e919';
content: "\e919";
}
.icon-uniE91A:before {
content: '\e91a';
content: "\e91a";
}
.icon-isTooLittle:before {
content: '\e91b';
content: "\e91b";
}
.icon-deliveryprices:before {
content: '\e91c';
content: "\e91c";
}
.icon-onlinepayment:before {
content: '\e91d';
content: "\e91d";
}
.icon-risk:before {
content: '\e91e';
content: "\e91e";
}
.icon-noweb:before {
content: '\e91f';
content: "\e91f";
}
.icon-no036:before {
content: '\e920';
content: "\e920";
}
.icon-disabled:before {
content: '\e921';
content: "\e921";
}
.icon-treatments:before {
content: '\e922';
content: "\e922";
}
.icon-invoice:before {
content: '\e923';
content: "\e923";
}
.icon-photo:before {
content: '\e924';
content: "\e924";
}
.icon-supplier:before {
content: '\e925';
content: "\e925";
}
.icon-languaje:before {
content: '\e926';
content: "\e926";
}
.icon-credit:before {
content: '\e927';
content: "\e927";
}
.icon-client:before {
content: '\e928';
content: "\e928";
}
.icon-shipment-01:before {
content: '\e929';
content: "\e929";
}
.icon-account:before {
content: '\e92a';
content: "\e92a";
}
.icon-inventory:before {
content: '\e92b';
content: "\e92b";
}
.icon-unavailable:before {
content: '\e92c';
content: "\e92c";
}
.icon-wiki:before {
content: '\e92d';
content: "\e92d";
}
.icon-attach:before {
content: '\e92e';
content: "\e92e";
}
.icon-exit:before {
content: '\e92f';
content: "\e92f";
}
.icon-anonymous:before {
content: '\e930';
content: "\e930";
}
.icon-net:before {
content: '\e931';
content: "\e931";
}
.icon-buyrequest:before {
content: '\e932';
content: "\e932";
}
.icon-thermometer:before {
content: '\e933';
content: "\e933";
}
.icon-entry:before {
content: '\e934';
content: "\e934";
}
.icon-deletedTicket:before {
content: '\e935';
content: "\e935";
}
.icon-logout:before {
content: '\e936';
content: "\e936";
}
.icon-catalog:before {
content: '\e937';
content: "\e937";
}
.icon-agency:before {
content: '\e938';
content: "\e938";
}
.icon-delivery:before {
content: '\e939';
content: "\e939";
}
.icon-wand:before {
content: '\e93a';
content: "\e93a";
}
.icon-buscaman:before {
content: '\e93b';
content: "\e93b";
}
.icon-pbx:before {
content: '\e93c';
content: "\e93c";
}
.icon-calendar:before {
content: '\e93d';
content: "\e93d";
}
.icon-splitline:before {
content: '\e93e';
content: "\e93e";
}
.icon-consignatarios:before {
content: '\e93f';
content: "\e93f";
}
.icon-tax:before {
content: '\e940';
content: "\e940";
}
.icon-notes:before {
content: '\e941';
content: "\e941";
}
.icon-lines:before {
content: '\e942';
content: "\e942";
}
.icon-zone:before {
content: '\e943';
content: "\e943";
}
.icon-greuge:before {
content: '\e944';
content: "\e944";
}
.icon-ticketAdd:before {
content: '\e945';
content: "\e945";
}
.icon-components:before {
content: '\e946';
content: "\e946";
}
.icon-pets:before {
content: '\e947';
content: "\e947";
}
.icon-linesprepaired:before {
content: '\e948';
content: "\e948";
}
.icon-control:before {
content: '\e949';
content: "\e949";
}
.icon-revision:before {
content: '\e94a';
content: "\e94a";
}
.icon-deaulter:before {
content: '\e94b';
content: "\e94b";
}
.icon-services:before {
content: '\e94c';
content: "\e94c";
}
.icon-albaran:before {
content: '\e94d';
content: "\e94d";
}
.icon-solunion:before {
content: '\e94e';
content: "\e94e";
}
.icon-stowaway:before {
content: '\e94f';
content: "\e94f";
}
.icon-apps:before {
content: '\e951';
content: "\e951";
}
.icon-info:before {
content: '\e952';
content: "\e952";
}
.icon-columndelete:before {
content: '\e953';
content: "\e953";
}
.icon-columnadd:before {
content: '\e954';
content: "\e954";
}
.icon-deleteline:before {
content: '\e955';
content: "\e955";
}
.icon-item:before {
content: '\e956';
content: "\e956";
}
.icon-worker:before {
content: '\e957';
content: "\e957";
}
.icon-headercol:before {
content: '\e958';
content: "\e958";
}
.icon-reserva:before {
content: '\e959';
content: "\e959";
}
.icon-100:before {
content: '\e95a';
content: "\e95a";
}
.icon-sign:before {
content: '\e95d';
content: "\e95d";
}
.icon-polizon:before {
content: '\e95e';
content: "\e95e";
}
.icon-solclaim:before {
content: '\e95f';
content: "\e95f";
}
.icon-actions:before {
content: '\e960';
content: "\e960";
}
.icon-details:before {
content: '\e961';
content: "\e961";
}
.icon-traceability:before {
content: '\e962';
content: "\e962";
}
.icon-claims:before {
content: '\e963';
content: "\e963";
}
.icon-regentry:before {
content: '\e964';
content: "\e964";
}
.icon-transaction:before {
content: '\e966';
content: "\e966";
}
.icon-History:before {
content: '\e968';
content: "\e968";
}
.icon-mana:before {
content: '\e96a';
content: "\e96a";
}
.icon-ticket:before {
content: '\e96b';
content: "\e96b";
}
.icon-niche:before {
content: '\e96c';
content: "\e96c";
}
.icon-tags:before {
content: '\e96d';
content: "\e96d";
}
.icon-volume:before {
content: '\e96e';
content: "\e96e";
}
.icon-bin:before {
content: '\e96f';
content: "\e96f";
}
.icon-splur:before {
content: '\e970';
content: "\e970";
}
.icon-barcode:before {
content: '\e971';
content: "\e971";
}
.icon-botanical:before {
content: '\e972';
content: "\e972";
}
.icon-clone:before {
content: '\e973';
content: "\e973";
}
.icon-sms:before {
content: '\e975';
content: "\e975";
}
.icon-eye:before {
content: '\e976';
content: "\e976";
}
.icon-doc:before {
content: '\e977';
content: "\e977";
}
.icon-package:before {
content: '\e978';
content: "\e978";
}
.icon-settings:before {
content: '\e979';
content: "\e979";
}
.icon-bucket:before {
content: '\e97a';
content: "\e97a";
}
.icon-mandatory:before {
content: '\e97b';
content: "\e97b";
}
.icon-recovery:before {
content: '\e97c';
content: "\e97c";
}
.icon-payment:before {
content: '\e97e';
content: "\e97e";
}
.icon-grid:before {
content: '\e980';
content: "\e980";
}
.icon-web:before {
content: '\e982';
content: "\e982";
}
.icon-dfiscales:before {
content: '\e984';
content: "\e984";
}

View File

@ -8,8 +8,13 @@ export default {
backToDashboard: 'Return to dashboard',
notifications: 'Notifications',
userPanel: 'User panel',
favoriteModules: 'Favorite modules',
theme: 'Theme',
logOut: 'Log out',
dataSaved: 'Data saved',
},
moduleIndex: {
allModules: 'All modules'
},
errors: {
statusUnauthorized: 'Access denied',

View File

@ -8,8 +8,13 @@ export default {
backToDashboard: 'Volver al tablón',
notifications: 'Notificaciones',
userPanel: 'Panel de usuario',
favoriteModules: 'Módulos favoritos',
theme: 'Tema',
logOut: 'Cerrar sesión',
dataSaved: 'Datos guardados',
},
moduleIndex: {
allModules: 'Todos los módulos'
},
errors: {
statusUnauthorized: 'Acceso denegado',

View File

@ -15,7 +15,7 @@ const miniState = ref(true);
@mouseover="miniState = false"
@mouseout="miniState = true"
mini-to-overlay
:width="200"
:width="256"
:breakpoint="500"
>
<q-scroll-area class="fit text-grey-8">

View File

@ -1,13 +1,14 @@
<script setup>
import { useI18n } from 'vue-i18n';
import { ref } from 'vue';
import { useState } from 'src/composables/useState';
import LeftMenu from 'src/components/LeftMenu.vue';
import { useNavigation } from 'src/composables/useNavigation';
const { t } = useI18n();
const state = useState();
const miniState = ref(true);
const slide = ref('style');
const slideText = 'Description text';
const modules = useNavigation();
</script>
<template>
@ -18,7 +19,7 @@ const slideText = 'Description text';
@mouseover="miniState = false"
@mouseout="miniState = true"
mini-to-overlay
:width="200"
:width="256"
:breakpoint="500"
>
<q-scroll-area class="fit text-grey-8">
@ -27,75 +28,63 @@ const slideText = 'Description text';
</q-drawer>
<q-page-container>
<q-page class="q-pa-md">
<q-banner v-if="$q.screen.gt.xs" inline-actions rounded class="bg-orange text-white q-mb-lg">
<!-- <q-banner v-if="$q.screen.gt.xs" inline-actions rounded class="bg-orange text-white q-mb-lg">
Employee notification message
<template #action>
<q-btn flat label="Dismiss" />
</template>
</q-banner>
</q-banner> -->
<div class="row items-start wrap q-col-gutter-md q-mb-lg">
<div class="col-12 col-md">
<div class="text-h6 text-grey-8 q-mb-sm">Responsive monitor</div>
<q-carousel
v-model="slide"
transition-prev="scale"
transition-next="scale"
swipeable
animated
control-color="white"
navigation
padding
arrows
height="300px"
class="bg-orange-3 text-white shadow-1 rounded-borders"
>
<q-carousel-slide name="style" class="column no-wrap flex-center">
<q-icon name="style" size="56px" />
<div class="q-mt-md text-center">{{ slideText }}</div>
</q-carousel-slide>
<q-carousel-slide name="tv" class="column no-wrap flex-center">
<q-icon name="live_tv" size="56px" />
<div class="q-mt-md text-center">{{ slideText }}</div>
</q-carousel-slide>
<q-carousel-slide name="layers" class="column no-wrap flex-center">
<q-icon name="layers" size="56px" />
<div class="q-mt-md text-center">{{ slideText }}</div>
</q-carousel-slide>
<q-carousel-slide name="map" class="column no-wrap flex-center">
<q-icon name="terrain" size="56px" />
<div class="q-mt-md text-center">{{ slideText }}</div>
</q-carousel-slide>
</q-carousel>
</div>
<div class="col-12 col-md">
<div class="text-h6 text-grey-8 q-mb-sm">Responsive monitor</div>
<q-card class="q-pa-md">Dashboard page..</q-card>
</div>
<div class="col-12 col-md">
<div class="text-h6 text-grey-8 q-mb-sm">Responsive monitor</div>
<q-card class="q-pa-md">Dashboard page..</q-card>
</div>
</div>
<div class="row items-start q-col-gutter-md q-mb-lg">
<div class="col-12 col-md">
<div class="text-h6 text-grey-8 q-mb-sm">Responsive monitor</div>
<q-card class="q-pa-md">Dashboard page..</q-card>
</div>
<div class="col-12 col-md">
<div class="text-h6 text-grey-8 q-mb-sm">Responsive monitor</div>
<q-card class="q-pa-md">Dashboard page..</q-card>
</div>
</div>
<div class="row items-start q-col-gutter-md q-mb-lg">
<div class="col">
<div class="text-h6 text-grey-8 q-mb-sm">Responsive monitor</div>
<q-card class="q-pa-md">Dashboard page..</q-card>
<div class="col-12 col-md" v-if="modules.favorites.value.length">
<div class="text-h6 text-grey-8 q-mb-sm">{{ t('globals.favoriteModules') }}</div>
<q-card class="row flex-container">
<div
v-for="module of modules.favorites.value"
:key="module.title"
class="row no-wrap q-pa-xs flex-item"
>
<q-btn
align="evenly"
padding="16px"
flat
stack
size="lg"
:icon="module.icon"
color="orange-6"
class="col-4 button"
:to="{ name: module.stateName }"
>
<div class="text-center text-orange-6 button-text">
{{ t(`${module.name}.pageTitles.${module.title}`) }}
</div>
</q-btn>
</div>
</q-card>
</div>
</div>
</q-page>
</q-page-container>
</template>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.flex-container {
display: flex;
flex-wrap: wrap;
justify-content: center;
max-height: 300px;
overflow: auto;
}
.flex-item {
width: 100px;
}
.button {
width: 100%;
line-height: normal;
align-items: center;
}
.button-text {
font-size: 10px;
margin-top: 5px;
}
</style>

View File

@ -15,7 +15,7 @@ const miniState = ref(true);
@mouseover="miniState = false"
@mouseout="miniState = true"
mini-to-overlay
:width="200"
:width="256"
:breakpoint="500"
>
<q-scroll-area class="fit text-grey-8">

View File

@ -4,6 +4,7 @@ export default {
path: '/customer',
name: 'Customer',
meta: {
roles: ['developer'],
title: 'customers',
icon: 'vn:client'
},

View File

@ -4,6 +4,7 @@ export default {
path: '/ticket',
name: 'Ticket',
meta: {
roles: ['developer'],
title: 'tickets',
icon: 'vn:ticket'
},

View File

@ -1,13 +1,59 @@
/// <reference types="cypress" />
describe('Login', () => {
beforeEach(() => {
cy.visit('/#/login');
});
it('should log in', () => {
cy.get('input[aria-label="Username"]').type('developer')
cy.get('input[aria-label="Password"]').type('nightmare')
cy.get('button[type="submit"]').click()
it('should fail to log in using wrong user', () => {
cy.get('input[aria-label="Username"]').type('incorrectUser');
cy.get('input[aria-label="Password"]').type('nightmare');
cy.get('button[type="submit"]').click();
cy.get('.q-notification__message').should('have.text', 'Invalid username or password');
});
it('should fail to log in using wrong password', () => {
cy.get('input[aria-label="Username"]').type('employee');
cy.get('input[aria-label="Password"]').type('wrongPassword');
cy.get('button[type="submit"]').click();
cy.get('.q-notification__message').should('have.text', 'Invalid username or password');
});
it('should log in', () => {
cy.get('input[aria-label="Username"]').type('employee');
cy.get('input[aria-label="Password"]').type('nightmare');
cy.get('button[type="submit"]').click();
cy.get('.q-notification__message').should('have.text', 'You have successfully logged in');
cy.url().should('contain', '/dashboard');
});
it('should log out', () => {
cy.get('input[aria-label="Username"]').type('employee');
cy.get('input[aria-label="Password"]').type('nightmare');
cy.get('button[type="submit"]').click();
cy.get('.q-notification__message').should('have.text', 'You have successfully logged in');
cy.url().should('contain', '/dashboard');
cy.get('#user').click();
cy.get('#logout').click();
cy.window().its('localStorage').invoke('getItem', 'token').should('not.exist');
cy.url().should('contain', '/login');
})
it(`should get redirected to dashboard since employee can't create tickets`, () => {
cy.visit('/#/ticket/create', { failOnStatusCode: false });
cy.url().should('contain', '/#/login?redirect=/ticket/create');
cy.get('input[aria-label="Username"]').type('employee');
cy.get('input[aria-label="Password"]').type('nightmare');
cy.get('button[type="submit"]').click();
cy.url().should('contain', '/dashboard');
})
// ticket creation is not yet implemented, use this test once it is
// it(`should get redirected to ticket creation after login since salesPerson can do it`, () => {
// cy.visit('/#/ticket/create', { failOnStatusCode: false });
// cy.url().should('contain', '/#/login?redirect=/ticket/create');
// cy.get('input[aria-label="Username"]').type('salesPerson');
// cy.get('input[aria-label="Password"]').type('nightmare');
// cy.get('button[type="submit"]').click();
// cy.url().should('contain', '/#/ticket/create');
// })
});

View File

@ -27,4 +27,17 @@
// DO NOT REMOVE
// Imports Quasar Cypress AE predefined commands
import { registerCommands } from '@quasar/quasar-app-extension-testing-e2e-cypress';
Cypress.Commands.add('login', (user) => {
cy.visit('/#/login');
cy.request({
method: 'POST',
url: '/api/accounts/login',
body: {
user: user,
password: 'nightmare'
}
}).then(response => {
window.localStorage.setItem('token', response.body.token);
})
})
registerCommands();