refs #6153 test - master #86

Merged
jgallego merged 98 commits from test into master 2023-08-29 07:48:24 +00:00
44 changed files with 2218 additions and 2730 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "salix-front", "name": "salix-front",
"version": "23.32.01", "version": "23.34.01",
"description": "Salix frontend", "description": "Salix frontend",
"productName": "Salix", "productName": "Salix",
"author": "Verdnatura", "author": "Verdnatura",

View File

@ -64,7 +64,7 @@ const onResponseError = (error) => {
const url = hash.slice(1); const url = hash.slice(1);
Router.push({ path: url }); Router.push({ path: url });
} else if (!session.isLoggedIn()) { } else if (!session.isLoggedIn()) {
message = 'login.loginError'; return Promise.reject(error);
} }
Notify.create({ Notify.create({

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import axios from 'axios'; import axios from 'axios';
import { onMounted, ref, computed } from 'vue'; import { onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { QSeparator, useQuasar } from 'quasar'; import { QSeparator, useQuasar } from 'quasar';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
@ -31,7 +31,7 @@ function findMatches(search, item) {
const matches = []; const matches = [];
function findRoute(search, item) { function findRoute(search, item) {
for (const child of item.children) { for (const child of item.children) {
if (search.indexOf(child.name) > -1) { if (search?.indexOf(child.name) > -1) {
matches.push(child); matches.push(child);
} else if (child.children) { } else if (child.children) {
findRoute(search, child); findRoute(search, child);
@ -55,10 +55,6 @@ function addChildren(module, route, parent) {
} }
} }
const pinnedItems = computed(() => {
return items.value.filter((item) => item.isPinned);
});
const items = ref([]); const items = ref([]);
function getRoutes() { function getRoutes() {
if (props.source === 'main') { if (props.source === 'main') {
@ -115,14 +111,19 @@ async function togglePinned(item, event) {
</script> </script>
<template> <template>
<QList padding> <QList padding class="column-max-width">
<template v-if="$props.source === 'main'"> <template v-if="$props.source === 'main'">
<QItemLabel header> <template v-if="$route?.matched[1]?.name === 'Dashboard'">
{{ t('globals.pinnedModules') }} <QItem class="header">
</QItemLabel> <QItemSection avatar>
<template v-for="item in pinnedItems" :key="item.name"> <QIcon name="view_module" />
</QItemSection>
<QItemSection> {{ t('globals.modules') }}</QItemSection>
</QItem>
<QSeparator />
<template v-for="item in items" :key="item.name">
<template v-if="item.children"> <template v-if="item.children">
<LeftMenuItemGroup :item="item" group="pinnedModules" class="pinned"> <LeftMenuItem :item="item" group="modules">
<template #side> <template #side>
<QBtn <QBtn
v-if="item.isPinned === true" v-if="item.isPinned === true"
@ -132,9 +133,9 @@ async function togglePinned(item, event) {
flat flat
round round
> >
<QTooltip>{{ <QTooltip>
t('components.leftMenu.removeFromPinned') {{ t('components.leftMenu.removeFromPinned') }}
}}</QTooltip> </QTooltip>
</QBtn> </QBtn>
<QBtn <QBtn
v-if="item.isPinned === false" v-if="item.isPinned === false"
@ -144,19 +145,31 @@ async function togglePinned(item, event) {
flat flat
round round
> >
<QTooltip>{{ <QTooltip>
t('components.leftMenu.addToPinned') {{ t('components.leftMenu.addToPinned') }}
}}</QTooltip> </QTooltip>
</QBtn> </QBtn>
</template> </template>
</LeftMenuItemGroup> </LeftMenuItem>
</template>
</template>
</template> </template>
<LeftMenuItem v-if="!item.children" :item="item" />
</template>
<QSeparator />
<QExpansionItem :label="t('moduleIndex.allModules')">
<template v-for="item in items" :key="item.name"> <template v-for="item in items" :key="item.name">
<template v-if="item.name === $route?.matched[1]?.name">
<QItem class="header">
<QItemSection avatar v-if="item.icon">
<QIcon :name="item.icon" />
</QItemSection>
<QItemSection avatar v-if="!item.icon">
<QIcon name="disabled_by_default" />
</QItemSection>
<QItemSection>{{ t(item.title) }}</QItemSection>
<QItemSection side>
<slot name="side" :item="item" />
</QItemSection>
</QItem>
<QSeparator />
<template v-if="item.children"> <template v-if="item.children">
<LeftMenuItemGroup :item="item" group="modules"> <LeftMenuItemGroup :item="item" group="modules">
<template #side> <template #side>
@ -188,8 +201,7 @@ async function togglePinned(item, event) {
</LeftMenuItemGroup> </LeftMenuItemGroup>
</template> </template>
</template> </template>
</QExpansionItem> </template>
<QSeparator />
</template> </template>
<template v-if="$props.source === 'card'"> <template v-if="$props.source === 'card'">
<template v-for="item in items" :key="item.name"> <template v-for="item in items" :key="item.name">
@ -199,7 +211,7 @@ async function togglePinned(item, event) {
</QList> </QList>
</template> </template>
<style> <style scoped>
.pinned .q-btn { .pinned .q-btn {
visibility: hidden; visibility: hidden;
} }
@ -207,4 +219,10 @@ async function togglePinned(item, event) {
.pinned:hover .q-btn { .pinned:hover .q-btn {
visibility: visible; visibility: visible;
} }
.column-max-width {
max-width: 256px;
}
.header {
color: #999999;
}
</style> </style>

View File

@ -22,5 +22,8 @@ const item = computed(() => props.item); // eslint-disable-line vue/no-dupe-keys
<QIcon name="disabled_by_default" /> <QIcon name="disabled_by_default" />
</QItemSection> </QItemSection>
<QItemSection>{{ t(item.title) }}</QItemSection> <QItemSection>{{ t(item.title) }}</QItemSection>
<QItemSection side>
<slot name="side" :item="item" />
</QItemSection>
</QItem> </QItem>
</template> </template>

View File

@ -1,12 +1,7 @@
<script setup> <script setup>
import { computed } from 'vue'; import { computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import LeftMenuItem from './LeftMenuItem.vue'; import LeftMenuItem from './LeftMenuItem.vue';
const route = useRoute();
const { t } = useI18n();
const props = defineProps({ const props = defineProps({
item: { item: {
type: Object, type: Object,
@ -19,33 +14,9 @@ const props = defineProps({
}); });
const item = computed(() => props.item); // eslint-disable-line vue/no-dupe-keys const item = computed(() => props.item); // eslint-disable-line vue/no-dupe-keys
const isOpened = computed(() => {
const { matched } = route;
const { name } = item.value;
return matched.some((item) => item.name === name);
});
</script> </script>
<template> <template>
<QExpansionItem
:group="props.group"
active-class="text-primary"
:label="item.title"
:to="{ name: item.name }"
expand-separator
:default-opened="isOpened"
>
<template #header>
<QItemSection avatar>
<QIcon :name="item.icon"></QIcon>
</QItemSection>
<QItemSection>{{ t(item.title) }}</QItemSection>
<QItemSection side>
<slot name="side" :item="item" />
</QItemSection>
</template>
<template v-for="section in item.children" :key="section.name"> <template v-for="section in item.children" :key="section.name">
<LeftMenuItem :item="section" /> <LeftMenuItem :item="section" />
</template> </template>
</QExpansionItem>
</template> </template>

View File

@ -1,21 +1,25 @@
<script setup> <script setup>
import { onMounted } from 'vue'; import { onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import UserPanel from 'components/UserPanel.vue';
import { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useQuasar } from 'quasar';
import PinnedModules from './PinnedModules.vue'; import PinnedModules from './PinnedModules.vue';
import UserPanel from 'components/UserPanel.vue';
const { t } = useI18n(); const { t } = useI18n();
const session = useSession(); const session = useSession();
const stateStore = useStateStore(); const stateStore = useStateStore();
const quasar = useQuasar();
const state = useState(); const state = useState();
const user = state.getUser(); const user = state.getUser();
const token = session.getToken(); const token = session.getToken();
const appName = 'Lilium'; const appName = 'Lilium';
onMounted(() => stateStore.setMounted()); onMounted(() => stateStore.setMounted());
const pinnedModulesRef = ref();
</script> </script>
<template> <template>
@ -56,11 +60,21 @@ onMounted(() => stateStore.setMounted());
<QSpace /> <QSpace />
<div class="q-pl-sm q-gutter-sm row items-center no-wrap"> <div class="q-pl-sm q-gutter-sm row items-center no-wrap">
<div id="actions-prepend"></div> <div id="actions-prepend"></div>
<QBtn
flat
v-if="!quasar.platform.is.mobile"
@click="pinnedModulesRef.redirect($route.params.id)"
icon="more_up"
>
<QTooltip>
{{ t('Go to Salix') }}
</QTooltip>
</QBtn>
<QBtn id="pinnedModules" icon="apps" flat dense rounded> <QBtn id="pinnedModules" icon="apps" flat dense rounded>
<QTooltip bottom> <QTooltip bottom>
{{ t('globals.pinnedModules') }} {{ t('globals.pinnedModules') }}
</QTooltip> </QTooltip>
<PinnedModules /> <PinnedModules ref="pinnedModulesRef" />
</QBtn> </QBtn>
<QBtn rounded dense flat no-wrap id="user"> <QBtn rounded dense flat no-wrap id="user">
<QAvatar size="lg"> <QAvatar size="lg">
@ -80,3 +94,10 @@ onMounted(() => stateStore.setMounted());
</QToolbar> </QToolbar>
</QHeader> </QHeader>
</template> </template>
<i18n>
en:
Go to Salix: Go to Salix
es:
Go to Salix: Ir a Salix
</i18n>

View File

@ -2,69 +2,91 @@
import { onMounted, computed } from 'vue'; import { onMounted, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useNavigationStore } from 'src/stores/useNavigationStore'; import { useNavigationStore } from 'src/stores/useNavigationStore';
import { getUrl } from 'src/composables/getUrl';
import { useRoute } from 'vue-router';
const navigation = useNavigationStore(); const navigation = useNavigationStore();
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute();
onMounted(() => { onMounted(() => {
navigation.fetchPinned(); navigation.fetchPinned();
}); });
defineExpose({
redirect,
});
const pinnedModules = computed(() => navigation.getPinnedModules()); const pinnedModules = computed(() => navigation.getPinnedModules());
async function redirect() {
if (route.path == '/dashboard') return (window.location.href = await getUrl(''));
let section = route.path.substring(1);
section = section.substring(0, section.indexOf('/'));
if (route?.params?.id)
return (window.location.href = await getUrl(
`${section}/${route.params.id}/summary`
));
return (window.location.href = await getUrl(section + '/index'));
}
</script> </script>
<template> <template>
<QMenu <QMenu anchor="bottom left" max-width="300px" max-height="400px">
anchor="bottom left" <div v-if="pinnedModules.length >= 0" class="row justify-around q-pa-md">
class="row q-pa-md q-col-gutter-lg" <QBtn
max-width="350px" flat
max-height="400px" stack
> size="lg"
<template v-if="pinnedModules.length"> icon="more_up"
<div class="col-5"
v-for="item of pinnedModules" @click="redirect($route.params.id)"
:key="item.title" >
class="row no-wrap q-pa-xs flex-item" <div class="text-center button-text">Salix</div>
> </QBtn>
<QBtn flat stack size="lg" icon="home" class="col-5" to="/">
<div class="text-center button-text">{{ t('Home') }}</div>
</QBtn>
<div class="row col-12 justify-around q-mt-md">
<QBtn <QBtn
align="evenly"
padding="16px"
flat flat
stack stack
size="lg" size="lg"
:icon="item.icon" :icon="item.icon"
color="primary" color="primary"
class="col-4 button" class="col-5"
:to="{ name: item.name }" :to="{ name: item.name }"
v-for="item of pinnedModules"
:key="item.title"
> >
<div class="text-center text-primary button-text"> <div class="text-center text-primary button-text">
{{ t(item.title) }} {{ t(item.title) }}
</div> </div>
</QBtn> </QBtn>
</div> </div>
</template> </div>
<template v-else> <div v-else>
<div <div
class="row no-wrap q-pa-xs flex-item text-center text-grey-5" class="row no-wrap q-pa-xs flex-item text-center text-grey-5"
style="min-width: 200px" style="min-width: 200px"
> >
{{ t('globals.noPinnedModules') }} {{ t('globals.noPinnedModules') }}
</div> </div>
</template> </div>
</QMenu> </QMenu>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.flex-item {
width: 100px;
}
.button {
width: 100%;
line-height: normal;
align-items: center;
}
.button-text { .button-text {
font-size: 10px; font-size: 10px;
margin-top: 5px; margin-top: 5px;
} }
</style> </style>
<i18n>
en:
Home: Home
es:
Home: Inicio
</i18n>

View File

@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n';
import axios from 'axios'; import axios from 'axios';
import SkeletonDescriptor from 'components/ui/SkeletonDescriptor.vue'; import SkeletonDescriptor from 'components/ui/SkeletonDescriptor.vue';
const props = defineProps({ const $props = defineProps({
url: { url: {
type: String, type: String,
default: '', default: '',
@ -17,6 +17,14 @@ const props = defineProps({
type: String, type: String,
required: true, required: true,
}, },
title: {
type: String,
default: '',
},
subtitle: {
type: Number,
default: 0,
},
}); });
const slots = useSlots(); const slots = useSlots();
@ -30,15 +38,15 @@ const entity = ref();
async function fetch() { async function fetch() {
const params = {}; const params = {};
if (props.filter) params.filter = JSON.stringify(props.filter); if ($props.filter) params.filter = JSON.stringify($props.filter);
const { data } = await axios.get(props.url, { params }); const { data } = await axios.get($props.url, { params });
entity.value = data; entity.value = data;
emit('onFetch', data); emit('onFetch', data);
} }
watch(props, async () => { watch($props, async () => {
entity.value = null; entity.value = null;
await fetch(); await fetch();
}); });
@ -49,14 +57,30 @@ watch(props, async () => {
<template v-if="entity"> <template v-if="entity">
<div class="header bg-primary q-pa-sm"> <div class="header bg-primary q-pa-sm">
<RouterLink :to="{ name: `${module}List` }"> <RouterLink :to="{ name: `${module}List` }">
<QBtn round flat dense size="md" icon="view_list" color="white"> <QBtn
round
flat
dense
size="md"
icon="view_list"
color="white"
class="link"
>
<QTooltip> <QTooltip>
{{ t('components.cardDescriptor.mainList') }} {{ t('components.cardDescriptor.mainList') }}
</QTooltip> </QTooltip>
</QBtn> </QBtn>
</RouterLink> </RouterLink>
<RouterLink :to="{ name: `${module}Summary`, params: { id: entity.id } }"> <RouterLink :to="{ name: `${module}Summary`, params: { id: entity.id } }">
<QBtn round flat dense size="md" icon="launch" color="white"> <QBtn
round
flat
dense
size="md"
icon="launch"
color="white"
class="link"
>
<QTooltip> <QTooltip>
{{ t('components.cardDescriptor.summary') }} {{ t('components.cardDescriptor.summary') }}
</QTooltip> </QTooltip>
@ -86,21 +110,33 @@ watch(props, async () => {
<div class="body q-py-sm"> <div class="body q-py-sm">
<QList dense> <QList dense>
<QItemLabel header class="ellipsis text-h5" :lines="1"> <QItemLabel header class="ellipsis text-h5" :lines="1">
<slot name="description" :entity="entity"> <div class="title">
<span> <span v-if="$props.title" :title="$props.title">
{{ $props.title }}
</span>
<slot v-else name="description" :entity="entity">
<span :title="entity.name">
{{ entity.name }} {{ entity.name }}
<QTooltip>{{ entity.name }}</QTooltip>
</span> </span>
</slot> </slot>
</div>
</QItemLabel> </QItemLabel>
<QItem dense> <QItem dense>
<QItemLabel class="text-subtitle2" caption> <QItemLabel class="subtitle" caption>
#{{ entity.id }} #{{ $props.subtitle ?? entity.id }}
</QItemLabel> </QItemLabel>
</QItem> </QItem>
</QList> </QList>
<div class="list-box q-mt-xs">
<slot name="body" :entity="entity" /> <slot name="body" :entity="entity" />
</div> </div>
</div>
<div class="icons">
<slot name="icons" :entity="entity" />
</div>
<div class="actions">
<slot name="actions" :entity="entity" />
</div>
<slot name="after" /> <slot name="after" />
</template> </template>
<!-- Skeleton --> <!-- Skeleton -->
@ -110,24 +146,82 @@ watch(props, async () => {
<style lang="scss"> <style lang="scss">
.body { .body {
.q-card__actions {
justify-content: center;
}
.text-h5 { .text-h5 {
padding-top: 5px; padding-top: 5px;
padding-bottom: 5px; padding-bottom: 5px;
} }
.q-item {
min-height: 20px;
.link {
margin-left: 5px;
}
}
.vn-label-value {
display: flex;
padding: 2px 16px;
.label {
color: var(--vn-label);
font-size: 12px;
width: 47%;
}
.value {
color: var(--vn-text);
font-size: 14px;
margin-left: 12px;
width: 47%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.info {
margin-left: 5px;
}
}
} }
</style> </style>
<style lang="scss" scoped> <style lang="scss" scoped>
.title {
overflow: hidden;
text-overflow: ellipsis;
span {
color: $primary;
font-weight: bold;
}
}
.subtitle {
color: var(--vn-text);
font-size: 16px;
margin-bottom: 15px;
}
.list-box {
width: 90%;
background-color: var(--vn-gray);
margin: 10px auto;
padding: 10px 5px 10px 0px;
border-radius: 8px;
.q-item__label {
color: var(--vn-label);
}
}
.descriptor { .descriptor {
width: 256px; width: 256px;
.header { .header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: stretch; align-items: stretch;
} }
.icons {
margin: 0 10px;
display: flex;
justify-content: center;
.q-icon {
margin-right: 5px;
}
}
.actions {
margin: 0 5px;
}
} }
</style> </style>

View File

@ -0,0 +1,83 @@
<script setup>
const $props = defineProps({
id: { type: Number, default: null },
title: { type: String, default: null },
});
</script>
<template>
<QCard class="card q-mb-md cursor-pointer q-hoverable bg-white-7 q-pa-lg">
<div>
<slot name="title">
<div class="title text-primary text-weight-bold text-h5">
{{ $props.title ?? `#${$props.id}` }}
</div>
</slot>
<div class="card-list-body row">
<div class="list-items row flex-wrap-wrap q-mt-md">
<slot name="list-items" />
</div>
<div class="actions column justify-center">
<slot name="actions" />
</div>
</div>
</div>
</QCard>
</template>
<style lang="scss">
.card-list-body {
.vn-label-value {
display: flex;
justify-content: flex-start;
gap: 2%;
width: 50%;
.label {
width: 30%;
color: var(--vn-label);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.value {
width: 60%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.actions {
.q-btn {
width: 30px;
}
.q-icon {
color: $primary;
font-size: 25px;
}
}
}
@media (max-width: $breakpoint-xs) {
.card-list-body {
.vn-label-value {
width: 100%;
}
}
}
</style>
<style lang="scss" scoped>
.card {
transition: background-color 0.2s;
}
.card:hover {
background-color: var(--vn-gray);
}
.list-items {
width: 90%;
}
@media (max-width: $breakpoint-xs) {
.list-items {
width: 85%;
}
}
</style>

View File

@ -2,6 +2,8 @@
import { onMounted, ref, watch } from 'vue'; import { onMounted, ref, watch } from 'vue';
import axios from 'axios'; import axios from 'axios';
import SkeletonSummary from 'components/ui/SkeletonSummary.vue'; import SkeletonSummary from 'components/ui/SkeletonSummary.vue';
import VnLv from 'src/components/ui/VnLv.vue';
onMounted(() => fetch()); onMounted(() => fetch());
const entity = ref(); const entity = ref();
@ -41,15 +43,21 @@ watch(props, async () => {
<template> <template>
<div class="summary container"> <div class="summary container">
<QCard> <QCard class="cardSummary">
<SkeletonSummary v-if="!entity" /> <SkeletonSummary v-if="!entity" />
<template v-if="entity"> <template v-if="entity">
<div class="header bg-primary q-pa-sm q-mb-md"> <div class="summaryHeader bg-primary q-pa-md text-weight-bolder">
<slot name="header-left">
<span></span>
</slot>
<slot name="header" :entity="entity"> <slot name="header" :entity="entity">
{{ entity.id }} - {{ entity.name }} <VnLv :label="`${entity.id} -`" :value="entity.name" />
</slot>
<slot name="header-right">
<span></span>
</slot> </slot>
</div> </div>
<div class="body q-pa-md q-mb-md"> <div class="summaryBody row q-mb-md">
<slot name="body" :entity="entity" /> <slot name="body" :entity="entity" />
</div> </div>
</template> </template>
@ -63,57 +71,87 @@ watch(props, async () => {
justify-content: center; justify-content: center;
} }
.summary { .cardSummary {
.q-card {
width: 100%; width: 100%;
max-width: 1200px; .summaryHeader {
} text-align: center;
font-size: 20px;
.negative {
color: red;
}
.q-list {
.q-item__label--header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
}
.summaryBody {
display: flex;
flex-direction: row;
justify-content: space-evenly;
gap: 15px;
padding: 15px;
a { > .q-card.vn-one {
color: $primary; flex: 1;
} }
> .q-card.vn-two {
flex: 2;
} }
> .q-card.vn-three {
flex: 3;
}
> .q-card.vn-max {
width: 100%;
} }
.body > .q-card__section.row { > .q-card {
flex-wrap: wrap; width: 100%;
background-color: var(--vn-gray);
padding: 15px;
font-size: 16px;
min-width: 275px;
& > .col { .vn-label-value {
min-width: 250px; display: flex;
flex-direction: row;
margin-top: 5px;
.label {
color: var(--vn-label);
width: 10em;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin-right: 10px;
}
.value {
color: var(--vn-text);
width: max-content;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
} }
} }
.header { .header {
text-align: center; color: $primary;
font-size: 18px; font-weight: bold;
} margin-bottom: 25px;
font-size: 20px;
#slider-container { display: inline-block;
max-width: 80%;
margin: 0 auto;
.q-slider {
.q-slider__marker-labels:nth-child(1) {
transform: none;
}
.q-slider__marker-labels:nth-child(2) {
transform: none;
left: auto !important;
right: 0%;
} }
.header.link:hover {
color: lighten($primary, 20%);
} }
} }
} }
.q-dialog .summary { @media (max-width: $breakpoint-xs) {
max-width: 1200px; .summaryBody {
padding: 0;
}
}
}
</style>
<style lang="scss" scoped>
.summaryHeader .vn-label-value {
display: flex;
flex-direction: row;
}
.summaryHeader {
color: $white;
} }
</style> </style>

View File

@ -0,0 +1,44 @@
<script setup>
import { computed } from 'vue';
import { dashIfEmpty } from 'src/filters';
const $props = defineProps({
label: { type: String, default: null },
value: { type: [Number, String, Boolean], default: null },
titleLabel: { type: String, default: null },
titleValue: { type: [Number, String, Boolean], default: null },
info: { type: String, default: null },
dash: { type: Boolean, default: true },
});
const isBooleanValue = computed(() => typeof $props.value === 'boolean');
</script>
<template>
<div class="vn-label-value">
<div v-if="$props.label || $slots.label" class="label">
<slot name="label">
<span :title="$props.titleLabel ?? $props.label">{{ $props.label }}</span>
</slot>
</div>
<div class="value">
<span v-if="isBooleanValue">
<QIcon
:name="$props.value ? `check` : `close`"
:color="$props.value ? `positive` : `negative`"
size="sm"
/>
</span>
<slot v-else name="value">
<span :title="$props.value">
{{ $props.dash ? dashIfEmpty($props.value) : $props.value }}
</span>
</slot>
</div>
<div class="info" v-if="$props.info">
<QIcon name="info">
<QTooltip class="bg-dark text-white shadow-4" :offset="[10, 10]">
{{ $props.info }}
</QTooltip>
</QIcon>
</div>
</div>
</template>

View File

@ -0,0 +1,8 @@
export default function useCardDescription(title, subtitle) {
const getTitle = (title) => title;
const getSubtitle = (subtitle) => subtitle;
return {
title: getTitle(title),
subtitle: getSubtitle(subtitle),
};
}

View File

@ -0,0 +1,30 @@
import { ref, computed } from 'vue';
const user = ref({});
export function useLogin() {
function getUser() {
const userData = user.value;
user.value = {};
return computed(() => {
return {
user: userData.user,
password: userData.password,
keepLogin: userData.keepLogin,
};
});
}
function setUser(data) {
user.value = {
user: data.user,
password: data.password,
keepLogin: data.keepLogin,
};
}
return {
getUser,
setUser,
};
}

View File

@ -26,7 +26,16 @@ select:-webkit-autofill {
body.body--light { body.body--light {
.q-header .q-toolbar { .q-header .q-toolbar {
background-color: white; background-color: $white;
color: #555; color: #555;
} }
--vn-text: #000000;
--vn-gray: #f5f5f5;
--vn-label: #5f5f5f;
}
body.body--dark {
--vn-text: #ffffff;
--vn-gray: #313131;
--vn-label: #a8a8a8;
} }

View File

@ -12,15 +12,33 @@
// to match your app's branding. // to match your app's branding.
// Tip: Use the "Theme Builder" on Quasar's documentation website. // Tip: Use the "Theme Builder" on Quasar's documentation website.
$primary: #ff9800; $primary: #ec8916;
$secondary: #26a69a; $secondary: #26a69a;
$accent: #9c27b0; $accent: #9c27b0;
$white: #fff;
$positive: #21ba45; $positive: #21ba45;
$negative: #c10015; $negative: #c10015;
$info: #31ccec; $info: #31ccec;
$warning: #f2c037; $warning: #f2c037;
// Pendiente de cuadrar con la base de datos
$success: $positive;
$alert: $negative;
.bg-success {
background-color: $positive;
}
.bg-notice {
background-color: $info;
}
.text-notice {
color: $info;
}
.bg-alert {
background-color: $negative;
}
$color-spacer-light: rgba(255, 255, 255, 0.12); $color-spacer-light: rgba(255, 255, 255, 0.12);
$color-spacer: rgba(255, 255, 255, 0.3); $color-spacer: rgba(255, 255, 255, 0.3);
$border-thin-light: 1px solid $color-spacer-light; $border-thin-light: 1px solid $color-spacer-light;

View File

@ -9,6 +9,7 @@ export default {
backToDashboard: 'Return to dashboard', backToDashboard: 'Return to dashboard',
notifications: 'Notifications', notifications: 'Notifications',
userPanel: 'User panel', userPanel: 'User panel',
modules: 'Modules',
pinnedModules: 'Pinned modules', pinnedModules: 'Pinned modules',
darkMode: 'Dark mode', darkMode: 'Dark mode',
logOut: 'Log out', logOut: 'Log out',
@ -32,9 +33,9 @@ export default {
rowRemoved: 'Row removed', rowRemoved: 'Row removed',
pleaseWait: 'Please wait...', pleaseWait: 'Please wait...',
noPinnedModules: 'You have dont have any pinned modules', noPinnedModules: 'You have dont have any pinned modules',
summary: {
basicData: 'Basic data',
}, },
moduleIndex: {
allModules: 'All modules',
}, },
errors: { errors: {
statusUnauthorized: 'Access denied', statusUnauthorized: 'Access denied',
@ -51,6 +52,20 @@ export default {
loginSuccess: 'You have successfully logged in', loginSuccess: 'You have successfully logged in',
loginError: 'Invalid username or password', loginError: 'Invalid username or password',
fieldRequired: 'This field is required', fieldRequired: 'This field is required',
twoFactorRequired: 'Two-factor verification required',
pageTitles: {
logIn: 'Login',
},
},
twoFactor: {
code: 'Code',
validate: 'Validate',
insert: 'Enter the verification code',
explanation:
'Please, enter the verification code that we have sent to your email in the next 5 minutes',
pageTitles: {
twoFactor: 'Two-Factor',
},
}, },
dashboard: { dashboard: {
pageTitles: { pageTitles: {
@ -142,6 +157,8 @@ export default {
balanceDue: 'Balance due', balanceDue: 'Balance due',
balanceDueInfo: 'Deviated invoices minus payments', balanceDueInfo: 'Deviated invoices minus payments',
recoverySince: 'Recovery since', recoverySince: 'Recovery since',
businessType: 'Business Type',
city: 'City',
}, },
basicData: { basicData: {
socialName: 'Fiscal name', socialName: 'Fiscal name',
@ -163,6 +180,7 @@ export default {
basicData: 'Basic Data', basicData: 'Basic Data',
boxing: 'Boxing', boxing: 'Boxing',
sms: 'Sms', sms: 'Sms',
notes: 'Notes',
}, },
list: { list: {
nickname: 'Nickname', nickname: 'Nickname',
@ -232,6 +250,7 @@ export default {
requester: 'Requester', requester: 'Requester',
atender: 'Atender', atender: 'Atender',
request: 'Request', request: 'Request',
weight: 'Weight',
goTo: 'Go to', goTo: 'Go to',
}, },
}, },
@ -270,6 +289,9 @@ export default {
ticketId: 'Ticket ID', ticketId: 'Ticket ID',
customerSummary: 'Customer summary', customerSummary: 'Customer summary',
claimedTicket: 'Claimed ticket', claimedTicket: 'Claimed ticket',
commercial: 'Commercial',
province: 'Province',
zone: 'Zone',
}, },
summary: { summary: {
customer: 'Customer', customer: 'Customer',
@ -325,11 +347,14 @@ export default {
list: { list: {
ref: 'Reference', ref: 'Reference',
issued: 'Issued', issued: 'Issued',
shortIssued: 'Issued',
amount: 'Amount', amount: 'Amount',
client: 'Client', client: 'Client',
created: 'Created', created: 'Created',
shortCreated: 'Created',
company: 'Company', company: 'Company',
dued: 'Due date', dued: 'Due date',
shortDued: 'Due date',
}, },
card: { card: {
issued: 'Issued', issued: 'Issued',
@ -396,6 +421,7 @@ export default {
userId: 'User ID', userId: 'User ID',
role: 'Role', role: 'Role',
sipExtension: 'Extension', sipExtension: 'Extension',
locker: 'Locker',
}, },
notificationsManager: { notificationsManager: {
activeNotifications: 'Active notifications', activeNotifications: 'Active notifications',

View File

@ -9,6 +9,7 @@ export default {
backToDashboard: 'Volver al tablón', backToDashboard: 'Volver al tablón',
notifications: 'Notificaciones', notifications: 'Notificaciones',
userPanel: 'Panel de usuario', userPanel: 'Panel de usuario',
modules: 'Módulos',
pinnedModules: 'Módulos fijados', pinnedModules: 'Módulos fijados',
darkMode: 'Modo oscuro', darkMode: 'Modo oscuro',
logOut: 'Cerrar sesión', logOut: 'Cerrar sesión',
@ -32,9 +33,9 @@ export default {
rowRemoved: 'Fila eliminada', rowRemoved: 'Fila eliminada',
pleaseWait: 'Por favor, espera...', pleaseWait: 'Por favor, espera...',
noPinnedModules: 'No has fijado ningún módulo', noPinnedModules: 'No has fijado ningún módulo',
summary: {
basicData: 'Datos básicos',
}, },
moduleIndex: {
allModules: 'Todos los módulos',
}, },
errors: { errors: {
statusUnauthorized: 'Acceso denegado', statusUnauthorized: 'Acceso denegado',
@ -51,6 +52,20 @@ export default {
loginSuccess: 'Inicio de sesión correcto', loginSuccess: 'Inicio de sesión correcto',
loginError: 'Nombre de usuario o contraseña incorrectos', loginError: 'Nombre de usuario o contraseña incorrectos',
fieldRequired: 'Este campo es obligatorio', fieldRequired: 'Este campo es obligatorio',
twoFactorRequired: 'Verificación de doble factor requerida',
pageTitles: {
logIn: 'Inicio de sesión',
},
},
twoFactor: {
code: 'Código',
validate: 'Validar',
insert: 'Introduce el código de verificación',
explanation:
'Por favor, introduce el código de verificación que te hemos enviado a tu email en los próximos 5 minutos',
pageTitles: {
twoFactor: 'Doble factor',
},
}, },
dashboard: { dashboard: {
pageTitles: { pageTitles: {
@ -107,7 +122,7 @@ export default {
province: 'Provincia', province: 'Provincia',
country: 'País', country: 'País',
street: 'Calle', street: 'Calle',
isEqualizated: 'Equalizado', isEqualizated: 'Recargo de equivalencia',
isActive: 'Activo', isActive: 'Activo',
invoiceByAddress: 'Facturar por consignatario', invoiceByAddress: 'Facturar por consignatario',
verifiedData: 'Datos verificados', verifiedData: 'Datos verificados',
@ -141,6 +156,8 @@ export default {
balanceDue: 'Saldo vencido', balanceDue: 'Saldo vencido',
balanceDueInfo: 'Facturas fuera de plazo menos recibos', balanceDueInfo: 'Facturas fuera de plazo menos recibos',
recoverySince: 'Recobro desde', recoverySince: 'Recobro desde',
businessType: 'Tipo de negocio',
city: 'Población',
}, },
basicData: { basicData: {
socialName: 'Nombre fiscal', socialName: 'Nombre fiscal',
@ -162,6 +179,7 @@ export default {
basicData: 'Datos básicos', basicData: 'Datos básicos',
boxing: 'Encajado', boxing: 'Encajado',
sms: 'Sms', sms: 'Sms',
notes: 'Notas',
}, },
list: { list: {
nickname: 'Alias', nickname: 'Alias',
@ -231,6 +249,7 @@ export default {
requester: 'Solicitante', requester: 'Solicitante',
atender: 'Comprador', atender: 'Comprador',
request: 'Petición de compra', request: 'Petición de compra',
weight: 'Peso',
goTo: 'Ir a', goTo: 'Ir a',
}, },
}, },
@ -269,6 +288,9 @@ export default {
ticketId: 'ID ticket', ticketId: 'ID ticket',
customerSummary: 'Resumen del cliente', customerSummary: 'Resumen del cliente',
claimedTicket: 'Ticket reclamado', claimedTicket: 'Ticket reclamado',
commercial: 'Comercial',
province: 'Provincia',
zone: 'Zona',
}, },
summary: { summary: {
customer: 'Cliente', customer: 'Cliente',
@ -325,11 +347,14 @@ export default {
list: { list: {
ref: 'Referencia', ref: 'Referencia',
issued: 'Fecha emisión', issued: 'Fecha emisión',
shortIssued: 'F. emisión',
amount: 'Importe', amount: 'Importe',
client: 'Cliente', client: 'Cliente',
created: 'Fecha creación', created: 'Fecha creación',
shortCreated: 'F. creación',
company: 'Empresa', company: 'Empresa',
dued: 'Fecha vencimineto', dued: 'Fecha vencimineto',
shortDued: 'F. vencimiento',
}, },
card: { card: {
issued: 'Fecha emisión', issued: 'Fecha emisión',
@ -396,6 +421,7 @@ export default {
userId: 'ID del usuario', userId: 'ID del usuario',
role: 'Rol', role: 'Rol',
sipExtension: 'Extensión', sipExtension: 'Extensión',
locker: 'Taquilla',
}, },
notificationsManager: { notificationsManager: {
activeNotifications: 'Notificaciones activas', activeNotifications: 'Notificaciones activas',

111
src/layouts/OutLayout.vue Normal file
View File

@ -0,0 +1,111 @@
<script setup>
import { Dark, Quasar } from 'quasar';
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
const { t, locale } = useI18n();
const userLocale = computed({
get() {
return locale.value;
},
set(value) {
locale.value = value;
if (value === 'en') value = 'en-GB';
// FIXME: Dynamic imports from absolute paths are not compatible with vite:
// https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations
try {
const langList = import.meta.glob('../../node_modules/quasar/lang/*.mjs');
langList[`../../node_modules/quasar/lang/${value}.mjs`]().then((lang) => {
Quasar.lang.set(lang.default);
});
} catch (error) {
//
}
},
});
const darkMode = computed({
get() {
return Dark.isActive;
},
set(value) {
Dark.set(value);
},
});
const langs = ['en', 'es'];
</script>
<template>
<QLayout view="hHh LpR fFf">
<QHeader reveal class="bg-dark">
<QToolbar class="justify-end">
<QBtn
id="switchLanguage"
:label="t('globals.language')"
icon="translate"
color="primary"
size="sm"
flat
rounded
>
<QMenu auto-close>
<QList dense v-for="lang in langs" :key="lang">
<QItem
@click="userLocale = lang"
:active="userLocale == lang"
v-ripple
clickable
>
{{ t(`globals.lang.${lang}`) }}
</QItem>
</QList>
</QMenu>
</QBtn>
<QList>
<QItem>
<QItemSection>
<QToggle
v-model="darkMode"
checked-icon="dark_mode"
unchecked-icon="light_mode"
:label="t(`globals.darkMode`)"
/>
</QItemSection>
</QItem>
</QList>
</QToolbar>
</QHeader>
<QPageContainer>
<QPage>
<div class="form">
<QCard class="q-pa-lg formCard">
<RouterView></RouterView>
</QCard>
</div>
</QPage>
</QPageContainer>
</QLayout>
</template>
<style lang="scss" scoped>
.form {
display: flex;
align-items: center;
justify-content: center;
min-height: inherit;
flex-direction: column;
}
.formCard {
max-width: 350px;
min-width: 300px;
}
@media (max-width: $breakpoint-xs-max) {
.formCard {
min-width: 100%;
}
}
</style>

View File

@ -1,12 +1,14 @@
<script setup> <script setup>
import { computed } from 'vue'; import { ref, computed } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { toDate } from 'src/filters'; import { toDate } from 'src/filters';
import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue'; import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import ClaimDescriptorMenu from 'pages/Claim/Card/ClaimDescriptorMenu.vue'; import ClaimDescriptorMenu from 'pages/Claim/Card/ClaimDescriptorMenu.vue';
import CardDescriptor from 'components/ui/CardDescriptor.vue'; import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import useCardDescription from 'src/composables/useCardDescription';
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -25,11 +27,29 @@ const entityId = computed(() => {
const filter = { const filter = {
include: [ include: [
{ relation: 'client' }, {
{ relation: 'claimState' }, relation: 'client',
scope: {
include: { relation: 'salesPersonUser' },
},
},
{ {
relation: 'claimState', relation: 'claimState',
}, },
{
relation: 'ticket',
scope: {
include: [
{ relation: 'zone' },
{
relation: 'address',
scope: {
include: { relation: 'province' },
},
},
],
},
},
{ {
relation: 'worker', relation: 'worker',
scope: { scope: {
@ -40,10 +60,14 @@ const filter = {
}; };
function stateColor(code) { function stateColor(code) {
if (code === 'pending') return 'green'; if (code === 'pending') return 'positive';
if (code === 'managed') return 'orange'; if (code === 'managed') return 'warning';
if (code === 'resolved') return 'red'; if (code === 'resolved') return 'negative';
} }
const data = ref(useCardDescription());
const setData = (entity) => {
data.value = useCardDescription(entity.client.name, entity.id);
};
</script> </script>
<template> <template>
@ -52,54 +76,58 @@ function stateColor(code) {
:url="`Claims/${entityId}`" :url="`Claims/${entityId}`"
:filter="filter" :filter="filter"
module="Claim" module="Claim"
:title="data.title"
:subtitle="data.subtitle"
@on-fetch="setData"
> >
<template #menu="{ entity }"> <template #menu="{ entity }">
<ClaimDescriptorMenu :claim="entity" /> <ClaimDescriptorMenu :claim="entity" />
</template> </template>
<template #description="{ entity }">
<span>
{{ entity.client.name }}
<QTooltip>{{ entity.client.name }}</QTooltip>
</span>
</template>
<template #body="{ entity }"> <template #body="{ entity }">
<QList> <VnLv :label="t('claim.card.created')" :value="toDate(entity.created)" />
<QItem> <VnLv v-if="entity.claimState" :label="t('claim.card.state')">
<QItemSection> <template #value>
<QItemLabel caption>{{ t('claim.card.created') }}</QItemLabel>
<QItemLabel>{{ toDate(entity.created) }}</QItemLabel>
</QItemSection>
<QItemSection v-if="entity.claimState">
<QItemLabel caption>{{ t('claim.card.state') }}</QItemLabel>
<QItemLabel>
<QBadge :color="stateColor(entity.claimState.code)" dense> <QBadge :color="stateColor(entity.claimState.code)" dense>
{{ entity.claimState.description }} {{ entity.claimState.description }}
</QBadge> </QBadge>
</QItemLabel> </template>
</QItemSection> </VnLv>
</QItem> <VnLv :label="t('claim.card.ticketId')">
<QItem> <template #value>
<QItemSection>
<QItemLabel caption>
{{ t('claim.card.ticketId') }}
</QItemLabel>
<QItemLabel>
<span class="link"> <span class="link">
{{ entity.ticketFk }} {{ entity.ticketFk }}
<TicketDescriptorProxy :id="entity.ticketFk" /> <TicketDescriptorProxy :id="entity.ticketFk" />
</span> </span>
</QItemLabel> </template>
</QItemSection> </VnLv>
<QItemSection v-if="entity.worker"> <VnLv
<QItemLabel caption> v-if="entity.worker"
{{ t('claim.card.assignedTo') }} :label="t('claim.card.assignedTo')"
</QItemLabel> :value="entity.worker.user.name"
<QItemLabel>{{ entity.worker.user.name }}</QItemLabel> >
</QItemSection> <template #value>
</QItem> <span class="link">
</QList> {{ entity.worker.user.name }}
<WorkerDescriptorProxy :id="entity.worker.userFk" />
</span>
</template>
</VnLv>
<VnLv :label="t('claim.card.commercial')">
<template #value>
<span class="link">
{{ entity.client.salesPersonUser.name }}
<WorkerDescriptorProxy :id="entity.client.salesPersonFk" />
</span>
</template>
</VnLv>
<VnLv
:label="t('claim.card.province')"
:value="entity.ticket.address.province.name"
/>
<VnLv :label="t('claim.card.zone')" :value="entity.ticket.zone.name" />
</template>
<template #actions="{ entity }">
<QCardActions> <QCardActions>
<QBtn <QBtn
size="md" size="md"
@ -121,3 +149,8 @@ function stateColor(code) {
</template> </template>
</CardDescriptor> </CardDescriptor>
</template> </template>
<style scoped>
.q-item__label {
margin-top: 0;
}
</style>

View File

@ -1,12 +1,14 @@
<script setup> <script setup>
import { ref, computed } from 'vue'; import { onMounted, ref, computed } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { toDate, toCurrency } from 'src/filters'; import { toDate, toCurrency } from 'src/filters';
import CardSummary from 'components/ui/CardSummary.vue'; import CardSummary from 'components/ui/CardSummary.vue';
import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import { getUrl } from 'src/composables/getUrl';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnLv from 'src/components/ui/VnLv.vue';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
@ -22,6 +24,14 @@ const $props = defineProps({
const entityId = computed(() => $props.id || route.params.id); const entityId = computed(() => $props.id || route.params.id);
const claimUrl = ref();
const salixUrl = ref();
onMounted(async () => {
salixUrl.value = await getUrl('');
claimUrl.value = salixUrl.value + `claim/${entityId.value}/`;
});
const detailsColumns = ref([ const detailsColumns = ref([
{ {
name: 'item', name: 'item',
@ -155,78 +165,52 @@ function openDialog(dmsId) {
<template #header="{ entity: { claim } }"> <template #header="{ entity: { claim } }">
{{ claim.id }} - {{ claim.client.name }} {{ claim.id }} - {{ claim.client.name }}
</template> </template>
<template #body="{ entity: { developments, observations, claim, salesClaimed } }"> <template #body="{ entity: { claim, salesClaimed, developments } }">
<QCardSection class="row q-pa-none q-col-gutter-md"> <QCard class="vn-one">
<div class="col"> <a class="header" :href="`#/claim/${entityId}/basic-data`">
<QList> {{ t('claim.pageTitles.basicData') }}
<QItem> <QIcon name="open_in_new" color="primary" />
<QItemSection> </a>
<QItemLabel caption> <VnLv
{{ t('claim.summary.created') }} :label="t('claim.summary.created')"
</QItemLabel> :value="toDate(claim.created)"
<QItemLabel>{{ toDate(claim.created) }}</QItemLabel> />
</QItemSection> <VnLv :label="t('claim.summary.state')">
<QItemSection v-if="claim.claimState"> <template #value>
<QItemLabel caption> <QChip :color="stateColor(claim.claimState.code)" dense>
{{ t('claim.summary.state') }}
</QItemLabel>
<QItemLabel>
<QChip
:color="stateColor(claim.claimState.code)"
dense
>
{{ claim.claimState.description }} {{ claim.claimState.description }}
</QChip> </QChip>
</QItemLabel> </template>
</QItemSection> </VnLv>
</QItem> <VnLv :label="t('claim.summary.assignedTo')">
<QItem> <template #value>
<QItemSection v-if="claim.worker && claim.worker.user">
<QItemLabel caption>
{{ t('claim.summary.assignedTo') }}
</QItemLabel>
<QItemLabel>
<span class="link"> <span class="link">
{{ claim.worker.user.nickname }} {{ claim.worker.user.nickname }}
<WorkerDescriptorProxy :id="claim.workerFk" /> <WorkerDescriptorProxy :id="claim.workerFk" />
</span> </span>
</QItemLabel> </template>
</QItemSection> </VnLv>
<QItemSection <VnLv :label="t('claim.summary.attendedBy')">
v-if="claim.client && claim.client.salesPersonUser" <template #value>
>
<QItemLabel caption>
{{ t('claim.summary.attendedBy') }}
</QItemLabel>
<QItemLabel>
<span class="link"> <span class="link">
{{ claim.client.salesPersonUser.name }} {{ claim.client.salesPersonUser.name }}
<WorkerDescriptorProxy <WorkerDescriptorProxy :id="claim.client.salesPersonFk" />
:id="claim.client.salesPersonFk"
/>
</span> </span>
</QItemLabel> </template>
</QItemSection> </VnLv>
</QItem> </QCard>
</QList> <QCard class="vn-one">
</div> <a class="header" :href="claimUrl + 'note/index'">
</QCardSection> {{ t('claim.summary.notes') }}
<QCardSection class="q-pa-md" v-if="observations.length > 0"> <QIcon name="open_in_new" color="primary" />
<h6>{{ t('claim.summary.notes') }}</h6> </a>
<div class="note-list" v-for="note in observations" :key="note.id"> <!-- Use VnNotes and maybe VirtualScroll-->
<div class="note-caption"> </QCard>
<span <QCard class="vn-max" v-if="salesClaimed.length > 0">
>{{ note.worker.firstName }} {{ note.worker.lastName }} <a class="header" :href="claimUrl + 'note/index'">
</span> {{ t('claim.summary.details') }}
<span>{{ toDate(note.created) }}</span> <QIcon name="open_in_new" color="primary" />
</div> </a>
<div class="note-text">
<span>{{ note.text }}</span>
</div>
</div>
</QCardSection>
<QCardSection class="q-pa-md" v-if="salesClaimed.length > 0">
<h6>{{ t('claim.summary.details') }}</h6>
<QTable :columns="detailsColumns" :rows="salesClaimed" flat> <QTable :columns="detailsColumns" :rows="salesClaimed" flat>
<template #header="props"> <template #header="props">
<QTr :props="props"> <QTr :props="props">
@ -236,16 +220,19 @@ function openDialog(dmsId) {
</QTr> </QTr>
</template> </template>
</QTable> </QTable>
</QCardSection> </QCard>
<QCardSection class="q-pa-md" v-if="claimDms.length > 0"> <QCard class="vn-max" v-if="claimDms.length > 0">
<h6>{{ t('claim.summary.photos') }}</h6> <a class="header" :href="`#/claim/${entityId}/photos`">
{{ t('claim.summary.photos') }}
<QIcon name="open_in_new" color="primary" />
</a>
<div class="container"> <div class="container">
<div class="multimediaParent bg-transparent">
<div <div
class="multimedia-container"
v-for="(media, index) of claimDms" v-for="(media, index) of claimDms"
:key="index" :key="index"
class="relative-position"
> >
<div class="relative-position">
<QIcon <QIcon
name="play_circle" name="play_circle"
color="primary" color="primary"
@ -275,9 +262,12 @@ function openDialog(dmsId) {
</div> </div>
</div> </div>
</div> </div>
</QCardSection> </QCard>
<QCardSection class="q-pa-md" v-if="developments.length > 0"> <QCard class="vn-two" v-if="developments.length > 0">
<h6>{{ t('claim.summary.development') }}</h6> <a class="header" :href="claimUrl + 'development'">
{{ t('claim.summary.development') }}
<QIcon name="open_in_new" color="primary" />
</a>
<QTable :columns="developmentColumns" :rows="developments" flat> <QTable :columns="developmentColumns" :rows="developments" flat>
<template #header="props"> <template #header="props">
<QTr :props="props"> <QTr :props="props">
@ -287,11 +277,13 @@ function openDialog(dmsId) {
</QTr> </QTr>
</template> </template>
</QTable> </QTable>
</QCardSection> </QCard>
<QCardSection class="q-pa-md"> <QCard class="vn-max" v-if="developments.length > 0">
<h6>{{ t('claim.summary.actions') }}</h6> <a class="header" :href="claimUrl + 'action'">
<QSeparator /> {{ t('claim.summary.actions') }}
<div id="slider-container"> <QIcon name="open_in_new" color="primary" />
</a>
<div id="slider-container" class="q-px-xl q-py-md">
<QSlider <QSlider
v-model="claim.responsibility" v-model="claim.responsibility"
label label
@ -308,7 +300,21 @@ function openDialog(dmsId) {
readonly readonly
/> />
</div> </div>
</QCardSection> </QCard>
<!-- <QCardSection class="q-pa-md" v-if="observations.length > 0">
<h6>{{ t('claim.summary.notes') }}</h6>
<div class="note-list" v-for="note in observations" :key="note.id">
<div class="note-caption">
<span
>{{ note.worker.firstName }} {{ note.worker.lastName }}
</span>
<span>{{ toDate(note.created) }}</span>
</div>
<div class="note-text">
<span>{{ note.text }}</span>
</div>
</div>
</QCardSection> -->
<QDialog <QDialog
v-model="multimediaDialog" v-model="multimediaDialog"
transition-show="slide-up" transition-show="slide-up"
@ -352,22 +358,19 @@ function openDialog(dmsId) {
</CardSummary> </CardSummary>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.container {
min-width: 80%;
}
.q-dialog__inner--minimized > div { .q-dialog__inner--minimized > div {
max-width: 80%; max-width: 80%;
} }
.container {
.multimediaParent { display: flex;
display: grid; flex-direction: row;
grid-template-columns: repeat(auto-fill, minmax(500px, 1fr)); flex-wrap: wrap;
gap: 15px;
grid-auto-rows: auto; flex-basis: 30%;
}
grid-gap: 1rem; .multimedia-container {
flex: 1 0 21%;
} }
.multimedia { .multimedia {
transition: all 0.5s; transition: all 0.5s;
opacity: 1; opacity: 1;
@ -395,18 +398,4 @@ function openDialog(dmsId) {
.zindex { .zindex {
z-index: 1; z-index: 1;
} }
.note-list {
width: 100%;
border: 0.1rem solid $grey-7;
padding: 0.5rem;
margin-bottom: 0.5rem;
}
.note-caption {
display: flex;
justify-content: space-between;
margin-bottom: 0.5rem;
color: $grey-7;
}
</style> </style>

View File

@ -9,6 +9,8 @@ import ClaimSummaryDialog from './Card/ClaimSummaryDialog.vue';
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import ClaimFilter from './ClaimFilter.vue'; import ClaimFilter from './ClaimFilter.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import CardList from 'src/components/ui/CardList.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const router = useRouter(); const router = useRouter();
@ -74,50 +76,28 @@ function viewSummary(id) {
auto-load auto-load
> >
<template #body="{ rows }"> <template #body="{ rows }">
<QCard class="card q-mb-md" v-for="row of rows" :key="row.id"> <CardList
<QItem v-for="row of rows"
class="q-pa-none items-start cursor-pointer q-hoverable" :key="row.id"
v-ripple :title="row.clientName"
clickable @click="navigate(row.id)"
> >
<QItemSection class="q-pa-md" @click="navigate(row.id)"> <template #list-items>
<div class="text-h6 link"> <VnLv label="ID" :value="row.id" />
{{ row.clientName }} <VnLv
</div> :label="t('claim.list.customer')"
<QItemLabel caption>#{{ row.id }}</QItemLabel> :value="row.clientName"
<QList> />
<QItem class="q-pa-none"> <VnLv
<QItemSection> :label="t('claim.list.assignedTo')"
<QItemLabel caption> :value="row.workerName"
{{ t('claim.list.customer') }} />
</QItemLabel> <VnLv
<QItemLabel> :label="t('claim.list.created')"
{{ row.clientName }} :value="toDate(row.created)"
</QItemLabel> />
</QItemSection> <VnLv :label="t('claim.list.state')">
<QItemSection> <template #value>
<QItemLabel caption>
{{ t('claim.list.assignedTo') }}
</QItemLabel>
<QItemLabel>
{{ row.workerName }}
</QItemLabel>
</QItemSection>
</QItem>
<QItem class="q-pa-none">
<QItemSection>
<QItemLabel caption>
{{ t('claim.list.created') }}
</QItemLabel>
<QItemLabel>
{{ toDate(row.created) }}
</QItemLabel>
</QItemSection>
<QItemSection>
<QItemLabel caption>
{{ t('claim.list.state') }}
</QItemLabel>
<QItemLabel>
<QBadge <QBadge
:color="stateColor(row.stateCode)" :color="stateColor(row.stateCode)"
class="q-ma-none" class="q-ma-none"
@ -125,65 +105,33 @@ function viewSummary(id) {
> >
{{ row.stateDescription }} {{ row.stateDescription }}
</QBadge> </QBadge>
</QItemLabel> </template>
</QItemSection> </VnLv>
</QItem> </template>
</QList> <template #actions>
</QItemSection>
<QSeparator vertical />
<QCardActions vertical class="justify-between">
<!-- <QBtn color="grey-7" round flat icon="more_vert">
<QTooltip>{{ t('customer.list.moreOptions') }}</QTooltip>
<QMenu cover auto-close>
<QList>
<QItem clickable>
<QItemSection avatar>
<QIcon name="add" />
</QItemSection>
<QItemSection>Add a note</QItemSection>
</QItem>
<QItem clickable>
<QItemSection avatar>
<QIcon name="logs" />
</QItemSection>
<QItemSection>Display claim logs</QItemSection>
</QItem>
</QList>
</QMenu>
</QBtn> -->
<QBtn <QBtn
flat flat
round
color="orange"
icon="arrow_circle_right" icon="arrow_circle_right"
@click="navigate(row.id)" @click.stop="navigate(row.id)"
> >
<QTooltip> <QTooltip>
{{ t('components.smartCard.openCard') }} {{ t('components.smartCard.openCard') }}
</QTooltip> </QTooltip>
</QBtn> </QBtn>
<QBtn <QBtn flat icon="preview" @click.stop="viewSummary(row.id)">
flat
round
color="grey-7"
icon="preview"
@click="viewSummary(row.id)"
>
<QTooltip> <QTooltip>
{{ t('components.smartCard.openSummary') }} {{ t('components.smartCard.openSummary') }}
</QTooltip> </QTooltip>
</QBtn> </QBtn>
<QBtn flat round color="grey-7" icon="vn:client"> <QBtn flat icon="vn:client" @click.stop>
<QTooltip> <QTooltip>
{{ t('components.smartCard.viewDescription') }} {{ t('components.smartCard.viewDescription') }}
</QTooltip> </QTooltip>
<CustomerDescriptorProxy :id="row.clientFk" /> <CustomerDescriptorProxy :id="row.clientFk" />
</QBtn> </QBtn>
</QCardActions> </template>
</QItem> </CardList>
</QCard>
</template> </template>
</VnPaginate> </VnPaginate>
</div> </div>

View File

@ -1,10 +1,12 @@
<script setup> <script setup>
import { computed } from 'vue'; import { ref, computed } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { toCurrency } from 'src/filters'; import { toCurrency } from 'src/filters';
import CardDescriptor from 'components/ui/CardDescriptor.vue'; import CardDescriptor from 'components/ui/CardDescriptor.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import useCardDescription from 'src/composables/useCardDescription';
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -20,57 +22,38 @@ const { t } = useI18n();
const entityId = computed(() => { const entityId = computed(() => {
return $props.id || route.params.id; return $props.id || route.params.id;
}); });
const data = ref(useCardDescription());
const setData = (entity) => (data.value = useCardDescription(entity.name, entity.id));
</script> </script>
<template> <template>
<CardDescriptor module="Customer" :url="`Clients/${entityId}/getCard`"> <CardDescriptor
module="Customer"
:url="`Clients/${entityId}/getCard`"
:title="data.title"
:subtitle="data.subtitle"
@on-fetch="setData"
>
<template #body="{ entity }"> <template #body="{ entity }">
<QList dense> <VnLv v-if="entity.salesPersonUser" :label="t('customer.card.salesPerson')">
<QItem v-if="entity.salesPersonUser" class="row"> <template #value>
<QItemLabel class="col" caption>
{{ t('customer.card.salesPerson') }}
</QItemLabel>
<QItemLabel class="col q-ma-none">
<span class="link"> <span class="link">
{{ entity.salesPersonUser.name }} {{ entity.salesPersonUser.name }}
<WorkerDescriptorProxy :id="entity.salesPersonFk" /> <WorkerDescriptorProxy :id="entity.salesPersonFk" />
</span> </span>
</QItemLabel> </template>
</QItem> </VnLv>
<QItem class="row"> <VnLv :label="t('customer.card.credit')" :value="toCurrency(entity.credit)" />
<QItemLabel class="col" caption> <VnLv
{{ t('customer.card.credit') }} :label="t('customer.card.securedCredit')"
</QItemLabel> :value="toCurrency(entity.creditInsurance)"
<QItemLabel class="col q-ma-none"> />
{{ toCurrency(entity.credit) }} <VnLv :label="t('customer.card.payMethod')" :value="entity.payMethod.name" />
</QItemLabel> <VnLv :label="t('customer.card.debt')" :value="toCurrency(entity.debt)" />
</QItem> </template>
<QItem class="row"> <template #icons="{ entity }">
<QItemLabel class="col" caption> <QCardActions>
{{ t('customer.card.securedCredit') }}
</QItemLabel>
<QItemLabel class="col q-ma-none">
{{ toCurrency(entity.creditInsurance) }}
</QItemLabel>
</QItem>
<QItem v-if="entity.payMethod" class="row">
<QItemLabel class="col" caption>
{{ t('customer.card.payMethod') }}
</QItemLabel>
<QItemLabel class="col q-ma-none">
{{ entity.payMethod.name }}
</QItemLabel>
</QItem>
<QItem class="row">
<QItemLabel class="col" caption>
{{ t('customer.card.debt') }}
</QItemLabel>
<QItemLabel class="col q-ma-none">
{{ toCurrency(entity.debt) }}
</QItemLabel>
</QItem>
</QList>
<QCardActions class="q-gutter-md">
<QIcon <QIcon
v-if="entity.isActive == false" v-if="entity.isActive == false"
name="vn:disabled" name="vn:disabled"
@ -103,15 +86,9 @@ const entityId = computed(() => {
> >
<QTooltip>{{ t('customer.card.notChecked') }}</QTooltip> <QTooltip>{{ t('customer.card.notChecked') }}</QTooltip>
</QIcon> </QIcon>
<QIcon
v-if="entity.account && entity.account.active == false"
name="vn:noweb"
size="xs"
color="primary"
>
<QTooltip>{{ t('customer.card.noWebAccess') }}</QTooltip>
</QIcon>
</QCardActions> </QCardActions>
</template>
<template #actions="{ entity }">
<QCardActions> <QCardActions>
<QBtn <QBtn
:to="{ :to="{
@ -135,23 +112,10 @@ const entityId = computed(() => {
> >
<QTooltip>{{ t('invoiceOutList') }}</QTooltip> <QTooltip>{{ t('invoiceOutList') }}</QTooltip>
</QBtn> </QBtn>
<!--
<QBtn size="md" icon="vn:basketadd" color="primary">
<QTooltip>Order list</QTooltip>
</QBtn>
<QBtn size="md" icon="face" color="primary">
<QTooltip>View user</QTooltip>
</QBtn>
<QBtn size="md" icon="expand_more" color="primary">
<QTooltip>More options</QTooltip>
</QBtn> -->
</QCardActions> </QCardActions>
</template> </template>
</CardDescriptor> </CardDescriptor>
</template> </template>
<i18n> <i18n>
{ {
"en": { "en": {

View File

@ -1,9 +1,11 @@
<script setup> <script setup>
import { computed, ref } from 'vue'; import { computed, ref, onMounted } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { toCurrency, toPercentage, toDate } from 'src/filters'; import { toCurrency, toPercentage, toDate } from 'src/filters';
import CardSummary from 'components/ui/CardSummary.vue'; import CardSummary from 'components/ui/CardSummary.vue';
import { getUrl } from 'src/composables/getUrl';
import VnLv from 'src/components/ui/VnLv.vue';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
@ -16,8 +18,13 @@ const $props = defineProps({
}); });
const entityId = computed(() => $props.id || route.params.id); const entityId = computed(() => $props.id || route.params.id);
const summary = ref();
const customer = computed(() => summary.value.entity); const customer = computed(() => summary.value.entity);
const summary = ref();
const clientUrl = ref();
onMounted(async () => {
clientUrl.value = (await getUrl('client/')) + entityId.value + '/';
});
const balanceDue = computed(() => { const balanceDue = computed(() => {
return ( return (
@ -38,7 +45,7 @@ const priceIncreasingRate = computed(() => {
}); });
const debtWarning = computed(() => { const debtWarning = computed(() => {
return customer.value.debt.debt > customer.value.credit ? 'negative' : ''; return customer.value?.debt?.debt > customer.value.credit ? 'negative' : '';
}); });
const creditWarning = computed(() => { const creditWarning = computed(() => {
@ -53,478 +60,212 @@ const creditWarning = computed(() => {
<template> <template>
<CardSummary ref="summary" :url="`Clients/${entityId}/summary`"> <CardSummary ref="summary" :url="`Clients/${entityId}/summary`">
<template #body="{ entity }"> <template #body="{ entity }">
<QCardSection class="row q-pa-none QCol-gutter-md"> <QCard class="vn-one">
<div class="col"> <a class="header" :href="clientUrl + `basic-data`">
<QList dense>
<QItemLabel header class="text-h6">
{{ t('customer.summary.basicData') }} {{ t('customer.summary.basicData') }}
<RouterLink <QIcon name="open_in_new" color="primary" />
:to="{ </a>
name: 'CustomerBasicData', <VnLv :label="t('customer.summary.customerId')" :value="entity.id" />
params: { id: entity.id }, <VnLv :label="t('customer.summary.name')" :value="entity.name" />
}" <VnLv :label="t('customer.summary.contact')" :value="entity.contact" />
target="_blank" <VnLv :label="t('customer.summary.phone')" :value="entity.phone" />
> <VnLv :label="t('customer.summary.mobile')" :value="entity.mobile" />
<QIcon name="open_in_new" /> <VnLv :label="t('customer.summary.email')" :value="entity.email" />
</RouterLink> <VnLv
</QItemLabel> :label="t('customer.summary.salesPerson')"
<QSeparator class="q-mb-md" /> :value="entity?.salesPersonUser?.name"
/>
<QItem class="row col"> <VnLv
<QItemLabel class="col" caption> :label="t('customer.summary.contactChannel')"
{{ t('customer.summary.customerId') }} :value="entity?.contactChannel?.name"
</QItemLabel> />
<QItemLabel class="col q-ma-none"> <VnLv
{{ entity.id }} :label="t('customer.summary.businessType')"
</QItemLabel> :value="entity.businessType.description"
</QItem> />
<QItem class="row col"> </QCard>
<QItemLabel class="col" caption> <QCard class="vn-one">
{{ t('customer.summary.name') }} <a class="header" :href="clientUrl + `fiscal-data`">
</QItemLabel>
<QItemLabel class="col q-ma-none">
{{ entity.name }}
</QItemLabel>
</QItem>
<QItem class="row col">
<QItemLabel class="col" caption>
{{ t('customer.summary.contact') }}
</QItemLabel>
<QItemLabel class="col q-ma-none">
{{ entity.contact }}
</QItemLabel>
</QItem>
<QItem v-if="entity.salesPersonUser" class="row col">
<QItemLabel class="col" caption>
{{ t('customer.summary.salesPerson') }}
</QItemLabel>
<QItemLabel class="col q-ma-none">
{{ entity.salesPersonUser.name }}
</QItemLabel>
</QItem>
<QItem class="row col">
<QItemLabel class="col" caption>
{{ t('customer.summary.phone') }}
</QItemLabel>
<QItemLabel class="col q-ma-none">
{{ entity.phone }}
</QItemLabel>
</QItem>
<QItem class="row col">
<QItemLabel class="col" caption>
{{ t('customer.summary.mobile') }}
</QItemLabel>
<QItemLabel class="col q-ma-none">{{
entity.mobile
}}</QItemLabel>
</QItem>
<QItem v-if="entity.contactChannel" class="row col">
<QItemLabel class="col" caption>
{{ t('customer.summary.contactChannel') }}
</QItemLabel>
<QItemLabel class="col q-ma-none">
{{ entity.contactChannel.name }}
</QItemLabel>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption>
{{ t('customer.summary.email') }}
</QItemLabel>
<QItemLabel>{{ entity.email }}</QItemLabel>
</QItemSection>
</QItem>
</QList>
</div>
<div class="col">
<QList>
<QItemLabel header class="text-h6">
{{ t('customer.summary.fiscalAddress') }} {{ t('customer.summary.fiscalAddress') }}
</QItemLabel> <QIcon name="open_in_new" color="primary" />
<QItem> </a>
<QItemSection> <VnLv
<QItemLabel caption> :label="t('customer.summary.socialName')"
{{ t('customer.summary.socialName') }} :value="entity.socialName"
</QItemLabel> />
<QItemLabel>{{ entity.socialName }}</QItemLabel> <VnLv :label="t('customer.summary.fiscalId')" :value="entity.fi" />
</QItemSection> <VnLv :label="t('customer.summary.city')" :value="entity.city" />
</QItem> <VnLv :label="t('customer.summary.postcode')" :value="entity.postcode" />
<QItem>
<QItemSection> <VnLv
<QItemLabel caption> v-if="entity.province"
{{ t('customer.summary.fiscalId') }} :label="t('customer.summary.province')"
</QItemLabel> :value="entity.province.name"
<QItemLabel>{{ entity.fi }}</QItemLabel> />
</QItemSection> <VnLv
</QItem> v-if="entity.country"
<QItem> :label="t('customer.summary.country')"
<QItemSection> :value="entity.country.country"
<QItemLabel caption> />
{{ t('customer.summary.postcode') }} <VnLv :label="t('customer.summary.street')" :value="entity.street" />
</QItemLabel> </QCard>
<QItemLabel>{{ entity.postcode }}</QItemLabel> <QCard class="vn-one">
</QItemSection> <a class="header link" :href="clientUrl + `fiscal-data`" link>
</QItem> {{ t('customer.summary.fiscalAddress') }}
<QItem v-if="entity.province"> <QIcon name="open_in_new" color="primary" />
<QItemSection> </a>
<QItemLabel caption> <VnLv
{{ t('customer.summary.province') }}
</QItemLabel>
<QItemLabel>{{ entity.province.name }}</QItemLabel>
</QItemSection>
</QItem>
<QItem v-if="entity.country">
<QItemSection>
<QItemLabel caption>
{{ t('customer.summary.country') }}
</QItemLabel>
<QItemLabel>{{ entity.country.country }}</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption>
{{ t('customer.summary.street') }}
</QItemLabel>
<QItemLabel>{{ entity.street }}</QItemLabel>
</QItemSection>
</QItem>
</QList>
</div>
<div class="col">
<QList>
<QItemLabel header class="text-h6">
{{ t('customer.summary.fiscalData') }}
</QItemLabel>
<QItem dense>
<QCheckbox
v-model="entity.isEqualizated"
:label="t('customer.summary.isEqualizated')" :label="t('customer.summary.isEqualizated')"
disable :value="entity.isEqualizated"
/> />
</QItem> <VnLv :label="t('customer.summary.isActive')" :value="entity.isActive" />
<QItem dense> <VnLv
<QCheckbox
v-model="entity.isActive"
:label="t('customer.summary.isActive')"
disable
/>
</QItem>
<QItem dense>
<QCheckbox
v-model="entity.hasToInvoiceByAddress"
:label="t('customer.summary.invoiceByAddress')" :label="t('customer.summary.invoiceByAddress')"
disable :value="entity.hasToInvoiceByAddress"
/> />
</QItem> <VnLv
<QItem dense>
<QCheckbox
v-model="entity.isTaxDataChecked"
:label="t('customer.summary.verifiedData')" :label="t('customer.summary.verifiedData')"
disable :value="entity.isTaxDataChecked"
/> />
</QItem> <VnLv
<QItem dense>
<QCheckbox
v-model="entity.hasToInvoice"
:label="t('customer.summary.hasToInvoice')" :label="t('customer.summary.hasToInvoice')"
disable :value="entity.hasToInvoice"
/> />
</QItem> <VnLv
<QItem dense>
<QCheckbox
v-model="entity.isToBeMailed"
:label="t('customer.summary.notifyByEmail')" :label="t('customer.summary.notifyByEmail')"
disable :value="entity.isToBeMailed"
/> />
</QItem> <VnLv :label="t('customer.summary.vies')" :value="entity.isVies" />
<QItem dense> </QCard>
<QCheckbox <QCard class="vn-one">
v-model="entity.isVies" <a class="header link" :href="clientUrl + `billing-data`" link>
:label="t('customer.summary.vies')"
disable
/>
</QItem>
</QList>
</div>
<div class="col">
<QList>
<QItemLabel header class="text-h6">
{{ t('customer.summary.billingData') }} {{ t('customer.summary.billingData') }}
</QItemLabel> <QIcon name="open_in_new" color="primary" />
<QItem> </a>
<QItemSection> <VnLv
<QItemLabel caption> :label="t('customer.summary.payMethod')"
{{ t('customer.summary.payMethod') }} :value="entity.payMethod.name"
</QItemLabel>
<QItemLabel>{{ entity.payMethod.name }}</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption>
{{ t('customer.summary.bankAccount') }}
</QItemLabel>
<QItemLabel>{{ entity.iban }}</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption>
{{ t('customer.summary.dueDay') }}
</QItemLabel>
<QItemLabel>{{ entity.dueDay }}</QItemLabel>
</QItemSection>
</QItem>
<QItem dense>
<QCheckbox
v-model="entity.hasLcr"
:label="t('customer.summary.hasLcr')"
disable
/> />
</QItem> <VnLv :label="t('customer.summary.bankAccount')" :value="entity.iban" />
<QItem dense> <VnLv :label="t('customer.summary.dueDay')" :value="entity.dueDay" />
<QCheckbox <VnLv :label="t('customer.summary.hasLcr')" :value="entity.hasLcr" />
v-model="entity.hasCoreVnl" <VnLv
:label="t('customer.summary.hasCoreVnl')" :label="t('customer.summary.hasCoreVnl')"
disable :value="entity.hasCoreVnl"
/> />
</QItem> <VnLv
<QItem dense>
<QCheckbox
v-model="entity.hasSepaVnl"
:label="t('customer.summary.hasB2BVnl')" :label="t('customer.summary.hasB2BVnl')"
disable :value="entity.hasSepaVnl"
/> />
</QItem> </QCard>
</QList> <QCard class="vn-one" v-if="entity.defaultAddress">
</div> <a class="header link" :href="clientUrl + `address/index`" link>
<div class="col" v-if="entity.defaultAddress">
<QList>
<QItemLabel header class="text-h6">
{{ t('customer.summary.consignee') }} {{ t('customer.summary.consignee') }}
</QItemLabel> <QIcon name="open_in_new" color="primary" />
<QItem> </a>
<QItemSection> <VnLv
<QItemLabel caption> :label="t('customer.summary.addressName')"
{{ t('customer.summary.addressName') }} :value="entity.defaultAddress.nickname"
</QItemLabel>
<QItemLabel>
{{ entity.defaultAddress.nickname }}
</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption>
{{ t('customer.summary.addressCity') }}
</QItemLabel>
<QItemLabel>{{ entity.defaultAddress.city }}</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption>
{{ t('customer.summary.addressStreet') }}
</QItemLabel>
<QItemLabel>
{{ entity.defaultAddress.street }}
</QItemLabel>
</QItemSection>
</QItem>
</QList>
</div>
<div class="col" v-if="entity.account">
<QList>
<QItemLabel header class="text-h6">
{{ t('customer.summary.webAccess') }}
</QItemLabel>
<QItem>
<QItemSection>
<QItemLabel caption>
{{ t('customer.summary.username') }}
</QItemLabel>
<QItemLabel>{{ entity.account.name }}</QItemLabel>
</QItemSection>
</QItem>
<QItem dense>
<QCheckbox
v-model="entity.account.active"
:label="t('customer.summary.webAccess')"
disable
/> />
</QItem> <VnLv
</QList> :label="t('customer.summary.addressCity')"
</div> :value="entity.defaultAddress.city"
<div class="col"> />
<QList> <VnLv
<QItemLabel header class="text-h6"> :label="t('customer.summary.addressStreet')"
:value="entity.defaultAddress.street"
/>
</QCard>
<QCard class="vn-one" v-if="entity.account">
<a class="header link" :href="clientUrl + `web-access`">
{{ t('customer.summary.webAccess') }}
<QIcon name="open_in_new" color="primary" />
</a>
<VnLv
:label="t('customer.summary.username')"
:value="entity.account.name"
/>
<VnLv
:label="t('customer.summary.webAccess')"
:value="entity.account.active"
/>
</QCard>
<QCard class="vn-one" v-if="entity.account">
<div class="header">
{{ t('customer.summary.businessData') }} {{ t('customer.summary.businessData') }}
</QItemLabel>
<QItem>
<QItemSection>
<QItemLabel caption>
{{ t('customer.summary.totalGreuge') }}
</QItemLabel>
<QItemLabel>
{{ toCurrency(entity.totalGreuge) }}
</QItemLabel>
</QItemSection>
</QItem>
<QItem v-if="entity.mana">
<QItemSection>
<QItemLabel caption>
{{ t('customer.summary.mana') }}
</QItemLabel>
<QItemLabel>
{{ toCurrency(entity.mana.mana) }}
</QItemLabel>
</QItemSection>
</QItem>
<QItem v-if="entity.claimsRatio">
<QItemSection>
<QItemLabel caption>
{{ t('customer.summary.priceIncreasingRate') }}
</QItemLabel>
<QItemLabel>
{{ toPercentage(priceIncreasingRate) }}
</QItemLabel>
</QItemSection>
</QItem>
<QItem v-if="entity.averageInvoiced">
<QItemSection>
<QItemLabel caption>
{{ t('customer.summary.averageInvoiced') }}
</QItemLabel>
<QItemLabel>
{{ toCurrency(entity.averageInvoiced.invoiced) }}
</QItemLabel>
</QItemSection>
</QItem>
<QItem v-if="entity.claimsRatio">
<QItemSection>
<QItemLabel caption>
{{ t('customer.summary.claimRate') }}
</QItemLabel>
<QItemLabel>{{ toPercentage(claimRate) }}</QItemLabel>
</QItemSection>
</QItem>
</QList>
</div> </div>
<div class="col"> <VnLv
<QList> :label="t('customer.summary.totalGreuge')"
<QItemLabel header class="text-h6"> :value="toCurrency(entity.totalGreuge)"
/>
<VnLv
:label="t('customer.summary.mana')"
:value="toCurrency(entity?.mana?.mana)"
/>
<VnLv
v-if="entity.claimsRatio"
:label="t('customer.summary.priceIncreasingRate')"
:value="toPercentage(priceIncreasingRate)"
/>
<VnLv
:label="t('customer.summary.averageInvoiced')"
:value="toCurrency(entity?.averageInvoiced?.invoiced)"
/>
<VnLv
v-if="entity.claimsRatio"
:label="t('customer.summary.claimRate')"
:value="toPercentage(claimRate)"
/>
</QCard>
<QCard class="vn-one" v-if="entity.account">
<a
class="header link"
:href="`https://grafana.verdnatura.es/d/40buzE4Vk/comportamiento-pagos-clientes?orgId=1&var-clientFk=${entityId}`"
link
>
{{ t('customer.summary.financialData') }} {{ t('customer.summary.financialData') }}
</QItemLabel> <QIcon name="vn:grafana" color="primary" />
<QItem v-if="entity.debt"> </a>
<QItemSection> <VnLv
<QItemLabel caption> :label="t('customer.summary.risk')"
{{ t('customer.summary.risk') }} :value="toCurrency(entity?.debt?.debt)"
</QItemLabel> :class="debtWarning"
<QItemLabel :class="debtWarning"> :info="t('customer.summary.riskInfo')"
{{ toCurrency(entity.debt.debt) }} />
</QItemLabel>
</QItemSection> <VnLv
<QItemSection side> :label="t('customer.summary.credit')"
<QIcon name="vn:info"> :value="toCurrency(entity.credit)"
<QTooltip> :class="creditWarning"
{{ t('customer.summary.riskInfo') }} :info="t('customer.summary.creditInfo')"
</QTooltip> />
</QIcon>
</QItemSection> <VnLv
</QItem> v-if="entity.creditInsurance"
<QItem> :label="t('customer.summary.securedCredit')"
<QItemSection> :value="toCurrency(entity.creditInsurance)"
<QItemLabel caption> :info="t('customer.summary.securedCreditInfo')"
{{ t('customer.summary.credit') }} />
</QItemLabel>
<QItemLabel :class="creditWarning"> <VnLv
{{ toCurrency(entity.credit) }} :label="t('customer.summary.balance')"
</QItemLabel> :value="toCurrency(entity.sumRisk) || toCurrency(0)"
</QItemSection> :info="t('customer.summary.balanceInfo')"
<QItemSection side> />
<QIcon name="vn:info">
<QTooltip> <VnLv
{{ t('customer.summary.creditInfo') }} v-if="entity.defaulters"
</QTooltip> :label="t('customer.summary.balanceDue')"
</QIcon> :value="toCurrency(balanceDue)"
</QItemSection> :class="balanceDueWarning"
</QItem> :info="t('customer.summary.balanceDueInfo')"
<QItem v-if="entity.creditInsurance"> />
<QItemSection> <VnLv
<QItemLabel caption> v-if="entity.recovery"
{{ t('customer.summary.securedCredit') }} :label="t('customer.summary.recoverySince')"
</QItemLabel> :value="toDate(entity.recovery.started)"
<QItemLabel> />
{{ toCurrency(entity.creditInsurance) }} </QCard>
</QItemLabel>
</QItemSection>
<QItemSection side>
<QIcon name="vn:info">
<QTooltip>
{{ t('customer.summary.securedCreditInfo') }}
</QTooltip>
</QIcon>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption>
{{ t('customer.summary.balance') }}
</QItemLabel>
<QItemLabel>
{{ toCurrency(entity.sumRisk) || toCurrency(0) }}
</QItemLabel>
</QItemSection>
<QItemSection side>
<QIcon name="vn:info">
<QTooltip>
{{ t('customer.summary.balanceInfo') }}
</QTooltip>
</QIcon>
</QItemSection>
</QItem>
<QItem v-if="entity.defaulters">
<QItemSection>
<QItemLabel caption>
{{ t('customer.summary.balanceDue') }}
</QItemLabel>
<QItemLabel :class="balanceDueWarning">
{{ toCurrency(balanceDue) }}
</QItemLabel>
</QItemSection>
<QItemSection side>
<QIcon name="vn:info">
<QTooltip>
{{ t('customer.summary.balanceDueInfo') }}
</QTooltip>
</QIcon>
</QItemSection>
</QItem>
<QItem v-if="entity.recovery">
<QItemSection>
<QItemLabel caption>
{{ t('customer.summary.recoverySince') }}
</QItemLabel>
<QItemLabel>
{{ toDate(entity.recovery.started) }}
</QItemLabel>
</QItemSection>
</QItem>
</QList>
</div>
</QCardSection>
</template> </template>
</CardSummary> </CardSummary>
</template> </template>
<style lang="scss">
.q-item__label + .q-item__label {
margin: 0;
}
</style>

View File

@ -5,12 +5,7 @@ const customer = reactive({
name: '', name: '',
}); });
watch( watch(() => customer.name);
() => customer.name,
() => {
console.log('customer.name changed');
}
);
</script> </script>
<template> <template>

View File

@ -7,6 +7,8 @@ import VnPaginate from 'src/components/ui/VnPaginate.vue';
import CustomerSummaryDialog from './Card/CustomerSummaryDialog.vue'; import CustomerSummaryDialog from './Card/CustomerSummaryDialog.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import CustomerFilter from './CustomerFilter.vue'; import CustomerFilter from './CustomerFilter.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import CardList from 'src/components/ui/CardList.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const router = useRouter(); const router = useRouter();
@ -66,63 +68,23 @@ function viewSummary(id) {
auto-load auto-load
> >
<template #body="{ rows }"> <template #body="{ rows }">
<QCard class="card q-mb-md" v-for="row of rows" :key="row.id"> <CardList
<QItem v-for="row of rows"
class="q-pa-none items-start cursor-pointer q-hoverable" :key="row.id"
v-ripple :title="row.name"
clickable @click="navigate(row.id)"
> >
<QItemSection class="q-pa-md" @click="navigate(row.id)"> <template #list-items>
<div class="text-h6">{{ row.name }}</div> <VnLv label="ID" :value="row.id" />
<QItemLabel caption>#{{ row.id }}</QItemLabel> <VnLv :label="t('customer.list.email')" :value="row.email" />
<VnLv :label="t('customer.list.phone')" :value="row.phone" />
<QList> </template>
<QItem class="q-pa-none"> <template #actions>
<QItemSection>
<QItemLabel caption>
{{ t('customer.list.email') }}
</QItemLabel>
<QItemLabel>{{ row.email }}</QItemLabel>
</QItemSection>
</QItem>
<QItem class="q-pa-none">
<QItemSection>
<QItemLabel caption>
{{ t('customer.list.phone') }}
</QItemLabel>
<QItemLabel>{{ row.phone }}</QItemLabel>
</QItemSection>
</QItem>
</QList>
</QItemSection>
<QSeparator vertical />
<QCardActions vertical class="justify-between">
<!-- <QBtn color="grey-7" round flat icon="more_vert">
<QTooltip>{{ t('customer.list.moreOptions') }}</QTooltip>
<QMenu cover auto-close>
<QList>
<QItem clickable>
<QItemSection avatar>
<QIcon name="add" />
</QItemSection>
<QItemSection>Add a note</QItemSection>
</QItem>
<QItem clickable>
<QItemSection avatar>
<QIcon name="history" />
</QItemSection>
<QItemSection>Display customer history</QItemSection>
</QItem>
</QList>
</QMenu>
</QBtn> -->
<QBtn <QBtn
flat flat
round
color="primary" color="primary"
icon="arrow_circle_right" icon="arrow_circle_right"
@click="navigate(row.id)" @click.stop="navigate(row.id)"
> >
<QTooltip> <QTooltip>
{{ t('components.smartCard.openCard') }} {{ t('components.smartCard.openCard') }}
@ -130,21 +92,16 @@ function viewSummary(id) {
</QBtn> </QBtn>
<QBtn <QBtn
flat flat
round
color="grey-7" color="grey-7"
icon="preview" icon="preview"
@click="viewSummary(row.id)" @click.stop="viewSummary(row.id)"
> >
<QTooltip> <QTooltip>
{{ t('components.smartCard.openSummary') }} {{ t('components.smartCard.openSummary') }}
</QTooltip> </QTooltip>
</QBtn> </QBtn>
<!-- <QBtn flat round color="grey-7" icon="vn:ticket"> </template>
<QTooltip>{{ t('customer.list.customerOrders') }}</QTooltip> </CardList>
</QBtn> -->
</QCardActions>
</QItem>
</QCard>
</template> </template>
</VnPaginate> </VnPaginate>
</div> </div>

View File

@ -5,6 +5,8 @@ import { useI18n } from 'vue-i18n';
import { toCurrency, toDate } from 'src/filters'; import { toCurrency, toDate } from 'src/filters';
import CardDescriptor from 'components/ui/CardDescriptor.vue'; import CardDescriptor from 'components/ui/CardDescriptor.vue';
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import useCardDescription from 'src/composables/useCardDescription';
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -42,6 +44,8 @@ const filter = {
function ticketFilter(invoice) { function ticketFilter(invoice) {
return JSON.stringify({ refFk: invoice.ref }); return JSON.stringify({ refFk: invoice.ref });
} }
const data = ref(useCardDescription());
const setData = (entity) => (data.value = useCardDescription(entity.ref, entity.id));
</script> </script>
<template> <template>
@ -50,47 +54,31 @@ function ticketFilter(invoice) {
module="InvoiceOut" module="InvoiceOut"
:url="`InvoiceOuts/${entityId}`" :url="`InvoiceOuts/${entityId}`"
:filter="filter" :filter="filter"
:title="data.title"
:subtitle="data.subtitle"
@on-fetch="setData"
> >
<template #description="{ entity }">
<span>
{{ entity.ref }}
<QTooltip>{{ entity.ref }}</QTooltip>
</span>
</template>
<template #body="{ entity }"> <template #body="{ entity }">
<QList> <VnLv :label="t('invoiceOut.card.issued')" :value="toDate(entity.issued)" />
<QItem> <VnLv
<QItemSection> :label="t('invoiceOut.card.amount')"
<QItemLabel caption> :value="toCurrency(entity.amount)"
{{ t('invoiceOut.card.issued') }} />
</QItemLabel> <VnLv v-if="entity.client" :label="t('invoiceOut.card.client')">
<QItemLabel>{{ toDate(entity.issued) }}</QItemLabel> <template #value>
</QItemSection> <span class="link">
<QItemSection>
<QItemLabel caption>
{{ t('invoiceOut.card.amount') }}
</QItemLabel>
<QItemLabel>{{ toCurrency(entity.amount) }}</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection v-if="entity.client">
<QItemLabel caption>
{{ t('invoiceOut.card.client') }}
</QItemLabel>
<QItemLabel class="link">
{{ entity.client.name }} {{ entity.client.name }}
<CustomerDescriptorProxy :id="entity.client.id" /> <CustomerDescriptorProxy :id="entity.client.id" />
</QItemLabel> </span>
</QItemSection> </template>
<QItemSection v-if="entity.company"> </VnLv>
<QItemLabel caption>{{ <VnLv
t('invoiceOut.card.company') v-if="entity.company"
}}</QItemLabel> :label="t('invoiceOut.card.company')"
<QItemLabel>{{ entity.company.code }}</QItemLabel> :value="entity.company.code"
</QItemSection> />
</QItem> </template>
</QList> <template #actions="{ entity }">
<QCardActions> <QCardActions>
<QBtn <QBtn
v-if="entity.client" v-if="entity.client"

View File

@ -4,8 +4,15 @@ import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import axios from 'axios'; import axios from 'axios';
import { toCurrency, toDate } from 'src/filters'; import { toCurrency, toDate } from 'src/filters';
import SkeletonSummary from 'components/ui/SkeletonSummary.vue'; import CardSummary from 'components/ui/CardSummary.vue';
onMounted(() => fetch()); import VnLv from 'src/components/ui/VnLv.vue';
import { getUrl } from 'src/composables/getUrl';
onMounted(async () => {
fetch();
salixUrl.value = await getUrl('');
invoiceOutUrl.value = salixUrl.value + `invoiceOut/${entityId.value}/`;
});
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
@ -19,20 +26,13 @@ const $props = defineProps({
const entityId = computed(() => $props.id || route.params.id); const entityId = computed(() => $props.id || route.params.id);
const invoiceOut = ref(null); const salixUrl = ref();
const tax = ref(null); const invoiceOutUrl = ref();
const tikets = ref(null); const tickets = ref(null);
function fetch() { function fetch() {
const id = entityId.value; axios.get(`InvoiceOuts/${entityId.value}/getTickets`).then(({ data }) => {
tickets.value = data;
axios.get(`InvoiceOuts/${id}/summary`).then(({ data }) => {
invoiceOut.value = data.invoiceOut;
tax.value = data.invoiceOut.taxesBreakdown;
});
axios.get(`InvoiceOuts/${id}/getTickets`).then(({ data }) => {
tikets.value = data;
}); });
} }
@ -95,124 +95,64 @@ const ticketsColumns = ref([
</script> </script>
<template> <template>
<div class="summary container"> <CardSummary ref="summary" :url="`InvoiceOuts/${entityId}/summary`">
<QCard> <template #header="{ entity: { invoiceOut } }">
<SkeletonSummary v-if="!invoiceOut" /> <div>{{ invoiceOut.ref }} - {{ invoiceOut.client?.socialName }}</div>
<template v-if="invoiceOut"> </template>
<div class="header bg-primary q-pa-sm q-mb-md"> <template #body="{ entity: { invoiceOut } }">
{{ invoiceOut.ref }} - {{ invoiceOut.client.socialName }} <QCard class="vn-one">
<div class="header">
{{ t('invoiceOut.pageTitles.basicData') }}
</div> </div>
<QList> <VnLv
<QItem> :label="t('invoiceOut.summary.issued')"
<QItemSection> :value="toDate(invoiceOut.issued)"
<QItemLabel caption>{{ />
t('invoiceOut.summary.issued') <VnLv
}}</QItemLabel> :label="t('invoiceOut.summary.dued')"
<QItemLabel>{{ toDate(invoiceOut.issued) }}</QItemLabel> :value="toDate(invoiceOut.dued)"
</QItemSection> />
<QItemSection> <VnLv
<QItemLabel caption>{{ :label="t('invoiceOut.summary.created')"
t('invoiceOut.summary.dued') :value="toDate(invoiceOut.created)"
}}</QItemLabel> />
<QItemLabel>{{ toDate(invoiceOut.dued) }}</QItemLabel> <VnLv
</QItemSection> :label="t('invoiceOut.summary.booked')"
</QItem> :value="toDate(invoiceOut.booked)"
<QItem> />
<QItemSection> <VnLv
<QItemLabel caption>{{ :label="t('invoiceOut.summary.company')"
t('invoiceOut.summary.created') :value="invoiceOut.company.code"
}}</QItemLabel> />
<QItemLabel>{{ toDate(invoiceOut.created) }}</QItemLabel>
</QItemSection>
<QItemSection>
<QItemLabel caption>{{
t('invoiceOut.summary.booked')
}}</QItemLabel>
<QItemLabel>{{ toDate(invoiceOut.booked) }}</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption>{{
t('invoiceOut.summary.company')
}}</QItemLabel>
<QItemLabel>{{ invoiceOut.company.code }}</QItemLabel>
</QItemSection>
</QItem>
</QList>
<QCardSection class="q-pa-md">
<h6>{{ t('invoiceOut.summary.taxBreakdown') }}</h6>
<QTable :columns="taxColumns" :rows="tax" flat>
<template #header="props">
<QTr :props="props">
<QTh
v-for="col in props.cols"
:key="col.name"
:props="props"
>
{{ t(col.label) }}
</QTh>
</QTr>
</template>
</QTable>
</QCardSection>
<QCardSection class="q-pa-md">
<h6>{{ t('invoiceOut.summary.tickets') }}</h6>
<QTable :columns="ticketsColumns" :rows="tikets" flat>
<template #header="props">
<QTr :props="props">
<QTh
v-for="col in props.cols"
:key="col.name"
:props="props"
>
{{ t(col.label) }}
</QTh>
</QTr>
</template>
</QTable>
</QCardSection>
</template>
</QCard> </QCard>
<QCard class="vn-three">
<div class="header">
{{ t('invoiceOut.summary.taxBreakdown') }}
</div> </div>
<QTable :columns="taxColumns" :rows="invoiceOut.taxesBreakdown" flat>
<template #header="props">
<QTr :props="props">
<QTh v-for="col in props.cols" :key="col.name" :props="props">
{{ t(col.label) }}
</QTh>
</QTr>
</template>
</QTable>
</QCard>
<QCard class="vn-three">
<div class="header">
{{ t('invoiceOut.summary.tickets') }}
</div>
<QTable v-if="tickets" :columns="ticketsColumns" :rows="tickets" flat>
<template #header="props">
<QTr :props="props">
<QTh v-for="col in props.cols" :key="col.name" :props="props">
{{ t(col.label) }}
</QTh>
</QTr>
</template>
</QTable>
</QCard>
</template>
</CardSummary>
</template> </template>
<style lang="scss" scoped>
.container {
display: flex;
justify-content: center;
}
.q-card {
width: 100%;
min-width: 950px;
max-width: 950px;
}
.summary {
.header {
text-align: center;
font-size: 18px;
}
#slider-container {
max-width: 80%;
margin: 0 auto;
.q-slider {
.q-slider__marker-labels:nth-child(1) {
transform: none;
}
.q-slider__marker-labels:nth-child(2) {
transform: none;
left: auto !important;
right: 0%;
}
}
}
}
.q-dialog .summary {
max-width: 1200px;
}
</style>

View File

@ -9,6 +9,8 @@ import InvoiceOutSummaryDialog from './Card/InvoiceOutSummaryDialog.vue';
import { toDate, toCurrency } from 'src/filters/index'; import { toDate, toCurrency } from 'src/filters/index';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import InvoiceOutFilter from './InvoiceOutFilter.vue'; import InvoiceOutFilter from './InvoiceOutFilter.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import CardList from 'src/components/ui/CardList.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const router = useRouter(); const router = useRouter();
@ -71,97 +73,59 @@ function viewSummary(id) {
auto-load auto-load
> >
<template #body="{ rows }"> <template #body="{ rows }">
<QCard class="card q-mb-md" v-for="row of rows" :key="row.id"> <CardList
<QItem v-for="row of rows"
class="q-pa-none items-start cursor-pointer q-hoverable" :key="row.id"
v-ripple :title="row.ref"
clickable @click="navigate(row.id)"
> >
<QItemSection class="q-pa-md" @click="navigate(row.id)"> <template #list-items>
<div class="text-h6">{{ row.ref }}</div> <VnLv label="ID" :value="row.id" />
<QItemLabel caption>#{{ row.id }}</QItemLabel> <VnLv
<QList> :label="t('invoiceOut.list.shortIssued')"
<QItem class="q-pa-none"> :title-label="t('invoiceOut.list.issued')"
<QItemSection> :value="toDate(row.issued)"
<QItemLabel caption> />
{{ t('invoiceOut.list.issued') }} <VnLv
</QItemLabel> :label="t('invoiceOut.list.amount')"
<QItemLabel> :value="toCurrency(row.amount)"
{{ toDate(row.issued) }} />
</QItemLabel> <VnLv
</QItemSection> :label="t('invoiceOut.list.client')"
<QItemSection> :value="row.clientSocialName"
<QItemLabel caption> />
{{ t('invoiceOut.list.amount') }} <VnLv
</QItemLabel> :label="t('invoiceOut.list.shortCreated')"
<QItemLabel> :title-label="t('invoiceOut.list.created')"
{{ toCurrency(row.amount) }} :value="toDate(row.created)"
</QItemLabel> />
</QItemSection> <VnLv
</QItem> :label="t('invoiceOut.list.company')"
<QItem class="q-pa-none"> :value="row.companyCode"
<QItemSection> />
<QItemLabel caption> <VnLv
{{ t('invoiceOut.list.client') }} :label="t('invoiceOut.list.shortDued')"
</QItemLabel> :title-label="t('invoiceOut.list.dued')"
<QItemLabel> :value="toDate(row.dued)"
{{ row.clientSocialName }} />
</QItemLabel> </template>
</QItemSection> <template #actions>
<QItemSection>
<QItemLabel caption>
{{ t('invoiceOut.list.created') }}
</QItemLabel>
<QItemLabel>
{{ toDate(row.created) }}
</QItemLabel>
</QItemSection>
</QItem>
<QItem class="q-pa-none">
<QItemSection>
<QItemLabel caption>
{{ t('invoiceOut.list.company') }}
</QItemLabel>
<QItemLabel>{{ row.companyCode }}</QItemLabel>
</QItemSection>
<QItemSection>
<QItemLabel caption>
{{ t('invoiceOut.list.dued') }}
</QItemLabel>
<QItemLabel>
{{ toDate(row.dued) }}
</QItemLabel>
</QItemSection>
</QItem>
</QList>
</QItemSection>
<QSeparator vertical />
<QCardActions vertical class="justify-between">
<QBtn <QBtn
flat flat
round
color="orange"
icon="arrow_circle_right" icon="arrow_circle_right"
@click="navigate(row.id)" @click.stop="navigate(row.id)"
> >
<QTooltip> <QTooltip>
{{ t('components.smartCard.openCard') }} {{ t('components.smartCard.openCard') }}
</QTooltip> </QTooltip>
</QBtn> </QBtn>
<QBtn <QBtn flat icon="preview" @click.stop="viewSummary(row.id)">
flat
round
color="grey-7"
icon="preview"
@click="viewSummary(row.id)"
>
<QTooltip> <QTooltip>
{{ t('components.smartCard.openSummary') }} {{ t('components.smartCard.openSummary') }}
</QTooltip> </QTooltip>
</QBtn> </QBtn>
</QCardActions> </template>
</QItem> </CardList>
</QCard>
</template> </template>
</VnPaginate> </VnPaginate>
</div> </div>

View File

@ -1,58 +1,30 @@
<script setup> <script setup>
import { ref, computed } from 'vue'; import { ref } from 'vue';
import { Dark, Quasar, useQuasar } from 'quasar'; import { Notify, useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import axios from 'axios'; import axios from 'axios';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import { useLogin } from 'src/composables/useLogin';
const quasar = useQuasar(); const quasar = useQuasar();
const session = useSession(); const session = useSession();
const loginCache = useLogin();
const router = useRouter(); const router = useRouter();
const { t, locale } = useI18n(); const { t } = useI18n();
const userLocale = computed({
get() {
return locale.value;
},
set(value) {
locale.value = value;
if (value === 'en') value = 'en-GB';
// FIXME: Dynamic imports from absolute paths are not compatible with vite:
// https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations
try {
const langList = import.meta.glob('../../node_modules/quasar/lang/*.mjs');
langList[`../../node_modules/quasar/lang/${value}.mjs`]().then((lang) => {
Quasar.lang.set(lang.default);
});
} catch (error) {
//
}
},
});
const darkMode = computed({
get() {
return Dark.isActive;
},
set(value) {
Dark.set(value);
},
});
const username = ref(''); const username = ref('');
const password = ref(''); const password = ref('');
const keepLogin = ref(true); const keepLogin = ref(true);
async function onSubmit() { async function onSubmit() {
try { const params = {
const { data } = await axios.post('Accounts/login', {
user: username.value, user: username.value,
password: password.value, password: password.value,
}); };
try {
const { data } = await axios.post('Accounts/login', params);
if (!data) return; if (!data) return;
@ -69,67 +41,29 @@ async function onSubmit() {
} else { } else {
router.push({ name: 'Dashboard' }); router.push({ name: 'Dashboard' });
} }
} catch (e) { } catch (res) {
// if (res.response?.data?.error?.code === 'REQUIRES_2FA') {
Notify.create({
message: t('login.twoFactorRequired'),
icon: 'phonelink_lock',
type: 'warning',
});
params.keepLogin = keepLogin.value;
loginCache.setUser(params);
return router.push({
name: 'TwoFactor',
query: router.currentRoute.value?.query,
});
}
Notify.create({
message: t('login.loginError'),
type: 'negative',
});
} }
} }
</script> </script>
<template> <template>
<QLayout>
<QPageContainer>
<QPage id="login">
<QPageSticky position="top-right">
<QToolbar>
<QBtn
id="switchLanguage"
:label="t('globals.language')"
icon="translate"
color="primary"
size="sm"
flat
rounded
>
<QMenu auto-close>
<QList dense>
<QItem
@click="userLocale = 'en'"
:active="userLocale == 'en'"
v-ripple
clickable
>
{{ t('globals.lang.en') }}
</QItem>
<QItem
@click="userLocale = 'es'"
:active="userLocale == 'es'"
v-ripple
clickable
>
{{ t('globals.lang.es') }}
</QItem>
</QList>
</QMenu>
</QBtn>
<QList>
<QItem>
<QItemSection>
<QItemLabel caption>
{{ t(`globals.darkMode`) }}
</QItemLabel>
</QItemSection>
<QItemSection side>
<QToggle
v-model="darkMode"
checked-icon="dark_mode"
unchecked-icon="light_mode"
/>
</QItemSection>
</QItem>
</QList>
</QToolbar>
</QPageSticky>
<div class="login-form q-pa-xl">
<QImg <QImg
src="~/assets/logo.svg" src="~/assets/logo.svg"
alt="Logo" alt="Logo"
@ -137,25 +71,19 @@ async function onSubmit() {
:ratio="16 / 9" :ratio="16 / 9"
class="q-mb-md" class="q-mb-md"
/> />
<QForm @submit="onSubmit" class="q-gutter-md"> <QForm @submit="onSubmit" class="q-gutter-md q-pa-lg">
<QInput <QInput
v-model="username" v-model="username"
:label="t('login.username')" :label="t('login.username')"
lazy-rules lazy-rules
:rules="[ :rules="[(val) => (val && val.length > 0) || t('login.fieldRequired')]"
(val) =>
(val && val.length > 0) || t('login.fieldRequired'),
]"
/> />
<QInput <QInput
type="password" type="password"
v-model="password" v-model="password"
:label="t('login.password')" :label="t('login.password')"
lazy-rules lazy-rules
:rules="[ :rules="[(val) => (val && val.length > 0) || t('login.fieldRequired')]"
(val) =>
(val && val.length > 0) || t('login.fieldRequired'),
]"
/> />
<QToggle v-model="keepLogin" :label="t('login.keepLogin')" /> <QToggle v-model="keepLogin" :label="t('login.keepLogin')" />
@ -170,21 +98,6 @@ async function onSubmit() {
/> />
</div> </div>
</QForm> </QForm>
</div>
</QPage>
</QPageContainer>
</QLayout>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped></style>
#login {
display: flex;
align-items: center;
justify-content: center;
min-height: inherit;
}
.login-form {
width: 400px;
}
</style>

View File

@ -0,0 +1,80 @@
<script setup>
import { ref } from 'vue';
import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import axios from 'axios';
import { useSession } from 'src/composables/useSession';
import { useLogin } from 'src/composables/useLogin';
const quasar = useQuasar();
const session = useSession();
const router = useRouter();
const loginCache = useLogin();
const { t } = useI18n();
const code = ref('');
const params = loginCache.getUser().value;
if (!params.user) {
router.push({ name: 'Login' });
}
async function onSubmit() {
try {
params.code = code.value;
const { data } = await axios.post('VnUsers/validate-auth', params);
if (!data) return;
await session.login(data.token, params.keepLogin);
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' });
}
} catch (e) {
quasar.notify({
message: e.response?.data?.error.message,
type: 'negative',
});
}
}
</script>
<template>
<QForm @submit="onSubmit" class="q-gutter-md q-pa-lg">
<div class="column items-center">
<QIcon name="phonelink_lock" size="xl" color="primary" />
<h5 class="text-center q-my-md">{{ t('twoFactor.insert') }}</h5>
</div>
<QInput
v-model="code"
:hint="t('twoFactor.explanation')"
mask="# # # # # #"
fill-mask
unmasked-value
autofocus
>
<template #prepend>
<QIcon name="lock" />
</template>
</QInput>
<div class="q-mt-xl">
<QBtn
:label="t('twoFactor.validate')"
type="submit"
color="primary"
class="full-width q-mt-md"
rounded
unelevated
/>
</div>
</QForm>
</template>
<style lang="scss" scoped></style>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { computed } from 'vue'; import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnPaginate from 'components/ui/VnPaginate.vue';
@ -56,8 +56,8 @@ const columns = computed(() => [
}, },
]); ]);
function getProjectUrl() { function getProjectUrl() {
return ((new URL(window.location)).origin); return new URL(window.location).origin;
}; }
</script> </script>
<template> <template>
<div class="column items-center"> <div class="column items-center">
@ -84,7 +84,10 @@ function getProjectUrl() {
</template> </template>
<template #body-cell-cmrFk="{ value }"> <template #body-cell-cmrFk="{ value }">
<QTd align="right" class="text-primary"> <QTd align="right" class="text-primary">
<a :href="`${getProjectUrl()}/api/Routes/${value}/cmr?access_token=${token}`" target="_blank"> <a
:href="`${getProjectUrl()}/api/Routes/${value}/cmr?access_token=${token}`"
target="_blank"
>
<span class="text-primary">{{ value }}</span> <span class="text-primary">{{ value }}</span>
</a> </a>
</QTd> </QTd>
@ -92,10 +95,12 @@ function getProjectUrl() {
<template #body-cell-hasCmrDms="{ value }"> <template #body-cell-hasCmrDms="{ value }">
<QTd align="center"> <QTd align="center">
<QBadge <QBadge
:id="(value) ? 'true' : 'false'" :id="value ? 'true' : 'false'"
:label="(value) :label="
value
? t('route.cmr.list.true') ? t('route.cmr.list.true')
: t('route.cmr.list.false')" : t('route.cmr.list.false')
"
/> />
</QTd> </QTd>
</template> </template>

View File

@ -1,11 +1,13 @@
<script setup> <script setup>
import { computed } from 'vue'; import { ref, computed } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { toDate } from 'src/filters'; import { toDate } from 'src/filters';
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
import CardDescriptor from 'components/ui/CardDescriptor.vue'; import CardDescriptor from 'components/ui/CardDescriptor.vue';
import TicketDescriptorMenu from './TicketDescriptorMenu.vue'; import TicketDescriptorMenu from './TicketDescriptorMenu.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import useCardDescription from 'src/composables/useCardDescription';
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -66,78 +68,60 @@ const filter = {
], ],
}; };
function stateColor(state) { const data = ref(useCardDescription());
if (state.code === 'OK') return 'text-green'; const setData = (entity) =>
if (state.code === 'FREE') return 'text-blue-3'; (data.value = useCardDescription(entity.client.name, entity.id));
if (state.alertLevel === 1) return 'text-primary';
if (state.alertLevel === 0) return 'text-red';
}
</script> </script>
<template> <template>
<CardDescriptor module="Ticket" :url="`Tickets/${entityId}`" :filter="filter"> <CardDescriptor
module="Ticket"
:url="`Tickets/${entityId}`"
:filter="filter"
:title="data.title"
:subtitle="data.subtitle"
@on-fetch="setData"
>
<template #menu="{ entity }"> <template #menu="{ entity }">
<TicketDescriptorMenu :ticket="entity" /> <TicketDescriptorMenu :ticket="entity" />
</template> </template>
<template #description="{ entity }">
<span>
{{ entity.client.name }}
<QTooltip>{{ entity.client.name }}</QTooltip>
</span>
</template>
<template #body="{ entity }"> <template #body="{ entity }">
<QList> <VnLv v-if="entity.ticketState" :label="t('ticket.card.state')">
<QItem> <template #value>
<QItemSection v-if="entity.ticketState"> <QBadge :color="entity.ticketState.state.classColor">
<QItemLabel caption>{{ t('ticket.card.state') }}</QItemLabel>
<QItemLabel :class="stateColor(entity.ticketState.state)">
{{ entity.ticketState.state.name }} {{ entity.ticketState.state.name }}
</QItemLabel> </QBadge>
</QItemSection> </template>
<QItemSection> </VnLv>
<QItemLabel caption> <VnLv :label="t('ticket.card.shipped')" :value="toDate(entity.shipped)" />
{{ t('ticket.card.shipped') }} <VnLv :label="t('ticket.card.customerId')">
</QItemLabel> <template #value>
<QItemLabel>{{ toDate(entity.shipped) }}</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption>
{{ t('ticket.card.customerId') }}
</QItemLabel>
<QItemLabel>
<span class="link"> <span class="link">
{{ entity.clientFk }} {{ entity.clientFk }}
<CustomerDescriptorProxy :id="entity.client.id" /> <CustomerDescriptorProxy :id="entity.client.id" />
</span> </span>
</QItemLabel> </template>
</QItemSection> </VnLv>
<QItemSection v-if="entity.client && entity.client.salesPersonUser"> <VnLv :label="t('ticket.summary.salesPerson')">
<QItemLabel caption> <template #value>
{{ t('ticket.card.salesPerson') }} <span class="link">
</QItemLabel>
<QItemLabel>
{{ entity.client.salesPersonUser.name }} {{ entity.client.salesPersonUser.name }}
</QItemLabel> <WorkerDescriptorProxy
</QItemSection> :id="entity.client.salesPersonFk"
</QItem> v-if="entity.client.salesPersonFk"
<QItem> />
<QItemSection v-if="entity.warehouse"> </span>
<QItemLabel caption> </template>
{{ t('ticket.card.warehouse') }} </VnLv>
</QItemLabel> <VnLv :label="t('ticket.card.warehouse')" :value="entity.warehouse?.name" />
<QItemLabel>{{ entity.warehouse.name }}</QItemLabel> <VnLv
</QItemSection> v-if="entity.agencyMode"
</QItem> :label="t('ticket.card.agency')"
<QItem v-if="entity.agencyMode"> :value="entity.agencyMode.name"
<QItemSection> />
<QItemLabel caption>{{ t('ticket.card.agency') }}</QItemLabel> </template>
<QItemLabel>{{ entity.agencyMode.name }}</QItemLabel> <template #icons="{ entity }">
</QItemSection> <QCardActions>
</QItem>
</QList>
<QCardActions class="q-gutter-md">
<QIcon <QIcon
v-if="entity.isDeleted == true" v-if="entity.isDeleted == true"
name="vn:deletedTicket" name="vn:deletedTicket"
@ -147,7 +131,8 @@ function stateColor(state) {
<QTooltip>{{ t('This ticket is deleted') }}</QTooltip> <QTooltip>{{ t('This ticket is deleted') }}</QTooltip>
</QIcon> </QIcon>
</QCardActions> </QCardActions>
</template>
<template #actions="{ entity }">
<QCardActions> <QCardActions>
<QBtn <QBtn
size="md" size="md"

View File

@ -4,14 +4,15 @@ import { useRoute, useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import axios from 'axios'; import axios from 'axios';
import { dashIfEmpty, toDate, toCurrency } from 'src/filters'; import { dashIfEmpty, toDate, toCurrency } from 'src/filters';
import SkeletonSummary from 'components/ui/SkeletonSummary.vue'; import CardSummary from 'components/ui/CardSummary.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import FetchedTags from 'components/ui/FetchedTags.vue'; import FetchedTags from 'components/ui/FetchedTags.vue';
import InvoiceOutDescriptorProxy from 'pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue'; import InvoiceOutDescriptorProxy from 'pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import { getUrl } from 'src/composables/getUrl';
onMounted(() => fetch()); onUpdated(() => summaryRef.value.fetch());
onUpdated(() => fetch());
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
@ -28,25 +29,22 @@ const $props = defineProps({
const entityId = computed(() => $props.id || route.params.id); const entityId = computed(() => $props.id || route.params.id);
const summaryRef = ref();
const ticket = ref(); const ticket = ref();
const salesLines = ref(null); const salesLines = ref(null);
const editableStates = ref([]); const editableStates = ref([]);
const ticketUrl = ref();
async function fetch() { onMounted(async () => {
const { data } = await axios.get(`Tickets/${entityId.value}/summary`); ticketUrl.value = (await getUrl('ticket/')) + entityId.value + '/';
});
async function setData(data) {
if (data) { if (data) {
ticket.value = data; ticket.value = data;
salesLines.value = data.sales; salesLines.value = data.sales;
} }
} }
function stateColor(state) {
if (state.code === 'OK') return 'text-green';
if (state.code === 'FREE') return 'text-blue-3';
if (state.alertLevel === 1) return 'text-primary';
if (state.alertLevel === 0) return 'text-red';
}
function formattedAddress() { function formattedAddress() {
if (!ticket.value) return ''; if (!ticket.value) return '';
@ -76,7 +74,7 @@ async function changeState(value) {
}; };
await axios.post(`TicketTrackings/changeState`, formData); await axios.post(`TicketTrackings/changeState`, formData);
await router.go(route.fullPath); router.go(route.fullPath);
} }
</script> </script>
@ -86,17 +84,20 @@ async function changeState(value) {
@on-fetch="(data) => (editableStates = data)" @on-fetch="(data) => (editableStates = data)"
auto-load auto-load
/> />
<div class="summary container"> <CardSummary
<QCard> ref="summaryRef"
<SkeletonSummary v-if="!ticket" /> :url="`Tickets/${entityId}/summary`"
<template v-if="ticket"> @on-fetch="(data) => setData(data)"
<div class="header bg-primary q-pa-sm q-mb-md"> >
<span> <template #header="{ entity }">
Ticket #{{ ticket.id }} - {{ ticket.client.name }} ({{ <div>
ticket.client.id Ticket #{{ entity.id }} - {{ entity.client.name }} ({{
entity.client.id
}}) - }}) -
{{ ticket.nickname }} {{ entity.nickname }}
</span> </div>
</template>
<template #header-right>
<QBtnDropdown <QBtnDropdown
side side
top top
@ -126,243 +127,148 @@ async function changeState(value) {
</QVirtualScroll> </QVirtualScroll>
</QList> </QList>
</QBtnDropdown> </QBtnDropdown>
</template>
<template #body>
<QCard class="vn-max">
<div class="taxes">
<VnLv
:label="t('ticket.summary.subtotal')"
:value="toCurrency(ticket.totalWithoutVat)"
/>
<VnLv
:label="t('ticket.summary.vat')"
:value="toCurrency(ticket.totalWithVat - ticket.totalWithoutVat)"
/>
<VnLv
:label="t('ticket.summary.total')"
:value="toCurrency(ticket.totalWithVat)"
/>
</div> </div>
<div class="row q-pa-md q-col-gutter-md q-mb-md"> </QCard>
<div class="col"> <QCard class="vn-one">
<QList> <a class="header link" :href="ticketUrl + 'basic-data/step-one'">
<QItem> {{ t('globals.summary.basicData') }}
<QItemSection> <QIcon name="open_in_new" color="primary" />
<QItemLabel caption> </a>
{{ t('ticket.summary.state') }} <VnLv :label="t('ticket.summary.state')">
</QItemLabel> <template #value>
<QItemLabel <QChip :color="ticket.ticketState.state.classColor ?? 'dark'">
:class="stateColor(ticket.ticketState.state)"
>
{{ ticket.ticketState.state.name }} {{ ticket.ticketState.state.name }}
</QItemLabel> </QChip>
</QItemSection> </template>
</QItem> </VnLv>
<QItem> <VnLv :label="t('ticket.summary.salesPerson')">
<QItemSection> <template #value>
<QItemLabel caption>{{
t('ticket.summary.salesPerson')
}}</QItemLabel>
<QItemLabel>
<span class="link"> <span class="link">
{{ ticket.client.salesPersonUser.name }} {{ ticket.client?.salesPersonUser?.name }}
<WorkerDescriptorProxy <WorkerDescriptorProxy
:id="ticket.client.salesPersonFk" :id="ticket.client.salesPersonFk"
v-if="ticket.client.salesPersonFk"
/> />
</span> </span>
</QItemLabel> </template>
</QItemSection> </VnLv>
</QItem> <VnLv
<QItem> :label="t('ticket.summary.agency')"
<QItemSection> :value="ticket.agencyMode.name"
<QItemLabel caption>{{ />
t('ticket.summary.agency') <VnLv :label="t('ticket.summary.zone')" :value="ticket.zone.name" />
}}</QItemLabel> <VnLv
<QItemLabel>{{ ticket.agencyMode.name }}</QItemLabel> :label="t('ticket.summary.warehouse')"
</QItemSection> :value="ticket.warehouse?.name"
</QItem> />
<QItem> <VnLv :label="t('ticket.summary.route')" :value="ticket.routeFk" />
<QItemSection> <VnLv :label="t('ticket.summary.invoice')">
<QItemLabel caption>{{ <template #value>
t('ticket.summary.zone')
}}</QItemLabel>
<QItemLabel class="link">{{
ticket.routeFk
}}</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption>{{
t('ticket.summary.warehouse')
}}</QItemLabel>
<QItemLabel>{{ ticket.warehouse.name }}</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption>{{
t('ticket.summary.invoice')
}}</QItemLabel>
<QItemLabel v-if="ticket.refFk">
<span class="link"> <span class="link">
{{ ticket.refFk }} {{ dashIfEmpty(ticket.refFk) }}
<InvoiceOutDescriptorProxy :id="ticket.id" /> <InvoiceOutDescriptorProxy
:id="ticket.id"
v-if="ticket.refFk"
/>
</span> </span>
</QItemLabel> </template>
</QItemSection> </VnLv>
</QItem> <VnLv
</QList> :label="t('ticket.summary.weight')"
</div> :value="dashIfEmpty(ticket.weight)"
<div class="col"> />
<QList> </QCard>
<QItem> <QCard class="vn-one">
<QItemSection> <a class="header link" :href="ticketUrl + 'basic-data/step-one'">
<QItemLabel caption>{{ {{ t('globals.summary.basicData') }}
t('ticket.summary.shipped') <QIcon name="open_in_new" color="primary" />
}}</QItemLabel> </a>
<QItemLabel>{{ toDate(ticket.shipped) }}</QItemLabel> <VnLv
</QItemSection> :label="t('ticket.summary.shipped')"
</QItem> :value="toDate(ticket.shipped)"
<QItem> />
<QItemSection> <VnLv
<QItemLabel caption>{{ :label="t('ticket.summary.landed')"
t('ticket.summary.landed') :value="toDate(ticket.landed)"
}}</QItemLabel> />
<QItemLabel>{{ toDate(ticket.landed) }}</QItemLabel> <VnLv :label="t('ticket.summary.packages')" :value="ticket.packages" />
</QItemSection> <VnLv
</QItem> :label="t('ticket.summary.consigneePhone')"
<QItem> :value="ticket.address.phone"
<QItemSection> />
<QItemLabel caption>{{ <VnLv
t('ticket.summary.packages') :label="t('ticket.summary.consigneeMobile')"
}}</QItemLabel> :value="ticket.address.mobile"
<QItemLabel>{{ ticket.packages }}</QItemLabel> />
</QItemSection> <VnLv
</QItem> :label="t('ticket.summary.clientPhone')"
<QItem> :value="ticket.client.phone"
<QItemSection> />
<QItemLabel caption>{{ <VnLv
t('ticket.summary.consigneePhone') :label="t('ticket.summary.clientMobile')"
}}</QItemLabel> :value="ticket.client.mobile"
<QItemLabel>{{ ticket.address.phone }}</QItemLabel> />
</QItemSection> <VnLv
</QItem> :label="t('ticket.summary.consignee')"
<QItem> :value="formattedAddress()"
<QItemSection> />
<QItemLabel caption>{{ </QCard>
t('ticket.summary.consigneeMobile') <QCard class="vn-one">
}}</QItemLabel> <a class="header link" :href="ticketUrl + 'observation'">
<QItemLabel>{{ ticket.address.mobile }}</QItemLabel> {{ t('ticket.pageTitles.notes') }}
</QItemSection> <QIcon name="open_in_new" color="primary" />
</QItem> </a>
<QItem> <VnLv
<QItemSection> v-for="note in ticket.notes"
<QItemLabel caption>{{ :key="note.id"
t('ticket.summary.clientPhone') :label="note.observationType.description"
}}</QItemLabel> :value="note.description"
<QItemLabel>{{ ticket.client.phone }}</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption>{{
t('ticket.summary.clientMobile')
}}</QItemLabel>
<QItemLabel>{{ ticket.client.mobile }}</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption>{{
t('ticket.summary.consignee')
}}</QItemLabel>
<QItemLabel>{{ formattedAddress() }}</QItemLabel>
</QItemSection>
</QItem>
</QList>
</div>
<div class="col">
<QList>
<QItem v-for="note in ticket.notes" :key="note.id">
<QItemSection>
<QItemLabel caption>
{{ note.observationType.description }}
</QItemLabel>
<QItemLabel>
{{ note.description }}
</QItemLabel>
</QItemSection>
</QItem>
</QList>
</div>
<div class="col">
<QList class="taxes">
<QItem>
<QItemSection>
<QItemLabel caption>{{
t('ticket.summary.subtotal')
}}</QItemLabel>
<QItemLabel>{{
toCurrency(ticket.totalWithoutVat)
}}</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption>{{
t('ticket.summary.vat')
}}</QItemLabel>
<QItemLabel>{{
toCurrency(
ticket.totalWithVat - ticket.totalWithoutVat
)
}}</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption>{{
t('ticket.summary.total')
}}</QItemLabel>
<QItemLabel>{{
toCurrency(ticket.totalWithVat)
}}</QItemLabel>
</QItemSection>
</QItem>
</QList>
</div>
</div>
<div class="row q-pa-md" v-if="salesLines.length > 0">
<div class="col">
<QList>
<QItemLabel header class="text-h6">
{{ t('ticket.summary.saleLines') }}
<RouterLink
:to="{
name: 'TicketBasicData',
params: { id: entityId },
}"
target="_blank"
> >
<QIcon name="open_in_new" /> <template #value>
</RouterLink> <QInput
</QItemLabel> v-model="note.description"
<QTable :rows="ticket.sales" flat> filled
type="textarea"
class="notes"
readonly
/>
</template>
</VnLv>
</QCard>
<QCard class="vn-max">
<a class="header link" :href="ticketUrl + 'sale'">
{{ t('ticket.summary.saleLines') }}
<QIcon name="open_in_new" color="primary" />
</a>
<QTable :rows="ticket.sales">
<template #header="props"> <template #header="props">
<QTr :props="props"> <QTr :props="props">
<QTh auto-width></QTh> <QTh auto-width></QTh>
<QTh auto-width>{{ <QTh auto-width>{{ t('ticket.summary.item') }}</QTh>
t('ticket.summary.item') <QTh auto-width>{{ t('ticket.summary.visible') }}</QTh>
}}</QTh> <QTh auto-width>{{ t('ticket.summary.available') }}</QTh>
<QTh auto-width>{{ <QTh auto-width>{{ t('ticket.summary.quantity') }}</QTh>
t('ticket.summary.visible') <QTh auto-width>{{ t('ticket.summary.description') }}</QTh>
}}</QTh> <QTh auto-width>{{ t('ticket.summary.price') }}</QTh>
<QTh auto-width>{{ <QTh auto-width>{{ t('ticket.summary.discount') }}</QTh>
t('ticket.summary.available') <QTh auto-width>{{ t('ticket.summary.amount') }}</QTh>
}}</QTh> <QTh auto-width>{{ t('ticket.summary.packing') }}</QTh>
<QTh auto-width>{{
t('ticket.summary.quantity')
}}</QTh>
<QTh auto-width>{{
t('ticket.summary.description')
}}</QTh>
<QTh auto-width>{{
t('ticket.summary.price')
}}</QTh>
<QTh auto-width>{{
t('ticket.summary.discount')
}}</QTh>
<QTh auto-width>{{
t('ticket.summary.amount')
}}</QTh>
<QTh auto-width>{{
t('ticket.summary.packing')
}}</QTh>
</QTr> </QTr>
</template> </template>
<template #body="props"> <template #body="props">
@ -384,9 +290,7 @@ async function changeState(value) {
> >
<QTooltip <QTooltip
>{{ t('ticket.summary.claim') }}: >{{ t('ticket.summary.claim') }}:
{{ {{ props.row.claim.claimFk }}</QTooltip
props.row.claim.claimFk
}}</QTooltip
> >
</QBtn> </QBtn>
<QBtn <QBtn
@ -399,16 +303,13 @@ async function changeState(value) {
:to="{ :to="{
name: 'ClaimCard', name: 'ClaimCard',
params: { params: {
id: props.row.claimBeginning id: props.row.claimBeginning.claimFk,
.claimFk,
}, },
}" }"
> >
<QTooltip <QTooltip
>{{ t('ticket.summary.claim') }}: >{{ t('ticket.summary.claim') }}:
{{ {{ props.row.claimBeginning.claimFk }}</QTooltip
props.row.claimBeginning.claimFk
}}</QTooltip
> >
</QBtn> </QBtn>
<QIcon <QIcon
@ -449,11 +350,7 @@ async function changeState(value) {
color="primary" color="primary"
> >
<QTooltip> <QTooltip>
{{ {{ t('ticket.summary.hasComponentLack') }}
t(
'ticket.summary.hasComponentLack'
)
}}
</QTooltip> </QTooltip>
</QIcon> </QIcon>
</QTd> </QTd>
@ -464,11 +361,9 @@ async function changeState(value) {
<QTd> <QTd>
<div class="fetched-tags"> <div class="fetched-tags">
<span>{{ props.row.item.name }}</span> <span>{{ props.row.item.name }}</span>
<span <span v-if="props.row.item.subName" class="subName">{{
v-if="props.row.item.subName" props.row.item.subName
class="subName" }}</span>
>{{ props.row.item.subName }}</span
>
</div> </div>
<fetched-tags <fetched-tags
:item="props.row.item" :item="props.row.item"
@ -486,37 +381,25 @@ async function changeState(value) {
) )
}} }}
</QTd> </QTd>
<QTd>{{ <QTd>{{ dashIfEmpty(props.row.item.itemPackingTypeFk) }}</QTd>
dashIfEmpty(props.row.item.itemPackingTypeFk)
}}</QTd>
</QTr> </QTr>
</template> </template>
</QTable> </QTable>
</QList> </QCard>
</div> <QCard
</div> class="vn-max"
<div
class="row q-pa-md"
v-if="ticket.packagings.length > 0 || ticket.services.length > 0" v-if="ticket.packagings.length > 0 || ticket.services.length > 0"
> >
<div class="col" v-if="ticket.packagings.length > 0"> <a class="header link" :href="ticketUrl + 'package'">
<QList>
<QItemLabel header class="text-h6">
{{ t('ticket.summary.packages') }} {{ t('ticket.summary.packages') }}
<QIcon name="open_in_new" /> <QIcon name="open_in_new" color="primary" />
</QItemLabel> </a>
<QTable :rows="ticket.packagings" flat> <QTable :rows="ticket.packagings" flat>
<template #header="props"> <template #header="props">
<QTr :props="props"> <QTr :props="props">
<QTh auto-width>{{ <QTh auto-width>{{ t('ticket.summary.created') }}</QTh>
t('ticket.summary.created') <QTh auto-width>{{ t('ticket.summary.package') }}</QTh>
}}</QTh> <QTh auto-width>{{ t('ticket.summary.quantity') }}</QTh>
<QTh auto-width>{{
t('ticket.summary.package')
}}</QTh>
<QTh auto-width>{{
t('ticket.summary.quantity')
}}</QTh>
</QTr> </QTr>
</template> </template>
<template #body="props"> <template #body="props">
@ -527,32 +410,19 @@ async function changeState(value) {
</QTr> </QTr>
</template> </template>
</QTable> </QTable>
</QList>
</div> <a class="header link q-mt-xl" :href="ticketUrl + 'service'">
<div class="col" v-if="ticket.services.length > 0"> {{ t('ticket.summary.service') }}
<QList> <QIcon name="open_in_new" color="primary" />
<QItemLabel header class="text-h6"> </a>
{{ t('ticket.summary.services') }}
<QIcon name="open_in_new" />
</QItemLabel>
<QTable :rows="ticket.services" flat> <QTable :rows="ticket.services" flat>
<template #header="props"> <template #header="props">
<QTr :props="props"> <QTr :props="props">
<QTh auto-width>{{ <QTh auto-width>{{ t('ticket.summary.quantity') }}</QTh>
t('ticket.summary.quantity') <QTh auto-width>{{ t('ticket.summary.description') }}</QTh>
}}</QTh> <QTh auto-width>{{ t('ticket.summary.price') }}</QTh>
<QTh auto-width>{{ <QTh auto-width>{{ t('ticket.summary.taxClass') }}</QTh>
t('ticket.summary.description') <QTh auto-width>{{ t('ticket.summary.amount') }}</QTh>
}}</QTh>
<QTh auto-width>{{
t('ticket.summary.price')
}}</QTh>
<QTh auto-width>{{
t('ticket.summary.taxClass')
}}</QTh>
<QTh auto-width>{{
t('ticket.summary.amount')
}}</QTh>
</QTr> </QTr>
</template> </template>
<template #body="props"> <template #body="props">
@ -562,156 +432,34 @@ async function changeState(value) {
<QTd>{{ toCurrency(props.row.price) }}</QTd> <QTd>{{ toCurrency(props.row.price) }}</QTd>
<QTd>{{ props.row.taxClass.description }}</QTd> <QTd>{{ props.row.taxClass.description }}</QTd>
<QTd>{{ <QTd>{{
toCurrency( toCurrency(props.row.quantity * props.row.price)
props.row.quantity * props.row.price
)
}}</QTd> }}</QTd>
</QTr> </QTr>
</template> </template>
</QTable> </QTable>
</QList>
</div>
</div>
<div class="row q-pa-md" v-if="ticket.requests.length > 0">
<div class="col">
<QList>
<QItemLabel header class="text-h6">
{{ t('ticket.summary.request') }}
<QIcon name="open_in_new" />
</QItemLabel>
<QTable :rows="ticket.requests" flat>
<template #header="props">
<QTr :props="props">
<QTh auto-width>{{
t('ticket.summary.description')
}}</QTh>
<QTh auto-width>{{
t('ticket.summary.created')
}}</QTh>
<QTh auto-width>{{
t('ticket.summary.requester')
}}</QTh>
<QTh auto-width>{{
t('ticket.summary.atender')
}}</QTh>
<QTh auto-width>{{
t('ticket.summary.quantity')
}}</QTh>
<QTh auto-width>{{
t('ticket.summary.price')
}}</QTh>
<QTh auto-width>{{
t('ticket.summary.item')
}}</QTh>
<QTh auto-width>Ok</QTh>
</QTr>
</template>
<template #body="props">
<QTr :props="props">
<QTd>{{ props.row.description }}</QTd>
<QTd>{{ toDate(props.row.created) }}</QTd>
<QTd>{{ props.row.requester.user.name }}</QTd>
<QTd>{{ props.row.atender.user.name }}</QTd>
<QTd>{{ props.row.quantity }}</QTd>
<QTd>{{ toCurrency(props.row.price) }}</QTd>
<QTd v-if="!props.row.sale">-</QTd>
<QTd v-if="props.row.sale" class="link">{{
props.row.sale.itemFk
}}</QTd>
<QTd
><QCheckbox
v-model="props.row.isOk"
:disable="true"
/></QTd>
</QTr>
</template>
</QTable>
</QList>
</div>
</div>
</template>
</QCard> </QCard>
</div> </template>
</CardSummary>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.container { .notes {
display: flex; width: max-content;
justify-content: center;
} }
.cardSummary .summaryBody > .q-card > .taxes {
.q-card { border: 2px solid gray;
width: 100%; padding: 0;
height: 100%; > .vn-label-value {
max-width: 1200px;
}
.summary {
.q-list {
.q-item__label--header {
display: flex;
justify-content: space-between;
a {
color: $primary;
}
}
}
.fetched-tags {
display: flex;
flex-wrap: wrap;
align-items: center;
& span {
flex-basis: 50%;
}
& span.subName {
flex-basis: 50%;
color: $secondary;
text-transform: uppercase;
font-size: 0.75rem;
}
}
.q-table__container {
text-align: left;
.q-icon {
padding: 2%;
}
}
.taxes {
border: $border-thin-light;
text-align: right; text-align: right;
padding: 8px;
}
.row {
flex-wrap: wrap;
.col {
min-width: 250px;
padding-left: 1.5%;
padding-right: 1.5%;
}
}
.header {
font-size: 18px;
display: flex; display: flex;
justify-content: space-between; flex-direction: row;
align-items: center; margin-top: 5px;
align-content: center; justify-content: flex-end;
margin: 0; padding-right: 20px;
text-align: center;
span {
flex: 1;
}
.q-btn {
flex: none;
}
} }
} }
.q-dialog .summary { .cardSummary .summaryBody > .q-card:has(.taxes) {
max-width: 1200px; margin-top: 2px;
padding: 0;
} }
</style> </style>

View File

@ -9,6 +9,8 @@ import { toDate, toDateString, toCurrency } from 'src/filters/index';
import TicketSummaryDialog from './Card/TicketSummaryDialog.vue'; import TicketSummaryDialog from './Card/TicketSummaryDialog.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import TicketFilter from './TicketFilter.vue'; import TicketFilter from './TicketFilter.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import CardList from 'src/components/ui/CardList.vue';
const router = useRouter(); const router = useRouter();
const quasar = useQuasar(); const quasar = useQuasar();
@ -18,34 +20,6 @@ const stateStore = useStateStore();
onMounted(() => (stateStore.rightDrawer = true)); onMounted(() => (stateStore.rightDrawer = true));
onUnmounted(() => (stateStore.rightDrawer = false)); onUnmounted(() => (stateStore.rightDrawer = false));
const filter = {
include: [
{
relation: 'client',
scope: {
include: {
relation: 'salesPersonUser',
scope: {
fields: ['name'],
},
},
},
},
{
relation: 'ticketState',
scope: {
fields: ['stateFk', 'code', 'alertLevel'],
include: {
relation: 'state',
scope: {
fields: ['name'],
},
},
},
},
],
};
const from = Date.vnNew(); const from = Date.vnNew();
const to = Date.vnNew(); const to = Date.vnNew();
to.setDate(to.getDate() + 1); to.setDate(to.getDate() + 1);
@ -55,14 +29,6 @@ const userParams = {
to: toDateString(to), to: toDateString(to),
}; };
function stateColor(row) {
if (row.alertLevelCode === 'OK') return 'green';
if (row.alertLevelCode === 'FREE') return 'blue-3';
if (row.alertLevel === 1) return 'orange';
if (row.alertLevel === 0) return 'red';
return 'red';
}
function navigate(id) { function navigate(id) {
router.push({ path: `/ticket/${id}` }); router.push({ path: `/ticket/${id}` });
} }
@ -112,111 +78,55 @@ function viewSummary(id) {
<VnPaginate <VnPaginate
data-key="TicketList" data-key="TicketList"
url="Tickets/filter" url="Tickets/filter"
:filter="filter"
:user-params="userParams" :user-params="userParams"
order="id DESC" order="id DESC"
auto-load auto-load
> >
<template #body="{ rows }"> <template #body="{ rows }">
<QCard class="card q-mb-md" v-for="row of rows" :key="row.id"> <CardList
<QItem v-for="row of rows"
class="q-pa-none items-start cursor-pointer q-hoverable" :key="row.id"
v-ripple :id="row.id"
clickable @click="navigate(row.id)"
> >
<QItemSection class="q-pa-md" @click="navigate(row.id)"> <template #list-items>
<div class="text-h6">{{ row.name }}</div> <VnLv
<QItemLabel caption>#{{ row.id }}</QItemLabel> :label="t('ticket.list.nickname')"
<QList> :value="row.nickname"
<QItem class="q-pa-none"> />
<QItemSection> <VnLv :label="t('ticket.list.state')">
<QItemLabel caption> <template #value>
{{ t('ticket.list.nickname') }}
</QItemLabel>
<QItemLabel>
{{ row.nickname }}
</QItemLabel>
</QItemSection>
<QItemSection>
<QItemLabel caption>
{{ t('ticket.list.state') }}
</QItemLabel>
<QItemLabel>
<QBadge <QBadge
:color="stateColor(row)" :color="row.classColor ?? 'orange'"
class="q-ma-none" class="q-ma-none"
dense dense
> >
{{ row.state }} {{ row.state }}
</QBadge> </QBadge>
</QItemLabel> </template>
</QItemSection> </VnLv>
</QItem> <VnLv
<QItem class="q-pa-none"> :label="t('ticket.list.shipped')"
<QItemSection> :value="toDate(row.shipped)"
<QItemLabel caption> />
{{ t('ticket.list.shipped') }} <VnLv :label="t('Zone')" :value="row.zoneName" />
</QItemLabel> <VnLv
<QItemLabel> :label="t('ticket.list.salesPerson')"
{{ toDate(row.shipped) }} :value="row.salesPerson"
</QItemLabel> />
</QItemSection> <VnLv
<QItemSection> :label="t('ticket.list.total')"
<QItemLabel caption> :value="toCurrency(row.totalWithVat)"
{{ t('Zone') }} />
</QItemLabel> </template>
<QItemLabel> <template #actions>
{{ row.zoneName }} <QBtn flat icon="preview" @click.stop="viewSummary(row.id)">
</QItemLabel>
</QItemSection>
</QItem>
<QItem class="q-pa-none">
<QItemSection>
<QItemLabel caption>
{{ t('ticket.list.salesPerson') }}
</QItemLabel>
<QItemLabel>
{{ row.salesPerson }}
</QItemLabel>
</QItemSection>
<QItemSection>
<QItemLabel caption>
{{ t('ticket.list.total') }}
</QItemLabel>
<QItemLabel>
{{ toCurrency(row.totalWithVat) }}
</QItemLabel>
</QItemSection>
</QItem>
</QList>
</QItemSection>
<QSeparator vertical />
<QCardActions vertical class="justify-between">
<QBtn
flat
round
color="orange"
icon="arrow_circle_right"
@click="navigate(row.id)"
>
<QTooltip>
{{ t('components.smartCard.openCard') }}
</QTooltip>
</QBtn>
<QBtn
flat
round
color="grey-7"
icon="preview"
@click="viewSummary(row.id)"
>
<QTooltip> <QTooltip>
{{ t('components.smartCard.openSummary') }} {{ t('components.smartCard.openSummary') }}
</QTooltip> </QTooltip>
</QBtn> </QBtn>
</QCardActions> </template>
</QItem> </CardList>
</QCard>
</template> </template>
</VnPaginate> </VnPaginate>
</div> </div>

View File

@ -4,7 +4,8 @@ import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import CardDescriptor from 'src/components/ui/CardDescriptor.vue'; import CardDescriptor from 'src/components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import useCardDescription from 'src/composables/useCardDescription';
const $props = defineProps({ const $props = defineProps({
id: { id: {
type: Number, type: Number,
@ -52,19 +53,29 @@ function getWorkerAvatar() {
const token = getToken(); const token = getToken();
return `/api/Images/user/160x160/${route.params.id}/download?access_token=${token}`; return `/api/Images/user/160x160/${route.params.id}/download?access_token=${token}`;
} }
const data = ref(useCardDescription());
const setData = (entity) =>
(data.value = useCardDescription(entity.user.nickname, entity.id));
</script> </script>
<template> <template>
<CardDescriptor <CardDescriptor
module="Worker" module="Worker"
:url="`Workers/${entityId}`" :url="`Workers/${entityId}`"
:filter="filter" :filter="filter"
@on-fetch="(data) => (worker = data)" :title="data.title"
:subtitle="data.subtitle"
@on-fetch="
(data) => {
worker = data;
setData(data);
}
"
> >
<template #before> <template #before>
<QImg :src="getWorkerAvatar()" class="photo"> <QImg :src="getWorkerAvatar()" class="photo">
<template #error> <template #error>
<div <div
class="absolute-full bg-grey-10 text-center q-pa-md flex flex-center" class="absolute-full picture text-center q-pa-md flex flex-center"
> >
<div> <div>
<div class="text-grey-5" style="opacity: 0.4; font-size: 5vh"> <div class="text-grey-5" style="opacity: 0.4; font-size: 5vh">
@ -78,55 +89,15 @@ function getWorkerAvatar() {
</template> </template>
</QImg> </QImg>
</template> </template>
<template #description="{ entity }">
<span>
{{ entity.user.nickname }}
<QTooltip>{{ entity.user.nickname }}</QTooltip>
</span>
</template>
<template #body="{ entity }"> <template #body="{ entity }">
<QList> <VnLv :label="t('worker.card.name')" :value="entity.user.nickname" />
<QItem> <VnLv :label="t('worker.card.email')" :value="entity.user.email"> </VnLv>
<QItemSection> <VnLv
<QItemLabel caption> {{ t('worker.card.name') }} </QItemLabel> :label="t('worker.list.department')"
<QItemLabel>{{ entity.user.nickname }}</QItemLabel> :value="entity.department ? entity.department.department.name : null"
</QItemSection> />
</QItem> <VnLv :label="t('worker.card.phone')" :value="entity.phone" />
<QItem> <VnLv :label="t('worker.summary.sipExtension')" :value="sip" />
<QItemSection>
<QItemLabel caption>
{{ t('worker.card.email') }}
</QItemLabel>
<QItemLabel>{{ entity.user.email }}</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption>
{{ t('worker.list.department') }}
</QItemLabel>
<QItemLabel>
{{ entity.department.department.name }}
</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption>
{{ t('worker.card.phone') }}
</QItemLabel>
<QItemLabel>{{ entity.phone }}</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption
>{{ t('worker.summary.sipExtension') }}
</QItemLabel>
<QItemLabel>{{ sip }}</QItemLabel>
</QItemSection>
</QItem>
</QList>
</template> </template>
</CardDescriptor> </CardDescriptor>
</template> </template>

View File

@ -3,11 +3,11 @@ import axios from 'axios';
import { ref, onMounted, computed, onUpdated } from 'vue'; import { ref, onMounted, computed, onUpdated } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import SkeletonSummary from 'components/ui/SkeletonSummary.vue'; import CardSummary from 'components/ui/CardSummary.vue';
import { getUrl } from 'src/composables/getUrl';
import VnLv from 'src/components/ui/VnLv.vue';
import WorkerDescriptorProxy from './WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from './WorkerDescriptorProxy.vue';
import { dashIfEmpty } from 'src/filters';
onMounted(() => fetch());
onUpdated(() => fetch());
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
@ -20,8 +20,11 @@ const $props = defineProps({
}); });
const entityId = computed(() => $props.id || route.params.id); const entityId = computed(() => $props.id || route.params.id);
const workerUrl = ref();
const worker = ref(null); onMounted(async () => {
workerUrl.value = (await getUrl('')) + `worker/${entityId.value}/`;
});
const filter = { const filter = {
include: [ include: [
@ -59,230 +62,59 @@ const filter = {
}, },
], ],
}; };
function fetch() {
const id = entityId.value;
axios.get(`/Workers/${id}`, { params: { filter } }).then((response) => {
worker.value = response.data;
});
}
function sipExtension() {
if (worker.value.sip) return worker.value.sip.extension;
return '-';
}
</script> </script>
<template> <template>
<div class="summary container"> <CardSummary ref="summary" :url="`Workers/${entityId}`" :filter="filter">
<QCard> <template #header="{ entity }">
<SkeletonSummary v-if="!worker" /> <div>{{ entity.id }} - {{ entity.firstName }} {{ entity.lastName }}</div>
<template v-if="worker"> </template>
<div class="header bg-primary q-pa-sm q-mb-md"> <template #body="{ entity: worker }">
{{ worker.id }} - {{ worker.firstName }} {{ worker.lastName }} <QCard class="vn-one">
</div> <a class="header" :href="workerUrl + `basic-data`">
<div class="row q-pa-md q-col-gutter-md q-mb-md">
<div class="col">
<QList>
<QItemLabel header class="text-h6">
{{ t('worker.summary.basicData') }} {{ t('worker.summary.basicData') }}
</QItemLabel> <QIcon name="open_in_new" color="primary" />
<QItem> </a>
<QItemSection> <VnLv :label="t('worker.card.name')" :value="worker.user.nickname" />
<QItemLabel caption> ID </QItemLabel> <VnLv
<QItemLabel>{{ worker.id }}</QItemLabel> :label="t('worker.list.department')"
</QItemSection> :value="worker.department.department.name"
</QItem> />
<QItem> <VnLv :label="t('worker.list.email')" :value="worker.user.email" />
<QItemSection> <VnLv :label="t('worker.summary.boss')" link>
<QItemLabel caption <template #value>
>{{ t('worker.card.name') }}
</QItemLabel>
<QItemLabel>
{{ worker.user.nickname }}
</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption
>{{ t('worker.list.department') }}
</QItemLabel>
<QItemLabel>{{
worker.department.department.name
}}</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption
>{{ t('worker.list.email') }}
</QItemLabel>
<QItemLabel>{{ worker.user.email }}</QItemLabel>
</QItemSection>
</QItem>
<QItem
class="items-start cursor-pointer q-hoverable"
v-if="worker.boss"
>
<QItemSection>
<QItemLabel caption>
{{ t('worker.summary.boss') }}
</QItemLabel>
<QItemLabel>
<span class="link"> <span class="link">
{{ worker.boss.name }} {{ dashIfEmpty(worker.boss?.name) }}
<WorkerDescriptorProxy :id="worker.bossFk" /> <WorkerDescriptorProxy
:id="worker.bossFk"
v-if="worker.boss"
/>
</span> </span>
</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption
>{{ t('worker.summary.phoneExtension') }}
</QItemLabel>
<QItemLabel>
{{
worker.mobileExtension == ''
? worker.mobileExtension
: '-'
}}
</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption
>{{ t('worker.summary.entPhone') }}
</QItemLabel>
<QItemLabel>{{
worker.phone == '' ? worker.phone : '-'
}}</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption
>{{ t('worker.summary.personalPhone') }}
</QItemLabel>
<QItemLabel>{{
worker.client.phone == ''
? worker.client.phone
: '-'
}}</QItemLabel>
</QItemSection>
</QItem>
</QList>
</div>
<div class="col">
<QList>
<QItemLabel header class="text-h6">
{{ t('worker.summary.userData') }}
</QItemLabel>
<QItem>
<QItemSection>
<QItemLabel caption>
{{ t('worker.summary.userId') }}
</QItemLabel>
<QItemLabel>{{ worker.user.id }}</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption
>{{ t('worker.card.name') }}
</QItemLabel>
<QItemLabel>{{ worker.user.nickname }}</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption
>{{ t('worker.summary.role') }}
</QItemLabel>
<QItemLabel>{{ worker.user.role.name }}</QItemLabel>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QItemLabel caption
>{{ t('worker.summary.sipExtension') }}
</QItemLabel>
<QItemLabel>{{ sipExtension() }}</QItemLabel>
</QItemSection>
</QItem>
</QList>
</div>
</div>
</template> </template>
</VnLv>
<VnLv
:label="t('worker.summary.phoneExtension')"
:value="worker.mobileExtension"
/>
<VnLv :label="t('worker.summary.entPhone')" :value="worker.phone" />
<VnLv
:label="t('worker.summary.personalPhone')"
:value="worker.client.phone"
/>
<VnLv :label="t('worker.summary.locker')" :value="worker.locker" />
</QCard> </QCard>
<QCard class="vn-one">
<div class="header">
{{ t('worker.summary.userData') }}
</div> </div>
<VnLv :label="t('worker.summary.userId')" :value="worker.user.id" />
<VnLv :label="t('worker.card.name')" :value="worker.user.nickname" />
<VnLv :label="t('worker.summary.role')" :value="worker.user.role.name" />
<VnLv
:label="t('worker.summary.sipExtension')"
:value="worker?.sip?.extension"
/>
</QCard>
</template>
</CardSummary>
</template> </template>
<style lang="scss" scoped>
.avatar {
width: 40px;
height: 40px;
border-radius: 50%;
margin-right: 10px;
}
.container {
display: flex;
justify-content: center;
}
.q-card {
width: 100%;
max-width: 1200px;
}
.negative {
color: red;
}
.summary {
.q-list {
.q-item__label--header {
display: flex;
justify-content: space-between;
a {
color: $primary;
}
}
}
.row {
flex-wrap: wrap;
.col {
min-width: 250px;
}
}
.header {
text-align: center;
font-size: 18px;
}
#slider-container {
max-width: 80%;
margin: 0 auto;
.q-slider {
.q-slider__marker-labels:nth-child(1) {
transform: none;
}
.q-slider__marker-labels:nth-child(2) {
transform: none;
left: auto !important;
right: 0%;
}
}
}
}
.q-dialog .summary {
max-width: 1200px;
}
</style>

View File

@ -7,6 +7,8 @@ import VnPaginate from 'src/components/ui/VnPaginate.vue';
import WorkerSummaryDialog from './Card/WorkerSummaryDialog.vue'; import WorkerSummaryDialog from './Card/WorkerSummaryDialog.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import WorkerFilter from './WorkerFilter.vue'; import WorkerFilter from './WorkerFilter.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import CardList from 'src/components/ui/CardList.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const router = useRouter(); const router = useRouter();
@ -66,73 +68,38 @@ function viewSummary(id) {
auto-load auto-load
> >
<template #body="{ rows }"> <template #body="{ rows }">
<QCard class="card q-mb-md" v-for="row of rows" :key="row.id"> <CardList
<QItem v-for="row of rows"
class="q-pa-none items-start cursor-pointer q-hoverable" :key="row.id"
v-ripple @click="navigate(row.id)"
clickable :title="row.nickname"
> >
<QItemSection class="q-pa-md" @click="navigate(row.id)"> <template #list-items>
<QItemLabel class="text-h6"> <VnLv label="ID" :value="row.id" />
{{ row.nickname }} <VnLv :label="t('worker.list.name')" :value="row.userName" />
</QItemLabel> <VnLv :label="t('worker.list.email')" :value="row.email" />
<QItemLabel caption>#{{ row.id }}</QItemLabel> <VnLv
<QList> :label="t('worker.list.department')"
<QItem class="q-pa-none"> :value="row.department"
<QItemSection> />
<QItemLabel caption> </template>
{{ t('worker.list.name') }} <template #actions>
</QItemLabel>
<QItemLabel>{{ row.userName }}</QItemLabel>
</QItemSection>
</QItem>
<QItem class="q-pa-none">
<QItemSection>
<QItemLabel caption>
{{ t('worker.list.email') }}
</QItemLabel>
<QItemLabel>{{ row.email }}</QItemLabel>
</QItemSection>
</QItem>
<QItem class="q-pa-none">
<QItemSection>
<QItemLabel caption>{{
t('worker.list.department')
}}</QItemLabel>
<QItemLabel>
{{ row.department }}
</QItemLabel>
</QItemSection>
</QItem>
</QList>
</QItemSection>
<QSeparator vertical />
<QCardActions vertical class="justify-between">
<QBtn <QBtn
flat flat
round
color="primary"
icon="arrow_circle_right" icon="arrow_circle_right"
@click="navigate(row.id)" @click.stop="navigate(row.id)"
> >
<QTooltip> <QTooltip>
{{ t('components.smartCard.openCard') }} {{ t('components.smartCard.openCard') }}
</QTooltip> </QTooltip>
</QBtn> </QBtn>
<QBtn <QBtn flat icon="preview" @click.stop="viewSummary(row.id)">
flat
round
color="grey-7"
icon="preview"
@click="viewSummary(row.id)"
>
<QTooltip> <QTooltip>
{{ t('components.smartCard.openSummary') }} {{ t('components.smartCard.openSummary') }}
</QTooltip> </QTooltip>
</QBtn> </QBtn>
</QCardActions> </template>
</QItem> </CardList>
</QCard>
</template> </template>
</VnPaginate> </VnPaginate>
</div> </div>

View File

@ -45,8 +45,8 @@ export { Router };
export default route(function (/* { store, ssrContext } */) { export default route(function (/* { store, ssrContext } */) {
Router.beforeEach(async (to, from, next) => { Router.beforeEach(async (to, from, next) => {
const { isLoggedIn } = session; const { isLoggedIn } = session;
const outLayout = ['Login', 'TwoFactor'];
if (!isLoggedIn() && to.name !== 'Login') { if (!isLoggedIn() && !outLayout.includes(to.name)) {
return next({ name: 'Login', query: { redirect: to.fullPath } }); return next({ name: 'Login', query: { redirect: to.fullPath } });
} }

View File

@ -9,10 +9,22 @@ import route from './modules/route';
const routes = [ const routes = [
{ {
path: '/login', path: '/login',
component: () => import('../layouts/OutLayout.vue'),
children: [
{
path: '',
name: 'Login', name: 'Login',
meta: { title: 'logIn' }, meta: { title: 'logIn' },
component: () => import('../pages/Login/LoginMain.vue'), component: () => import('../pages/Login/LoginMain.vue'),
}, },
{
path: '/twoFactor',
name: 'TwoFactor',
meta: { title: 'twoFactor' },
component: () => import('../pages/Login/TwoFactor.vue'),
},
],
},
{ {
path: '/', path: '/',
name: 'Main', name: 'Main',
@ -37,7 +49,7 @@ const routes = [
component: () => import('../pages/NotFound.vue'), component: () => import('../pages/NotFound.vue'),
}, },
wagon, wagon,
route route,
], ],
}, },
]; ];

View File

@ -3,28 +3,37 @@ describe('Login', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('/#/login'); cy.visit('/#/login');
cy.get('#switchLanguage').click(); cy.get('#switchLanguage').click();
cy.get('div.q-menu div.q-item:nth-child(1)').click(); cy.get('.q-menu > :nth-child(1) > .q-item').click();
}); });
it('should fail to log in using wrong user', () => { it('should fail to log in using wrong user', () => {
cy.get('input[aria-label="Username"]').type('incorrectUser'); cy.get('input[aria-label="Username"]').type('incorrectUser');
cy.get('input[aria-label="Password"]').type('nightmare'); cy.get('input[aria-label="Password"]').type('nightmare');
cy.get('button[type="submit"]').click(); cy.get('button[type="submit"]').click();
cy.get('.q-notification__message').should('have.text', 'Invalid username or password'); cy.get('.q-notification__message').should(
'have.text',
'Invalid username or password'
);
}); });
it('should fail to log in using wrong password', () => { it('should fail to log in using wrong password', () => {
cy.get('input[aria-label="Username"]').type('employee'); cy.get('input[aria-label="Username"]').type('employee');
cy.get('input[aria-label="Password"]').type('wrongPassword'); cy.get('input[aria-label="Password"]').type('wrongPassword');
cy.get('button[type="submit"]').click(); cy.get('button[type="submit"]').click();
cy.get('.q-notification__message').should('have.text', 'Invalid username or password'); cy.get('.q-notification__message').should(
'have.text',
'Invalid username or password'
);
}); });
it('should log in', () => { it('should log in', () => {
cy.get('input[aria-label="Username"]').type('employee'); cy.get('input[aria-label="Username"]').type('employee');
cy.get('input[aria-label="Password"]').type('nightmare'); cy.get('input[aria-label="Password"]').type('nightmare');
cy.get('button[type="submit"]').click(); cy.get('button[type="submit"]').click();
cy.get('.q-notification__message').should('have.text', 'You have successfully logged in'); cy.get('.q-notification__message').should(
'have.text',
'You have successfully logged in'
);
cy.url().should('contain', '/dashboard'); cy.url().should('contain', '/dashboard');
}); });
@ -32,7 +41,10 @@ describe('Login', () => {
cy.get('input[aria-label="Username"]').type('employee'); cy.get('input[aria-label="Username"]').type('employee');
cy.get('input[aria-label="Password"]').type('nightmare'); cy.get('input[aria-label="Password"]').type('nightmare');
cy.get('button[type="submit"]').click(); cy.get('button[type="submit"]').click();
cy.get('.q-notification__message').should('have.text', 'You have successfully logged in'); cy.get('.q-notification__message').should(
'have.text',
'You have successfully logged in'
);
cy.url().should('contain', '/dashboard'); cy.url().should('contain', '/dashboard');
cy.get('#user').click(); cy.get('#user').click();
cy.get('#logout').click(); cy.get('#logout').click();

View File

@ -6,18 +6,21 @@ describe('WorkerList', () => {
}); });
it('should load workers', () => { it('should load workers', () => {
cy.get('div[class="q-item__label text-h6"]').eq(0).should('have.text', 'Jessica Jones'); cy.get('.list-items > .vn-label-value:nth-child(2) > .value')
cy.get('div[class="q-item__label text-h6"]').eq(1).should('have.text', 'Bruce Banner'); .eq(0)
cy.get('div[class="q-item__label text-h6"]').eq(2).should('have.text', 'Charles Xavier'); .should('have.text', 'JessicaJones');
cy.get('.list-items > .vn-label-value:nth-child(2) > .value')
.eq(1)
.should('have.text', 'BruceBanner');
cy.get('.list-items > .vn-label-value:nth-child(2) > .value')
.eq(2)
.should('have.text', 'CharlesXavier');
}); });
it('should open the worker summary', () => { it('should open the worker summary', () => {
cy.get('div.text-h6') cy.get('.card-list-body .actions .q-btn:nth-child(2)').eq(0).click();
.parentsUntil('div.q-card') cy.get('.summaryHeader div').should('have.text', '1110 - Jessica Jones');
.find('div.q-card__actions') cy.get('.summary .header').eq(0).invoke('text').should('include', 'Basic data');
.find('button').first().click(); cy.get('.summary .header').eq(1).should('have.text', 'User data');
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(1).should('have.text', 'User data');
}); });
}); });

View File

@ -1,4 +1,4 @@
describe('WorkerNotificationsManager', () => { xdescribe('WorkerNotificationsManager', () => {
beforeEach(() => { beforeEach(() => {
const workerId = 1110; const workerId = 1110;
cy.viewport(1280, 720); cy.viewport(1280, 720);
@ -9,16 +9,25 @@ describe('WorkerNotificationsManager', () => {
it('should unsubscribe 2 notifications, check the unsubscription has been saved, subscribe to other one and should check the data has been saved', () => { it('should unsubscribe 2 notifications, check the unsubscription has been saved, subscribe to other one and should check the data has been saved', () => {
cy.get('.q-chip').should('have.length', 3); cy.get('.q-chip').should('have.length', 3);
cy.get('.q-toggle__thumb').eq(0).click(); cy.get('.q-toggle__thumb').eq(0).click();
cy.get('.q-notification__message').should('have.text', 'Unsubscribed from the notification'); cy.get('.q-notification__message').should(
'have.text',
'Unsubscribed from the notification'
);
cy.get('.q-chip > .q-icon').eq(0).click(); cy.get('.q-chip > .q-icon').eq(0).click();
cy.reload(); cy.reload();
cy.get('.q-chip').should('have.length', 1); cy.get('.q-chip').should('have.length', 1);
cy.get('.q-toggle__thumb').should('have.length', 3).eq(0).click(); cy.get('.q-toggle__thumb').should('have.length', 3).eq(0).click();
cy.get('.q-notification__message').should('have.text', 'Subscribed to the notification'); cy.get('.q-notification__message').should(
'have.text',
'Subscribed to the notification'
);
cy.get('.q-toggle__thumb').should('have.length', 3).eq(1).click(); cy.get('.q-toggle__thumb').should('have.length', 3).eq(1).click();
cy.get('.q-notification__message').should('have.text', 'Subscribed to the notification'); cy.get('.q-notification__message').should(
'have.text',
'Subscribed to the notification'
);
cy.reload(); cy.reload();

View File

@ -1,15 +1,15 @@
describe('WorkerSummary', () => { describe('WorkerSummary', () => {
beforeEach(() => { beforeEach(() => {
cy.viewport(1280, 720) cy.viewport(1280, 720);
cy.login('developer') cy.login('developer');
cy.visit('/#/worker/19/summary'); cy.visit('/#/worker/19/summary');
}); });
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 salesBoss'); cy.get('.summaryHeader > div').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(':nth-child(1) > :nth-child(2) > .value > span').should(
cy.get('div[class="q-item__label q-item__label--header text-h6"]').eq(1).should('have.text', 'User data'); 'have.text',
cy.get('div[class="q-item__section column q-item__section--main justify-center"]').eq(0).should('have.text', 'NamesalesBossNick'); 'salesBossNick'
);
}); });
}); });