This commit is contained in:
William Buezas 2024-01-11 09:33:22 -03:00
commit 19d793a939
89 changed files with 1261 additions and 856 deletions

View File

@ -5,15 +5,26 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2352.01] - 2023-12-28 ## [2400.01] - 2024-01-04
### Added ### Added
- (carros) => Se añade contador de carros. #6545
- (Reclamaciones) => Se añade la sección para hacer acciones sobre una reclamación. #5654
### Changed
### Fixed
- (Reclamaciones) => Se corrige el color de la barra según el tema y el evento de actualziar cantidades #6334
### Changed
### Fixed
## [2350.01] - 2023-12-14
### Added
- (Carros) => Se añade contador de carros. #6545
- (Reclamaciones) => Se añade la sección para hacer acciones sobre una reclamación. #5654
### Changed
### Fixed
- (Reclamaciones) => Se corrige el color de la barra según el tema y el evento de actualziar cantidades #6334
## [2253.01] - 2023-01-05 ## [2253.01] - 2023-01-05

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "salix-front", "name": "salix-front",
"version": "23.52.01", "version": "24.02.01",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "salix-front", "name": "salix-front",
"version": "23.52.01", "version": "24.02.01",
"dependencies": { "dependencies": {
"@quasar/cli": "^2.3.0", "@quasar/cli": "^2.3.0",
"@quasar/extras": "^1.16.4", "@quasar/extras": "^1.16.4",

View File

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

View File

@ -1,10 +1,11 @@
<script setup> <script setup>
import { onMounted } from 'vue'; import { onMounted } from 'vue';
import { useQuasar } from 'quasar'; import { useQuasar, Dark } from 'quasar';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
const quasar = useQuasar(); const quasar = useQuasar();
const { availableLocales, locale, fallbackLocale } = useI18n(); const { availableLocales, locale, fallbackLocale } = useI18n();
Dark.set(true);
onMounted(() => { onMounted(() => {
let userLang = window.navigator.language; let userLang = window.navigator.language;

View File

@ -30,7 +30,7 @@ const $props = defineProps({
params: { params: {
type: Object, type: Object,
default: null, default: null,
} },
}); });
const emit = defineEmits(['onFetch']); const emit = defineEmits(['onFetch']);
@ -42,9 +42,9 @@ onMounted(async () => {
} }
}); });
async function fetch() { async function fetch(fetchFilter = {}) {
try { try {
const filter = Object.assign({}, $props.filter); // eslint-disable-line vue/no-dupe-keys const filter = Object.assign(fetchFilter, $props.filter); // eslint-disable-line vue/no-dupe-keys
if ($props.where) filter.where = $props.where; if ($props.where) filter.where = $props.where;
if ($props.sortBy) filter.order = $props.sortBy; if ($props.sortBy) filter.order = $props.sortBy;
if ($props.limit) filter.limit = $props.limit; if ($props.limit) filter.limit = $props.limit;

View File

@ -135,12 +135,11 @@ async function save() {
await axios.patch($props.urlUpdate || $props.url, body); await axios.patch($props.urlUpdate || $props.url, body);
} }
emit('onDataSaved', formData.value); emit('onDataSaved', formData.value);
originalData.value = JSON.parse(JSON.stringify(formData.value));
hasChanges.value = false;
} catch (err) { } catch (err) {
notify('errors.create', 'negative'); notify('errors.create', 'negative');
} }
originalData.value = JSON.parse(JSON.stringify(formData.value));
hasChanges.value = false;
isLoading.value = false; isLoading.value = false;
} }

View File

@ -24,11 +24,8 @@ const pinnedModulesRef = ref();
</script> </script>
<template> <template>
<QHeader class="bg-dark" color="white" elevated> <QHeader color="white" elevated>
<QToolbar <QToolbar class="q-py-sm q-px-md">
class="q-py-sm q-px-md"
:class="{ 'q-gutter-x-sm': !quasar.platform.is.mobile }"
>
<QBtn @click="stateStore.toggleLeftDrawer()" icon="menu" round dense flat> <QBtn @click="stateStore.toggleLeftDrawer()" icon="menu" round dense flat>
<QTooltip bottom anchor="bottom right"> <QTooltip bottom anchor="bottom right">
{{ t('globals.collapseMenu') }} {{ t('globals.collapseMenu') }}
@ -108,6 +105,9 @@ const pinnedModulesRef = ref();
.searchbar { .searchbar {
width: max-content; width: max-content;
} }
.q-header {
background-color: var(--vn-dark);
}
</style> </style>
<i18n> <i18n>
en: en:

View File

@ -1,17 +1,18 @@
<script setup> <script setup>
import { onMounted, computed } from 'vue'; import { onMounted, computed } from 'vue';
import { Dark, Quasar } from 'quasar'; import { Dark, Quasar, 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 { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import { localeEquivalence } from "src/i18n/index";
const state = useState(); const state = useState();
const session = useSession(); const session = useSession();
const router = useRouter(); const router = useRouter();
const { t, locale } = useI18n(); const { t, locale } = useI18n();
const quasar = useQuasar();
const userLocale = computed({ const userLocale = computed({
get() { get() {
@ -20,13 +21,11 @@ const userLocale = computed({
set(value) { set(value) {
locale.value = value; locale.value = value;
if (value === 'en') value = 'en-GB'; value = localeEquivalence[value] ?? value
// FIXME: Dynamic imports from absolute paths are not compatible with vite:
// https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations
try { try {
const langList = import.meta.glob('../../node_modules/quasar/lang/*.mjs'); /* @vite-ignore */
langList[`../../node_modules/quasar/lang/${value}.mjs`]().then((lang) => { import(`../../node_modules/quasar/lang/${value}.mjs`).then((lang) => {
Quasar.lang.set(lang.default); Quasar.lang.set(lang.default);
}); });
} catch (error) { } catch (error) {
@ -81,6 +80,14 @@ function logout() {
session.destroy(); session.destroy();
router.push('/login'); router.push('/login');
} }
function copyUserToken(){
navigator.clipboard.writeText(session.getToken());
quasar.notify({
type: 'positive',
message: t('components.userPanel.copyToken'),
});
}
</script> </script>
<template> <template>
@ -122,7 +129,8 @@ function logout() {
<div class="text-subtitle1 q-mt-md"> <div class="text-subtitle1 q-mt-md">
<strong>{{ user.nickname }}</strong> <strong>{{ user.nickname }}</strong>
</div> </div>
<div class="text-subtitle3 text-grey-7 q-mb-xs">@{{ user.name }}</div> <div class="text-subtitle3 text-grey-7 q-mb-xs copyUserToken" @click="copyUserToken()" >@{{ user.name }}
</div>
<QBtn <QBtn
id="logout" id="logout"
@ -143,4 +151,10 @@ function logout() {
.panel { .panel {
width: 150px; width: 150px;
} }
.copyUserToken {
&:hover{
cursor: alias;
}
}
</style> </style>

View File

@ -69,6 +69,10 @@ function getBreadcrumb(param) {
> div { > div {
flex-wrap: nowrap; flex-wrap: nowrap;
} }
&--last,
&__separator {
color: var(--vn-label);
}
} }
@media (max-width: $breakpoint-md) { @media (max-width: $breakpoint-md) {
.q-breadcrumbs { .q-breadcrumbs {

View File

@ -12,8 +12,8 @@ import { useValidator } from 'src/composables/useValidator';
import VnAvatar from '../ui/VnAvatar.vue'; import VnAvatar from '../ui/VnAvatar.vue';
import VnJsonValue from '../common/VnJsonValue.vue'; import VnJsonValue from '../common/VnJsonValue.vue';
import FetchData from '../FetchData.vue'; import FetchData from '../FetchData.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnSelectFilter from './VnSelectFilter.vue'; import VnSelectFilter from './VnSelectFilter.vue';
import VnUserLink from '../ui/VnUserLink.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const validationsStore = useValidator(); const validationsStore = useValidator();
@ -421,15 +421,15 @@ setLogTree();
> >
<div class="timeline"> <div class="timeline">
<div class="user-avatar"> <div class="user-avatar">
<VnUserLink v-if="userLog.user.image" :worker-id="userLog.user.id">
<template #link>
<VnAvatar <VnAvatar
class="cursor-pointer" :class="{ 'cursor-pointer': userLog.user.id }"
:worker="userLog.user.id" :worker-id="userLog.user.id"
:title="userLog.user.nickname" :title="userLog.user.nickname"
/> />
<WorkerDescriptorProxy </template>
v-if="userLog.user.image" </VnUserLink>
:id="userLog.user.id"
/>
</div> </div>
<div class="arrow bg-panel" v-if="byRecord"></div> <div class="arrow bg-panel" v-if="byRecord"></div>
<div class="line"></div> <div class="line"></div>
@ -704,7 +704,7 @@ setLogTree();
class="q-pa-xs row items-center" class="q-pa-xs row items-center"
> >
<QItemSection class="col-3 items-center"> <QItemSection class="col-3 items-center">
<VnAvatar :worker="opt.id" /> <VnAvatar :worker-id="opt.id" />
</QItemSection> </QItemSection>
<QItemSection class="col-9 justify-center"> <QItemSection class="col-9 justify-center">
<span>{{ opt.name }}</span> <span>{{ opt.name }}</span>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, toRefs, computed } from 'vue'; import { ref, toRefs, computed, watch } from 'vue';
const emit = defineEmits(['update:modelValue', 'update:options']); const emit = defineEmits(['update:modelValue', 'update:options']);
const $props = defineProps({ const $props = defineProps({
@ -23,13 +23,31 @@ const $props = defineProps({
type: Boolean, type: Boolean,
default: true, default: true,
}, },
defaultFilter: {
type: Boolean,
default: true,
},
}); });
const { optionLabel } = toRefs($props); const { optionLabel, options } = toRefs($props);
const myOptions = ref([]); const myOptions = ref([]);
const myOptionsOriginal = computed(() => $props.options); const myOptionsOriginal = ref([]);
const vnSelectRef = ref(null); const vnSelectRef = ref();
const value = computed({
get() {
return $props.modelValue;
},
set(value) {
emit('update:modelValue', value);
},
});
function setOptions(data) {
myOptions.value = JSON.parse(JSON.stringify(data));
myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
}
setOptions(options.value);
const filter = (val, options) => { const filter = (val, options) => {
const search = val.toString().toLowerCase(); const search = val.toString().toLowerCase();
@ -53,6 +71,7 @@ const filter = (val, options) => {
const filterHandler = (val, update) => { const filterHandler = (val, update) => {
update( update(
() => { () => {
if ($props.defaultFilter)
myOptions.value = filter(val, myOptionsOriginal.value); myOptions.value = filter(val, myOptionsOriginal.value);
}, },
(ref) => { (ref) => {
@ -64,13 +83,8 @@ const filterHandler = (val, update) => {
); );
}; };
const value = computed({ watch(options, (newValue) => {
get() { setOptions(newValue);
return $props.modelValue;
},
set(value) {
emit('update:modelValue', value);
},
}); });
</script> </script>

View File

@ -62,7 +62,7 @@ async function getData() {
filter: $props.filter, filter: $props.filter,
skip: 0, skip: 0,
}); });
const { data } = await arrayData.fetch({ append: false }); const { data } = await arrayData.fetch({ append: false, updateRouter: false });
entity.value = data; entity.value = data;
emit('onFetch', data); emit('onFetch', data);
} }

View File

@ -97,7 +97,7 @@ watch(props, async () => {
flex: 2; flex: 2;
} }
> .q-card.vn-three { > .q-card.vn-three {
flex: 3; flex: 4;
} }
> .q-card.vn-max { > .q-card.vn-max {
width: 100%; width: 100%;
@ -116,17 +116,17 @@ watch(props, async () => {
margin-top: 5px; margin-top: 5px;
.label { .label {
color: var(--vn-label); color: var(--vn-label);
width: 10em; width: 8em;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
margin-right: 10px; margin-right: 10px;
flex-grow: 0;
flex-shrink: 0;
} }
.value { .value {
color: var(--vn-text); color: var(--vn-text);
width: max-content;
overflow: hidden; overflow: hidden;
white-space: nowrap;
} }
} }
.header { .header {

View File

@ -1,7 +1,8 @@
<script setup> <script setup>
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
const $props = defineProps({ const $props = defineProps({
worker: { type: Number, required: true }, workerId: { type: Number, required: true },
description: { type: String, default: null }, description: { type: String, default: null },
}); });
const session = useSession(); const session = useSession();
@ -11,7 +12,7 @@ const token = session.getToken();
<div class="avatar-picture column items-center"> <div class="avatar-picture column items-center">
<QAvatar color="orange"> <QAvatar color="orange">
<QImg <QImg
:src="`/api/Images/user/160x160/${$props.worker}/download?access_token=${token}`" :src="`/api/Images/user/160x160/${$props.workerId}/download?access_token=${token}`"
spinner-color="white" spinner-color="white"
/> />
</QAvatar> </QAvatar>

View File

@ -4,6 +4,8 @@ import { useI18n } from 'vue-i18n';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';
import toDate from 'filters/toDate'; import toDate from 'filters/toDate';
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps({ const props = defineProps({
dataKey: { dataKey: {
@ -39,6 +41,10 @@ const props = defineProps({
type: Array, type: Array,
default: () => [], default: () => [],
}, },
customTags: {
type: Array,
default: () => [],
},
}); });
const emit = defineEmits(['refresh', 'clear', 'search', 'init', 'remove']); const emit = defineEmits(['refresh', 'clear', 'search', 'init', 'remove']);
@ -104,19 +110,26 @@ async function clearFilters() {
emit('clear'); emit('clear');
} }
const tags = computed(() => { const tagsList = computed(() =>
return Object.entries(userParams.value) Object.entries(userParams.value)
.filter(([key, value]) => value && !(props.hiddenTags || []).includes(key)) .filter(([key, value]) => value && !(props.hiddenTags || []).includes(key))
.map(([key, value]) => ({ .map(([key, value]) => ({
label: key, label: key,
value: value, value: value,
})); }))
}); );
const tags = computed(() =>
tagsList.value.filter((tag) => !(props.customTags || []).includes(tag.label))
);
const customTags = computed(() =>
tagsList.value.filter((tag) => (props.customTags || []).includes(tag.label))
);
async function remove(key) { async function remove(key) {
userParams.value[key] = null; userParams.value[key] = null;
await search(); await search();
emit('remove', key) emit('remove', key);
} }
function formatValue(value) { function formatValue(value) {
@ -172,21 +185,17 @@ function formatValue(value) {
</QItem> </QItem>
<QItem class="q-mb-sm"> <QItem class="q-mb-sm">
<div <div
v-if="tags.length === 0" v-if="tagsList.length === 0"
class="text-grey font-xs text-center full-width" class="text-grey font-xs text-center full-width"
> >
{{ t(`No filters applied`) }} {{ t(`No filters applied`) }}
</div> </div>
<div> <div>
<QChip <VnFilterPanelChip
:key="chip.label"
@remove="remove(chip.label)"
class="text-dark"
color="primary"
icon="label"
:removable="!unremovableParams.includes(chip.label)"
size="sm"
v-for="chip of tags" v-for="chip of tags"
:key="chip.label"
:removable="!unremovableParams.includes(chip.label)"
@remove="remove(chip.label)"
> >
<slot name="tags" :tag="chip" :format-fn="formatValue"> <slot name="tags" :tag="chip" :format-fn="formatValue">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
@ -194,7 +203,15 @@ function formatValue(value) {
<span>"{{ chip.value }}"</span> <span>"{{ chip.value }}"</span>
</div> </div>
</slot> </slot>
</QChip> </VnFilterPanelChip>
<slot
v-if="$slots.customTags"
name="customTags"
:params="userParams"
:tags="customTags"
:format-fn="formatValue"
:search-fn="search"
/>
</div> </div>
</QItem> </QItem>
<QSeparator /> <QSeparator />

View File

@ -0,0 +1,7 @@
<script setup></script>
<template>
<QChip class="text-dark" color="primary" icon="label" size="sm" v-bind="$attrs">
<slot />
</QChip>
</template>

View File

@ -5,7 +5,7 @@ import { dashIfEmpty } from 'src/filters';
const $props = defineProps({ const $props = defineProps({
label: { type: String, default: null }, label: { type: String, default: null },
value: { value: {
type: [String, Boolean], type: [String, Boolean, Number],
default: null, default: null,
}, },
info: { type: String, default: null }, info: { type: String, default: null },
@ -13,6 +13,13 @@ const $props = defineProps({
}); });
const isBooleanValue = computed(() => typeof $props.value === 'boolean'); const isBooleanValue = computed(() => typeof $props.value === 'boolean');
</script> </script>
<style scoped>
.label,
.value {
white-space: pre-line;
word-wrap: break-word;
}
</style>
<template> <template>
<div class="vn-label-value"> <div class="vn-label-value">
<div v-if="$props.label || $slots.label" class="label"> <div v-if="$props.label || $slots.label" class="label">

View File

@ -1,11 +1,11 @@
<script setup> <script setup>
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnAvatar from 'src/components/ui/VnAvatar.vue'; import VnAvatar from 'src/components/ui/VnAvatar.vue';
import { toDateHour } from 'src/filters'; import { toDateHour } from 'src/filters';
import { ref } from 'vue'; import { ref } from 'vue';
import axios from 'axios'; import axios from 'axios';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnPaginate from './VnPaginate.vue'; import VnPaginate from './VnPaginate.vue';
import VnUserLink from '../ui/VnUserLink.vue';
const $props = defineProps({ const $props = defineProps({
id: { type: String, required: true }, id: { type: String, required: true },
@ -28,7 +28,7 @@ async function insert() {
} }
</script> </script>
<template> <template>
<div class="column items-center"> <div class="column items-center full-height">
<VnPaginate <VnPaginate
:data-key="$props.url" :data-key="$props.url"
:url="$props.url" :url="$props.url"
@ -42,13 +42,14 @@ async function insert() {
<QCard class="q-pa-md q-mb-md" v-for="(note, index) in rows" :key="index"> <QCard class="q-pa-md q-mb-md" v-for="(note, index) in rows" :key="index">
<QCardSection horizontal> <QCardSection horizontal>
<slot name="picture"> <slot name="picture">
<VnAvatar :worker="note.workerFk" /> <VnAvatar :descriptor="false" :worker-id="note.workerFk" />
</slot> </slot>
<QItem class="full-width justify-between items-start"> <QItem class="full-width justify-between items-start">
<span class="link"> <VnUserLink
{{ `${note.worker.firstName} ${note.worker.lastName}` }} :name="`${note.worker.firstName} ${note.worker.lastName}`"
<WorkerDescriptorProxy :id="note.worker.id" /> :worker-id="note.worker.id"
</span> />
<slot name="actions"> <slot name="actions">
{{ toDateHour(note.created) }} {{ toDateHour(note.created) }}
</slot> </slot>
@ -115,6 +116,10 @@ async function insert() {
<style lang="scss" scoped> <style lang="scss" scoped>
.q-card { .q-card {
max-width: 80em; max-width: 80em;
&__section {
word-wrap: break-word;
}
} }
.q-dialog .q-card { .q-dialog .q-card {
width: 400px; width: 400px;

View File

@ -168,7 +168,12 @@ async function onLoad(...params) {
</QCard> </QCard>
</div> </div>
</div> </div>
<QInfiniteScroll v-if="store.data" @load="onLoad" :offset="offset" class="full-width"> <QInfiniteScroll
v-if="store.data"
@load="onLoad"
:offset="offset"
class="full-width full-height overflow-auto"
>
<slot name="body" :rows="store.data"></slot> <slot name="body" :rows="store.data"></slot>
<div v-if="isLoading" class="info-row q-pa-md text-center"> <div v-if="isLoading" class="info-row q-pa-md text-center">
<QSpinner color="orange" size="md" /> <QSpinner color="orange" size="md" />

114
src/components/ui/VnSms.vue Normal file
View File

@ -0,0 +1,114 @@
<script setup>
import { onBeforeMount } from 'vue';
import { date } from 'quasar';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import VnAvatar from '../ui/VnAvatar.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const $props = defineProps({
url: { type: String, default: null },
where: { type: Object, default: () => {} },
});
const filter = {
fields: ['smsFk'],
include: {
relation: 'sms',
scope: {
fields: [
'senderFk',
'sender',
'destination',
'message',
'statusCode',
'status',
'created',
],
include: {
relation: 'sender',
scope: {
fields: ['name'],
},
},
},
},
};
onBeforeMount(() => (filter.where = $props.where));
function formatNumber(number) {
if (number.length <= 10) return number;
return number.slice(0, 4) + ' ' + number.slice(4);
}
</script>
<template>
<div class="column items-center">
<div class="list">
<VnPaginate
:data-key="$props.url"
:url="$props.url"
:filter="filter"
order="smsFk DESC"
:offset="100"
:limit="5"
auto-load
>
<template #body="{ rows }">
<QCard
flat
bordered
class="card q-pa-md q-mb-sm smsCard"
v-for="row of rows"
:key="row.smsFk"
>
<QItem>
<QItemSection side top>
<VnUserLink :worker-id="row.sms?.senderFk">
<template #link>
<VnAvatar
:worker-id="row.sms?.senderFk"
class="cursor-pointer"
:title="row.sms?.sender?.name"
/>
</template>
</VnUserLink>
</QItemSection>
<QSeparator />
<QItemSection>
<QItemLabel caption>{{
formatNumber(row.sms.destination)
}}</QItemLabel>
<QItemLabel>{{ row.sms.message }}</QItemLabel>
</QItemSection>
<QItemSection side>
<QItemLabel caption>{{
date.formatDate(
row.sms.created,
'YYYY-MM-DD HH:mm:ss'
)
}}</QItemLabel>
<QItemLabel class="row center">
<QChip
:color="
row.sms.status == 'OK'
? 'positive'
: 'negative'
"
>
{{ row.sms.status }}
</QChip>
</QItemLabel>
</QItemSection>
</QItem>
</QCard>
</template>
</VnPaginate>
</div>
</div>
</template>
<style lang="scss" scoped>
.q-item__section--side {
align-items: center;
}
</style>

View File

@ -0,0 +1,21 @@
<script setup>
import { onMounted, onUnmounted, ref } from 'vue';
import { useStateStore } from 'stores/useStateStore';
const stateStore = useStateStore();
onMounted(() => {
stateStore.toggleSubToolbar();
});
onUnmounted(() => {
stateStore.toggleSubToolbar();
});
</script>
<template>
<QToolbar class="bg-vn-dark justify-end">
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
</template>

View File

@ -0,0 +1,21 @@
<script setup>
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import { useI18n } from 'vue-i18n';
const $props = defineProps({
name: { type: String, default: null },
workerId: { type: Number, default: null },
defaultName: { type: Boolean, default: false },
});
const { t } = useI18n();
</script>
<template>
<slot name="link">
<span :class="{ link: $props.workerId }">
{{ $props.defaultName ? $props.name ?? t('globals.system') : $props.name }}
</span>
</slot>
<WorkerDescriptorProxy v-if="$props.workerId" :id="$props.workerId" />
</template>
<style scoped></style>

View File

@ -58,7 +58,7 @@ export function useArrayData(key, userOptions) {
} }
} }
async function fetch({ append = false }) { async function fetch({ append = false, updateRouter = true }) {
if (!store.url) return; if (!store.url) return;
cancelRequest(); cancelRequest();
@ -90,7 +90,7 @@ export function useArrayData(key, userOptions) {
Object.assign(params, userParams); Object.assign(params, userParams);
store.isLoading = true; store.isLoading = true;
store.currentFilter = params;
const response = await axios.get(store.url, { const response = await axios.get(store.url, {
signal: canceller.signal, signal: canceller.signal,
params, params,
@ -100,15 +100,12 @@ export function useArrayData(key, userOptions) {
hasMoreData.value = response.data.length === limit; hasMoreData.value = response.data.length === limit;
if (append === true) { if (append) {
if (!store.data) store.data = []; if (!store.data) store.data = [];
for (const row of response.data) store.data.push(row); for (const row of response.data) store.data.push(row);
} } else {
if (append === false) {
store.data = response.data; store.data = response.data;
updateRouter && updateStateParams();
updateStateParams();
} }
store.isLoading = false; store.isLoading = false;
@ -156,7 +153,9 @@ export function useArrayData(key, userOptions) {
delete store.userParams[param]; delete store.userParams[param];
delete params[param]; delete params[param];
if (store.filter?.where) { if (store.filter?.where) {
delete store.filter.where[Object.keys(exprBuilder ? exprBuilder(param) : param)[0]]; delete store.filter.where[
Object.keys(exprBuilder ? exprBuilder(param) : param)[0]
];
if (Object.keys(store.filter.where).length === 0) { if (Object.keys(store.filter.where).length === 0) {
delete store.filter.where; delete store.filter.where;
} }

View File

@ -16,7 +16,7 @@ export function useUserConfig() {
return data; return data;
} catch (error) { } catch (error) {
notify('globals.errors.userConfig', 'negative'); notify('errors.userConfig', 'negative');
console.error('Error fetching user config:', error); console.error('Error fetching user config:', error);
} }
} }

View File

@ -17,9 +17,9 @@ a {
// Removes chrome autofill background // Removes chrome autofill background
input:-webkit-autofill, input:-webkit-autofill,
select:-webkit-autofill { select:-webkit-autofill {
color: $input-text-color !important; color: var(--vn-text) ;
font-family: $typography-font-family; font-family: $typography-font-family;
-webkit-text-fill-color: $input-text-color !important; -webkit-text-fill-color: var(--vn-text) ;
-webkit-background-clip: text !important; -webkit-background-clip: text !important;
background-clip: text !important; background-clip: text !important;
} }

View File

@ -62,7 +62,8 @@ export default {
selectRows: 'Select all { numberRows } row(s)', selectRows: 'Select all { numberRows } row(s)',
allRows: 'All { numberRows } row(s)', allRows: 'All { numberRows } row(s)',
markAll: 'Mark all', markAll: 'Mark all',
noResults: 'No results' noResults: 'No results',
system: 'System',
}, },
errors: { errors: {
statusUnauthorized: 'Access denied', statusUnauthorized: 'Access denied',
@ -109,6 +110,7 @@ export default {
customer: { customer: {
pageTitles: { pageTitles: {
customers: 'Customers', customers: 'Customers',
create: 'Create',
list: 'List', list: 'List',
webPayments: 'Web Payments', webPayments: 'Web Payments',
extendedList: 'Extended list', extendedList: 'Extended list',
@ -944,6 +946,7 @@ export default {
components: { components: {
topbar: {}, topbar: {},
userPanel: { userPanel: {
copyToken: 'Token copied to clipboard',
settings: 'Settings', settings: 'Settings',
logOut: 'Log Out', logOut: 'Log Out',
}, },

View File

@ -62,7 +62,8 @@ export default {
selectRows: 'Seleccionar las { numberRows } filas(s)', selectRows: 'Seleccionar las { numberRows } filas(s)',
allRows: 'Todo { numberRows } filas(s)', allRows: 'Todo { numberRows } filas(s)',
markAll: 'Marcar todo', markAll: 'Marcar todo',
noResults: 'Sin resultados' noResults: 'Sin resultados',
system: 'Sistema',
}, },
errors: { errors: {
statusUnauthorized: 'Acceso denegado', statusUnauthorized: 'Acceso denegado',
@ -109,6 +110,7 @@ export default {
customer: { customer: {
pageTitles: { pageTitles: {
customers: 'Clientes', customers: 'Clientes',
create: 'Crear',
list: 'Listado', list: 'Listado',
webPayments: 'Pagos Web', webPayments: 'Pagos Web',
extendedList: 'Listado extendido', extendedList: 'Listado extendido',
@ -856,7 +858,7 @@ export default {
payDeadline: 'Plazo de pago', payDeadline: 'Plazo de pago',
payDay: 'Día de pago', payDay: 'Día de pago',
account: 'Cuenta', account: 'Cuenta',
fiscalData: 'Data fiscal', fiscalData: 'Datos fiscales',
sageTaxType: 'Tipo de impuesto Sage', sageTaxType: 'Tipo de impuesto Sage',
sageTransactionType: 'Tipo de transacción Sage', sageTransactionType: 'Tipo de transacción Sage',
sageWithholding: 'Retención sage', sageWithholding: 'Retención sage',
@ -943,6 +945,7 @@ export default {
components: { components: {
topbar: {}, topbar: {},
userPanel: { userPanel: {
copyToken: 'Token copiado al portapapeles',
settings: 'Configuración', settings: 'Configuración',
logOut: 'Cerrar sesión', logOut: 'Cerrar sesión',
}, },

View File

@ -1,6 +1,8 @@
import en from './en'; import en from './en';
import es from './es'; import es from './es';
export const localeEquivalence = {
'en':'en-GB'
}
export default { export default {
en: en, en: en,
es: es, es: es,

View File

@ -1,7 +1,6 @@
<script setup> <script setup>
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import Navbar from 'src/components/NavBar.vue'; import Navbar from 'src/components/NavBar.vue';
const quasar = useQuasar(); const quasar = useQuasar();
</script> </script>

View File

@ -26,6 +26,7 @@ const userLocale = computed({
} }
}, },
}); });
const darkMode = computed({ const darkMode = computed({
get() { get() {
return Dark.isActive; return Dark.isActive;

View File

@ -127,11 +127,14 @@ async function updateDestination(claimDestinationFk, row, options = {}) {
} }
async function regularizeClaim() { async function regularizeClaim() {
const query = `Claims/${claimId}/regularizeClaim`; await axios.post(`Claims/${claimId}/regularizeClaim`);
await axios.post(query);
if (claim.value.responsibility >= Math.ceil(DEFAULT_MAX_RESPONSABILITY) / 2) {
await claimRef.value.fetch(); await claimRef.value.fetch();
await arrayData.fetch({ append: false });
quasar.notify({
message: t('globals.dataSaved'),
type: 'positive',
});
if (claim.value.responsibility >= Math.ceil(DEFAULT_MAX_RESPONSABILITY) / 2) {
quasar quasar
.dialog({ .dialog({
component: VnConfirm, component: VnConfirm,
@ -141,29 +144,19 @@ async function regularizeClaim() {
}, },
}) })
.onOk(async () => await onUpdateGreugeAccept()); .onOk(async () => await onUpdateGreugeAccept());
} else {
quasar.notify({
message: t('globals.dataSaved'),
type: 'positive',
});
} }
await arrayData.fetch({ append: false });
}
async function updateGreuge(greuges) {
const { data } = await axios.post(`Greuges`, greuges);
quasar.notify({
message: t('globals.dataSaved'),
type: 'positive',
});
return data;
} }
async function onUpdateGreugeAccept() { async function onUpdateGreugeAccept() {
const greugeTypeFreightId = await getGreugeTypeId(); const greugeTypeFreightId = (
const freightPickUpPrice = await getGreugeConfig(); await axios.get(`GreugeTypes/findOne`, {
filter: { where: { code: 'freightPickUp' } },
})
).data.id;
const freightPickUpPrice = (await axios.get(`GreugeConfigs/findOne`)).data
.freightPickUpPrice;
await updateGreuge({ await axios.post(`Greuges`, {
clientFk: claim.value.clientFk, clientFk: claim.value.clientFk,
description: `${t('ClaimGreugeDescription')} ${claimId}`.toUpperCase(), description: `${t('ClaimGreugeDescription')} ${claimId}`.toUpperCase(),
amount: freightPickUpPrice, amount: freightPickUpPrice,
@ -176,19 +169,6 @@ async function onUpdateGreugeAccept() {
}); });
} }
async function getGreugeTypeId() {
const params = { filter: { where: { code: 'freightPickUp' } } };
const query = `GreugeTypes/findOne`;
const { data } = await axios.get(query, { params });
return data.id;
}
async function getGreugeConfig() {
const query = `GreugeConfigs/findOne`;
const { data } = await axios.get(query);
return data.freightPickUpPrice;
}
async function save(data) { async function save(data) {
const query = `Claims/${claimId}/updateClaimAction`; const query = `Claims/${claimId}/updateClaimAction`;
await axios.patch(query, data); await axios.patch(query, data);
@ -302,6 +282,8 @@ async function importToNewRefundTicket() {
selection="multiple" selection="multiple"
v-model:selected="selectedRows" v-model:selected="selectedRows"
:grid="$q.screen.lt.md" :grid="$q.screen.lt.md"
:pagination="{ rowsPerPage: 0 }"
:hide-bottom="true"
> >
<template #body-cell-ticket="{ value }"> <template #body-cell-ticket="{ value }">
<QTd align="center"> <QTd align="center">
@ -355,7 +337,23 @@ async function importToNewRefundTicket() {
</QItemSection> </QItemSection>
<QItemSection side> <QItemSection side>
<QItemLabel v-if="column.name === 'destination'"> <QItemLabel v-if="column.name === 'destination'">
{{ column.value.description }} <VnSelectFilter
v-model="props.row.claimDestinationFk"
:options="destinationTypes"
option-label="description"
option-value="id"
:autofocus="true"
dense
input-debounce="0"
hide-selected
@update:model-value="
(value) =>
updateDestination(
value,
props.row
)
"
/>
</QItemLabel> </QItemLabel>
<QItemLabel v-else> <QItemLabel v-else>
{{ column.value }} {{ column.value }}
@ -437,25 +435,6 @@ async function importToNewRefundTicket() {
</QCardActions> </QCardActions>
</QCard> </QCard>
</QDialog> </QDialog>
<!-- <QDialog v-model="dialogGreuge">
<QCardSection>
<QItem class="q-pa-sm">
<span class="q-pa-sm q-dialog__title text-white">
{{ t('dialogGreuge title') }}
</span>
<QBtn class="q-pa-sm" icon="close" flat round dense v-close-popup />
</QItem>
<QCardActions class="justify-end q-mr-sm">
<QBtn flat :label="t('globals.close')" color="primary" v-close-popup />
<QBtn
:label="t('globals.save')"
color="primary"
v-close-popup
@click="onUpdateGreugeAccept"
/>
</QCardActions>
</QCardSection>
</QDialog> -->
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.slider-container { .slider-container {

View File

@ -7,8 +7,8 @@ import { computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import ClaimDescriptor from './ClaimDescriptor.vue'; import ClaimDescriptor from './ClaimDescriptor.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { onMounted } from 'vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
@ -41,11 +41,7 @@ const entityId = computed(() => {
</QDrawer> </QDrawer>
<QPageContainer> <QPageContainer>
<QPage> <QPage>
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<div class="q-pa-md"><RouterView></RouterView></div> <div class="q-pa-md"><RouterView></RouterView></div>
</QPage> </QPage>
</QPageContainer> </QPageContainer>

View File

@ -4,14 +4,12 @@ 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 { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
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 CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.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 VnLv from 'src/components/ui/VnLv.vue';
import useCardDescription from 'src/composables/useCardDescription'; import useCardDescription from 'src/composables/useCardDescription';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -118,18 +116,18 @@ const setData = (entity) => {
:value="entity.worker.user.name" :value="entity.worker.user.name"
> >
<template #value> <template #value>
<span class="link"> <VnUserLink
{{ entity.worker.user.name }} :name="entity.worker.user.name"
<WorkerDescriptorProxy :id="entity.worker.user.id" /> :worker-id="entity.worker.id"
</span> />
</template> </template>
</VnLv> </VnLv>
<VnLv :label="t('claim.card.commercial')"> <VnLv :label="t('claim.card.commercial')">
<template #value> <template #value>
<span class="link"> <VnUserLink
{{ entity.client?.salesPersonUser?.name }} :name="entity.client?.salesPersonUser?.name"
<WorkerDescriptorProxy :id="entity.client?.salesPersonFk" /> :worker-id="entity.client?.salesPersonFk"
</span> />
</template> </template>
</VnLv> </VnLv>
<VnLv <VnLv

View File

@ -1,13 +1,11 @@
<script setup> <script setup>
import { ref, computed, onMounted } from 'vue'; import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import CrudModel from 'components/CrudModel.vue'; import CrudModel from 'components/CrudModel.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import VnSelectFilter from 'components/common/VnSelectFilter.vue'; import VnSelectFilter from 'components/common/VnSelectFilter.vue';
import { getUrl } from 'composables/getUrl';
import { tMobile } from 'composables/tMobile'; import { tMobile } from 'composables/tMobile';
import router from 'src/router';
const route = useRoute(); const route = useRoute();
@ -21,11 +19,6 @@ const claimRedeliveries = ref([]);
const workers = ref([]); const workers = ref([]);
const selected = ref([]); const selected = ref([]);
const saveButtonRef = ref(); const saveButtonRef = ref();
let salixUrl;
onMounted(async () => {
salixUrl = await getUrl(`claim/${route.params.id}`);
});
const developmentsFilter = { const developmentsFilter = {
fields: [ fields: [
@ -54,6 +47,7 @@ const columns = computed(() => [
optionValue: 'id', optionValue: 'id',
optionLabel: 'description', optionLabel: 'description',
tabIndex: 1, tabIndex: 1,
align: 'left',
}, },
{ {
name: 'claimResult', name: 'claimResult',
@ -66,6 +60,7 @@ const columns = computed(() => [
optionValue: 'id', optionValue: 'id',
optionLabel: 'description', optionLabel: 'description',
tabIndex: 2, tabIndex: 2,
align: 'left',
}, },
{ {
name: 'claimResponsible', name: 'claimResponsible',
@ -78,6 +73,7 @@ const columns = computed(() => [
optionValue: 'id', optionValue: 'id',
optionLabel: 'description', optionLabel: 'description',
tabIndex: 3, tabIndex: 3,
align: 'left',
}, },
{ {
name: 'worker', name: 'worker',
@ -89,6 +85,7 @@ const columns = computed(() => [
optionValue: 'id', optionValue: 'id',
optionLabel: 'nickname', optionLabel: 'nickname',
tabIndex: 4, tabIndex: 4,
align: 'left',
}, },
{ {
name: 'claimRedelivery', name: 'claimRedelivery',
@ -101,6 +98,7 @@ const columns = computed(() => [
optionValue: 'id', optionValue: 'id',
optionLabel: 'description', optionLabel: 'description',
tabIndex: 5, tabIndex: 5,
align: 'left',
}, },
]); ]);
</script> </script>
@ -158,6 +156,7 @@ const columns = computed(() => [
hide-pagination hide-pagination
v-model:selected="selected" v-model:selected="selected"
:grid="$q.screen.lt.md" :grid="$q.screen.lt.md"
table-header-class="text-left"
> >
<template #body-cell="{ row, col }"> <template #body-cell="{ row, col }">
<QTd <QTd
@ -165,7 +164,6 @@ const columns = computed(() => [
@keyup.ctrl.enter.stop="claimDevelopmentForm.saveChanges()" @keyup.ctrl.enter.stop="claimDevelopmentForm.saveChanges()"
> >
<VnSelectFilter <VnSelectFilter
:label="col.label"
v-model="row[col.model]" v-model="row[col.model]"
:options="col.options" :options="col.options"
:option-value="col.optionValue" :option-value="col.optionValue"

View File

@ -43,17 +43,20 @@ async function onFetchClaim(data) {
fetchMana(); fetchMana();
} }
const amount = ref(0); const amount = ref();
const amountClaimed = ref(0); const amountClaimed = ref();
async function onFetch(rows) { async function onFetch(rows) {
amount.value = 0;
amountClaimed.value = 0;
if (!rows || !rows.length) return; if (!rows || !rows.length) return;
amount.value = rows.reduce( amount.value = rows.reduce(
(acumulator, { sale }) => acumulator + sale.price * sale.quantity, (accumulator, { sale }) => accumulator + sale.price * sale.quantity,
0 0
); );
amountClaimed.value = rows.reduce( amountClaimed.value = rows.reduce(
(acumulator, line) => acumulator + line.sale.price * line.quantity, (accumulator, line) => accumulator + line.sale.price * line.quantity,
0 0
); );
} }
@ -189,6 +192,7 @@ function showImportDialog() {
save-url="ClaimBeginnings/crud" save-url="ClaimBeginnings/crud"
:filter="linesFilter" :filter="linesFilter"
@on-fetch="onFetch" @on-fetch="onFetch"
@save-changes="onFetch"
v-model:selected="selected" v-model:selected="selected"
:default-save="false" :default-save="false"
:default-reset="false" :default-reset="false"

View File

@ -8,6 +8,10 @@ const state = useState();
const user = state.getUser(); const user = state.getUser();
const id = route.params.id; const id = route.params.id;
const $props = defineProps({
addNote: { type: Boolean, default: true },
});
const claimFilter = { const claimFilter = {
where: { claimFk: id }, where: { claimFk: id },
fields: ['created', 'workerFk', 'text'], fields: ['created', 'workerFk', 'text'],
@ -27,7 +31,7 @@ const body = {
<template> <template>
<div class="column items-center"> <div class="column items-center">
<VnNotes <VnNotes
:add-note="true" :add-note="$props.addNote"
:id="id" :id="id"
url="claimObservations" url="claimObservations"
:filter="claimFilter" :filter="claimFilter"

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { onMounted, ref, computed } from 'vue'; import { onMounted, ref, computed, watch } 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';
@ -7,8 +7,9 @@ import CardSummary from 'components/ui/CardSummary.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import { getUrl } from 'src/composables/getUrl'; 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'; import VnLv from 'src/components/ui/VnLv.vue';
import ClaimNotes from 'src/pages/Claim/Card/ClaimNotes.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
@ -26,12 +27,26 @@ const entityId = computed(() => $props.id || route.params.id);
const claimUrl = ref(); const claimUrl = ref();
const salixUrl = ref(); const salixUrl = ref();
const claimDmsRef = ref();
const claimDmsFilter = ref({
include: [
{
relation: 'dms',
},
],
where: { claimFk: entityId.value },
});
onMounted(async () => { onMounted(async () => {
salixUrl.value = await getUrl(''); salixUrl.value = await getUrl('');
claimUrl.value = salixUrl.value + `claim/${entityId.value}/`; claimUrl.value = salixUrl.value + `claim/${entityId.value}/`;
}); });
watch(entityId, async (id) => {
claimDmsFilter.value.where = { claimFk: id };
await claimDmsRef.value.fetch();
});
const detailsColumns = ref([ const detailsColumns = ref([
{ {
name: 'item', name: 'item',
@ -118,7 +133,7 @@ const developmentColumns = ref([
{ {
name: 'worker', name: 'worker',
label: 'claim.summary.worker', label: 'claim.summary.worker',
field: (row) => row.worker.user.nickname, field: (row) => row.worker?.user.nickname,
sortable: true, sortable: true,
}, },
{ {
@ -131,18 +146,9 @@ const developmentColumns = ref([
const claimDms = ref([]); const claimDms = ref([]);
const multimediaDialog = ref(); const multimediaDialog = ref();
const multimediaSlide = ref(); const multimediaSlide = ref();
const claimDmsFilter = ref({
include: [
{
relation: 'dms',
},
],
where: { claimFk: entityId.value },
});
function setClaimDms(data) { function setClaimDms(data) {
if (!data) return; claimDms.value = [];
data.forEach((media) => { data.forEach((media) => {
claimDms.value.push({ claimDms.value.push({
isVideo: media.dms.contentType == 'video/mp4', isVideo: media.dms.contentType == 'video/mp4',
@ -165,6 +171,7 @@ function openDialog(dmsId) {
@on-fetch="(data) => setClaimDms(data)" @on-fetch="(data) => setClaimDms(data)"
limit="20" limit="20"
auto-load auto-load
ref="claimDmsRef"
/> />
<CardSummary ref="summary" :url="`Claims/${entityId}/getSummary`"> <CardSummary ref="summary" :url="`Claims/${entityId}/getSummary`">
<template #header="{ entity: { claim } }"> <template #header="{ entity: { claim } }">
@ -189,30 +196,30 @@ function openDialog(dmsId) {
</VnLv> </VnLv>
<VnLv :label="t('claim.summary.assignedTo')"> <VnLv :label="t('claim.summary.assignedTo')">
<template #value> <template #value>
<span class="link"> <VnUserLink
{{ claim.worker.user.nickname }} :name="claim.worker?.user?.nickname"
<WorkerDescriptorProxy :id="claim.workerFk" /> :worker-id="claim.workerFk"
</span> />
</template> </template>
</VnLv> </VnLv>
<VnLv :label="t('claim.summary.attendedBy')"> <VnLv :label="t('claim.summary.attendedBy')">
<template #value> <template #value>
<span class="link"> <VnUserLink
{{ claim.client.salesPersonUser.name }} :name="claim.client?.salesPersonUser?.name"
<WorkerDescriptorProxy :id="claim.client.salesPersonFk" /> :worker-id="claim.client?.salesPersonFk"
</span> />
</template> </template>
</VnLv> </VnLv>
</QCard> </QCard>
<QCard class="vn-one"> <QCard class="vn-max claimVnNotes">
<a class="header" :href="claimUrl + 'note/index'"> <a class="header" :href="`#/claim/${entityId}/notes`">
{{ t('claim.summary.notes') }} {{ t('claim.summary.notes') }}
<QIcon name="open_in_new" color="primary" /> <QIcon name="open_in_new" color="primary" />
</a> </a>
<!-- Use VnNotes and maybe VirtualScroll--> <ClaimNotes :add-note="false" style="height: 350px" order="created ASC" />
</QCard> </QCard>
<QCard class="vn-max" v-if="salesClaimed.length > 0"> <QCard class="vn-max" v-if="salesClaimed.length > 0">
<a class="header" :href="claimUrl + 'note/index'"> <a class="header" :href="`#/claim/${entityId}/lines`">
{{ t('claim.summary.details') }} {{ t('claim.summary.details') }}
<QIcon name="open_in_new" color="primary" /> <QIcon name="open_in_new" color="primary" />
</a> </a>
@ -306,20 +313,6 @@ function openDialog(dmsId) {
/> />
</div> </div>
</QCard> </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"
@ -362,6 +355,13 @@ function openDialog(dmsId) {
</template> </template>
</CardSummary> </CardSummary>
</template> </template>
<style lang="scss">
.claimVnNotes {
.q-card {
max-width: 100%;
}
}
</style>
<style lang="scss" scoped> <style lang="scss" scoped>
.q-dialog__inner--minimized > div { .q-dialog__inner--minimized > div {
max-width: 80%; max-width: 80%;

View File

@ -11,7 +11,7 @@ import VnLv from 'src/components/ui/VnLv.vue';
import CardList from 'src/components/ui/CardList.vue'; import CardList from 'src/components/ui/CardList.vue';
import ClaimSummaryDialog from './Card/ClaimSummaryDialog.vue'; import ClaimSummaryDialog from './Card/ClaimSummaryDialog.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const router = useRouter(); const router = useRouter();
@ -38,15 +38,6 @@ function viewSummary(id) {
}, },
}); });
} }
function viewDescriptor(id) {
quasar.dialog({
component: CustomerDescriptorProxy,
componentProps: {
id,
},
});
}
</script> </script>
<template> <template>
@ -84,7 +75,7 @@ function viewDescriptor(id) {
<VnPaginate <VnPaginate
data-key="ClaimList" data-key="ClaimList"
url="Claims/filter" url="Claims/filter"
order="id DESC" order="claimStateFk"
auto-load auto-load
> >
<template #body="{ rows }"> <template #body="{ rows }">
@ -106,10 +97,10 @@ function viewDescriptor(id) {
</VnLv> </VnLv>
<VnLv :label="t('claim.list.assignedTo')" @click.stop> <VnLv :label="t('claim.list.assignedTo')" @click.stop>
<template #value> <template #value>
<span class="link"> <VnUserLink
{{ row.workerName }} :name="row.workerName"
<WorkerDescriptorProxy :id="row.workerFk" /> :worker-id="row.workerFk"
</span> />
</template> </template>
</VnLv> </VnLv>
<VnLv <VnLv

View File

@ -5,6 +5,7 @@ import { useRoute } from 'vue-router';
import CustomerDescriptor from './CustomerDescriptor.vue'; import CustomerDescriptor from './CustomerDescriptor.vue';
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const route = useRoute(); const route = useRoute();
@ -28,11 +29,7 @@ const { t } = useI18n();
</QDrawer> </QDrawer>
<QPageContainer> <QPageContainer>
<QPage> <QPage>
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<div class="q-pa-md"><RouterView></RouterView></div> <div class="q-pa-md"><RouterView></RouterView></div>
</QPage> </QPage>
</QPageContainer> </QPageContainer>

View File

@ -4,9 +4,9 @@ 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 VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import useCardDescription from 'src/composables/useCardDescription'; import useCardDescription from 'src/composables/useCardDescription';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -44,10 +44,10 @@ const setData = (entity) => (data.value = useCardDescription(entity.name, entity
<template #body="{ entity }"> <template #body="{ entity }">
<VnLv v-if="entity.salesPersonUser" :label="t('customer.card.salesPerson')"> <VnLv v-if="entity.salesPersonUser" :label="t('customer.card.salesPerson')">
<template #value> <template #value>
<span class="link"> <VnUserLink
{{ entity.salesPersonUser.name }} :name="entity.salesPersonUser?.name"
<WorkerDescriptorProxy :id="entity.salesPersonFk" /> :worker-id="entity.salesPersonFk"
</span> />
</template> </template>
</VnLv> </VnLv>
<VnLv :label="t('customer.card.credit')" :value="toCurrency(entity.credit)" /> <VnLv :label="t('customer.card.credit')" :value="toCurrency(entity.credit)" />

View File

@ -1,3 +1,17 @@
<script setup>
import { useRoute } from 'vue-router';
import VnSms from 'src/components/ui/VnSms.vue';
const route = useRoute();
const id = route.params.id;
const where = {
clientFk: id,
ticketFk: null,
};
</script>
<template> <template>
<div class="flex justify-center">Sms</div> <div class="column items-center">
<VnSms url="clientSms" :where="where" />
</div>
</template> </template>

View File

@ -8,6 +8,7 @@ import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import VnSelectCreate from 'src/components/common/VnSelectCreate.vue'; import VnSelectCreate from 'src/components/common/VnSelectCreate.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const { t } = useI18n(); const { t } = useI18n();
@ -74,11 +75,7 @@ const onPostcodeCreated = async () => {
url="Countries" url="Countries"
/> />
<QPage> <QPage>
<QToolbar class="bg-vn-dark"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<FormModel <FormModel
:form-initial-data="newClientForm" :form-initial-data="newClientForm"
:observe-form-changes="false" :observe-form-changes="false"

View File

@ -9,6 +9,7 @@ import { useStateStore } from 'stores/useStateStore';
import CustomerNotificationsFilter from './CustomerNotificationsFilter.vue'; import CustomerNotificationsFilter from './CustomerNotificationsFilter.vue';
import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const { t } = useI18n(); const { t } = useI18n();
const stateStore = useStateStore(); const stateStore = useStateStore();
@ -102,11 +103,7 @@ const selectCustomerId = (id) => {
</QScrollArea> </QScrollArea>
</QDrawer> </QDrawer>
<QToolbar class="bg-vn-dark"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
<QTable <QTable

View File

@ -123,8 +123,7 @@ function stateColor(row) {
</QDrawer> </QDrawer>
<QPage class="column items-center q-pa-md customer-payments"> <QPage class="column items-center q-pa-md customer-payments">
<div class="card-list"> <div class="card-list">
<QToolbar class="q-pa-none"> <QToolbar class="q-pa-none justify-end">
<QToolbarTitle>{{ t('Web Payments') }}</QToolbarTitle>
<QBtn <QBtn
@click="arrayData.refresh()" @click="arrayData.refresh()"
:loading="isLoading" :loading="isLoading"
@ -133,7 +132,7 @@ function stateColor(row) {
class="q-mr-sm" class="q-mr-sm"
round round
dense dense
></QBtn> />
<QBtn @click="grid = !grid" icon="list" color="primary" round dense> <QBtn @click="grid = !grid" icon="list" color="primary" round dense>
<QTooltip>{{ t('Change view') }}</QTooltip> <QTooltip>{{ t('Change view') }}</QTooltip>
</QBtn> </QBtn>

View File

@ -2,6 +2,7 @@
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import DepartmentDescriptor from 'pages/Department/Card/DepartmentDescriptor.vue'; import DepartmentDescriptor from 'pages/Department/Card/DepartmentDescriptor.vue';
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
</script> </script>
@ -15,11 +16,8 @@ const stateStore = useStateStore();
</QDrawer> </QDrawer>
<QPageContainer> <QPageContainer>
<QPage> <QPage>
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<div class="q-pa-md column items-center"> <div class="q-pa-md column items-center">
<RouterView></RouterView> <RouterView></RouterView>
</div> </div>

View File

@ -1,6 +1,7 @@
<script setup> <script setup>
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
</script> </script>
@ -15,11 +16,8 @@ const stateStore = useStateStore();
</QDrawer> </QDrawer>
<QPageContainer> <QPageContainer>
<QPage> <QPage>
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<div class="q-pa-md"><RouterView></RouterView></div> <div class="q-pa-md"><RouterView></RouterView></div>
</QPage> </QPage>
</QPageContainer> </QPageContainer>

View File

@ -7,6 +7,7 @@ import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { toDate } from 'src/filters'; import { toDate } from 'src/filters';
@ -51,11 +52,7 @@ const companiesOptions = ref([]);
<!-- Agregar searchbar de entries --> <!-- Agregar searchbar de entries -->
<QPage> <QPage>
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<FormModel url-create="Entries" model="entry" :form-initial-data="newEntryForm"> <FormModel url-create="Entries" model="entry" :form-initial-data="newEntryForm">
<template #form="{ data, validate }"> <template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">

View File

@ -23,6 +23,7 @@ const userConfig = ref(null);
const suppliers = ref([]); const suppliers = ref([]);
const suppliersRef = ref(); const suppliersRef = ref();
const suppliersRefFilter = ref({ fields: ['id', 'nickname'], limit: 30 });
const currencies = ref([]); const currencies = ref([]);
const currenciesRef = ref(); const currenciesRef = ref();
const companies = ref([]); const companies = ref([]);
@ -130,13 +131,24 @@ async function upsert() {
}); });
} }
} }
function supplierRefFilter(val) {
let where = { limit: 30 };
let params = {};
let key = 'nickname';
if (new RegExp(/\d/g).test(val)) {
key = 'id';
}
params = { [key]: { like: `%${val}%` } };
where = Object.assign(where, params);
suppliersRef.value.fetch({ where });
}
</script> </script>
<template> <template>
<FetchData <FetchData
ref="suppliersRef" ref="suppliersRef"
url="Suppliers" url="Suppliers"
:filter="{ fields: ['id', 'nickname'] }"
limit="30"
@on-fetch="(data) => (suppliers = data)" @on-fetch="(data) => (suppliers = data)"
/> />
<FetchData <FetchData
@ -145,6 +157,7 @@ async function upsert() {
:filter="{ fields: ['id', 'code'] }" :filter="{ fields: ['id', 'code'] }"
order="code" order="code"
@on-fetch="(data) => (currencies = data)" @on-fetch="(data) => (currencies = data)"
auto-load
/> />
<FetchData <FetchData
ref="companiesRef" ref="companiesRef"
@ -152,6 +165,7 @@ async function upsert() {
:filter="{ fields: ['id', 'code'] }" :filter="{ fields: ['id', 'code'] }"
order="code" order="code"
@on-fetch="(data) => (companies = data)" @on-fetch="(data) => (companies = data)"
auto-load
/> />
<FetchData <FetchData
ref="dmsTypesRef" ref="dmsTypesRef"
@ -159,6 +173,7 @@ async function upsert() {
:filter="{ fields: ['id', 'name'] }" :filter="{ fields: ['id', 'name'] }"
order="name" order="name"
@on-fetch="(data) => (dmsTypes = data)" @on-fetch="(data) => (dmsTypes = data)"
auto-load
/> />
<FetchData <FetchData
ref="warehousesRef" ref="warehousesRef"
@ -166,11 +181,13 @@ async function upsert() {
:filter="{ fields: ['id', 'name'] }" :filter="{ fields: ['id', 'name'] }"
order="name" order="name"
@on-fetch="(data) => (warehouses = data)" @on-fetch="(data) => (warehouses = data)"
auto-load
/> />
<FetchData <FetchData
ref="allowTypesRef" ref="allowTypesRef"
url="DmsContainers/allowedContentTypes" url="DmsContainers/allowedContentTypes"
@on-fetch="(data) => (allowedContentTypes = data)" @on-fetch="(data) => (allowedContentTypes = data)"
auto-load
/> />
<FetchData <FetchData
url="UserConfigs/getUserConfig" url="UserConfigs/getUserConfig"
@ -189,7 +206,8 @@ async function upsert() {
option-value="id" option-value="id"
option-label="nickname" option-label="nickname"
:input-debounce="100" :input-debounce="100"
@input-value="suppliersRef.fetch()" @input-value="supplierRefFilter"
:default-filter="false"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">
@ -406,7 +424,6 @@ async function upsert() {
:options="currencies" :options="currencies"
option-value="id" option-value="id"
option-label="code" option-label="code"
@input-value="currenciesRef.fetch()"
/> />
</div> </div>
<div class="col"> <div class="col">
@ -417,7 +434,6 @@ async function upsert() {
:options="companies" :options="companies"
option-value="id" option-value="id"
option-label="code" option-label="code"
@input-value="companiesRef.fetch()"
/> />
</div> </div>
</div> </div>
@ -459,7 +475,6 @@ async function upsert() {
:options="companies" :options="companies"
option-value="id" option-value="id"
option-label="code" option-label="code"
@input-value="companiesRef.fetch()"
:rules="[requiredFieldRule]" :rules="[requiredFieldRule]"
/> />
</QItem> </QItem>
@ -471,7 +486,6 @@ async function upsert() {
:options="warehouses" :options="warehouses"
option-value="id" option-value="id"
option-label="name" option-label="name"
@input-value="warehousesRef.fetch()"
:rules="[requiredFieldRule]" :rules="[requiredFieldRule]"
/> />
<VnSelectFilter <VnSelectFilter
@ -481,7 +495,6 @@ async function upsert() {
:options="dmsTypes" :options="dmsTypes"
option-value="id" option-value="id"
option-label="name" option-label="name"
@input-value="dmsTypesRef.fetch()"
:rules="[requiredFieldRule]" :rules="[requiredFieldRule]"
/> />
</QItem> </QItem>
@ -571,7 +584,6 @@ async function upsert() {
:options="companies" :options="companies"
option-value="id" option-value="id"
option-label="code" option-label="code"
@input-value="companiesRef.fetch()"
:rules="[requiredFieldRule]" :rules="[requiredFieldRule]"
/> />
</QItem> </QItem>
@ -583,7 +595,6 @@ async function upsert() {
:options="warehouses" :options="warehouses"
option-value="id" option-value="id"
option-label="name" option-label="name"
@input-value="warehousesRef.fetch()"
:rules="[requiredFieldRule]" :rules="[requiredFieldRule]"
/> />
<VnSelectFilter <VnSelectFilter
@ -593,7 +604,6 @@ async function upsert() {
:options="dmsTypes" :options="dmsTypes"
option-value="id" option-value="id"
option-label="name" option-label="name"
@input-value="dmsTypesRef.fetch()"
:rules="[requiredFieldRule]" :rules="[requiredFieldRule]"
/> />
</QItem> </QItem>

View File

@ -4,6 +4,7 @@ import { useStateStore } from 'stores/useStateStore';
import InvoiceInDescriptor from './InvoiceInDescriptor.vue'; import InvoiceInDescriptor from './InvoiceInDescriptor.vue';
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import { onMounted, watch } from 'vue'; import { onMounted, watch } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
@ -74,11 +75,7 @@ onMounted(async () => {
</QDrawer> </QDrawer>
<QPageContainer> <QPageContainer>
<QPage> <QPage>
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<div class="q-pa-md"><RouterView></RouterView></div> <div class="q-pa-md"><RouterView></RouterView></div>
</QPage> </QPage>
</QPageContainer> </QPageContainer>

View File

@ -0,0 +1,6 @@
<script setup>
import VnLog from 'src/components/common/VnLog.vue';
</script>
<template>
<VnLog model="InvoiceIn" />
</template>

View File

@ -203,7 +203,7 @@ function getLink(param) {
@on-fetch="(data) => setData(data)" @on-fetch="(data) => setData(data)"
> >
<template #header="{ entity: invoiceIn }"> <template #header="{ entity: invoiceIn }">
<div>{{ invoiceIn.id }} - {{ invoiceIn.supplier.name }}</div> <div>{{ invoiceIn.id }} - {{ invoiceIn.supplier?.name }}</div>
</template> </template>
<template #body="{ entity: invoiceIn }"> <template #body="{ entity: invoiceIn }">
<!--Basic Data--> <!--Basic Data-->
@ -216,7 +216,7 @@ function getLink(param) {
</QCardSection> </QCardSection>
<VnLv <VnLv
:label="t('invoiceIn.summary.supplier')" :label="t('invoiceIn.summary.supplier')"
:value="invoiceIn.supplier.name" :value="invoiceIn.supplier?.name"
/> />
<VnLv <VnLv
:label="t('invoiceIn.summary.supplierRef')" :label="t('invoiceIn.summary.supplierRef')"
@ -224,7 +224,7 @@ function getLink(param) {
/> />
<VnLv <VnLv
:label="t('invoiceIn.summary.currency')" :label="t('invoiceIn.summary.currency')"
:value="invoiceIn.currency.code" :value="invoiceIn.currency?.code"
/> />
<VnLv <VnLv
:label="t('invoiceIn.summary.docNumber')" :label="t('invoiceIn.summary.docNumber')"
@ -265,7 +265,7 @@ function getLink(param) {
</QCardSection> </QCardSection>
<VnLv <VnLv
:label="t('invoiceIn.summary.sage')" :label="t('invoiceIn.summary.sage')"
:value="invoiceIn.sageWithholding.withholding" :value="invoiceIn.sageWithholding?.withholding"
/> />
<VnLv <VnLv
:label="t('invoiceIn.summary.vat')" :label="t('invoiceIn.summary.vat')"
@ -273,7 +273,7 @@ function getLink(param) {
/> />
<VnLv <VnLv
:label="t('invoiceIn.summary.company')" :label="t('invoiceIn.summary.company')"
:value="invoiceIn.company.code" :value="invoiceIn.company?.code"
/> />
<VnLv <VnLv
:label="t('invoiceIn.summary.booked')" :label="t('invoiceIn.summary.booked')"

View File

@ -84,9 +84,9 @@ function viewSummary(id) {
:key="row.id" :key="row.id"
:title="row.supplierRef" :title="row.supplierRef"
@click="navigate(row.id)" @click="navigate(row.id)"
:id="row.id"
> >
<template #list-items> <template #list-items>
<VnLv label="ID" :value="row.id" />
<VnLv <VnLv
:label="t('invoiceIn.list.supplierRef')" :label="t('invoiceIn.list.supplierRef')"
:value="row.supplierRef" :value="row.supplierRef"
@ -112,42 +112,34 @@ function viewSummary(id) {
:label="t('invoiceIn.list.amount')" :label="t('invoiceIn.list.amount')"
:value="toCurrency(row.amount)" :value="toCurrency(row.amount)"
/> />
<VnLv :label="t('invoiceIn.list.isBooked')"> <VnLv
<template #value> :label="t('invoiceIn.list.isBooked')"
<QCheckbox :value="!!row.isBooked"
class="no-pointer-events"
v-model="row.isBooked"
size="xs"
:true-value="1"
:false-value="0"
/> />
</template> </template>
</VnLv>
</template>
<template #actions> <template #actions>
<QBtn <QBtn
flat :label="t('components.smartCard.openCard')"
icon="arrow_circle_right"
@click.stop="navigate(row.id)" @click.stop="navigate(row.id)"
> class="bg-vn-dark"
<QTooltip> outline
{{ t('components.smartCard.openCard') }} type="reset"
</QTooltip> />
</QBtn>
<QBtn flat icon="preview" @click.stop="viewSummary(row.id)">
<QTooltip>
{{ t('components.smartCard.openSummary') }}
</QTooltip>
</QBtn>
<QBtn <QBtn
flat :label="t('components.smartCard.openSummary')"
icon="cloud_download" @click.stop="viewSummary(row.id)"
color="primary"
type="submit"
class="q-mt-sm"
/>
<QBtn
:label="t('Download')"
class="q-mt-sm"
@click.stop="downloadFile(row.dmsFk)" @click.stop="downloadFile(row.dmsFk)"
> type="submit"
<QTooltip> color="primary"
{{ t('components.smartCard.downloadFile') }} />
</QTooltip>
</QBtn>
</template> </template>
</CardList> </CardList>
</template> </template>
@ -176,4 +168,5 @@ function viewSummary(id) {
es: es:
Search invoice: Buscar factura emitida Search invoice: Buscar factura emitida
You can search by invoice reference: Puedes buscar por referencia de la factura You can search by invoice reference: Puedes buscar por referencia de la factura
Download: Descargar
</i18n> </i18n>

View File

@ -4,6 +4,7 @@ import { useStateStore } from 'stores/useStateStore';
import InvoiceOutDescriptor from './InvoiceOutDescriptor.vue'; import InvoiceOutDescriptor from './InvoiceOutDescriptor.vue';
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
@ -26,11 +27,7 @@ const { t } = useI18n();
</QDrawer> </QDrawer>
<QPageContainer> <QPageContainer>
<QPage> <QPage>
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<div class="q-pa-md"><RouterView></RouterView></div> <div class="q-pa-md"><RouterView></RouterView></div>
</QPage> </QPage>
</QPageContainer> </QPageContainer>

View File

@ -4,13 +4,14 @@ import { useI18n } from 'vue-i18n';
import { QCheckbox, QBtn } from 'quasar'; import { QCheckbox, QBtn } from 'quasar';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import InvoiceOutNegativeFilter from './InvoiceOutNegativeBasesFilter.vue'; import InvoiceOutNegativeFilter from './InvoiceOutNegativeBasesFilter.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { toCurrency } from 'src/filters'; import { toCurrency } from 'src/filters';
import { useInvoiceOutGlobalStore } from 'src/stores/invoiceOutGlobal.js'; import { useInvoiceOutGlobalStore } from 'src/stores/invoiceOutGlobal.js';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const invoiceOutGlobalStore = useInvoiceOutGlobalStore(); const invoiceOutGlobalStore = useInvoiceOutGlobalStore();
const stateStore = useStateStore(); const stateStore = useStateStore();
@ -187,9 +188,21 @@ const columns = computed(() => [
]); ]);
const downloadCSV = async () => { const downloadCSV = async () => {
const params = {}; // filter.value;
const filterParams = {
limit: 20,
where: {
and: [],
},
};
for (const param in params) {
if (params[param]) filterParams.where.and.push({ [param]: params[param] });
}
await invoiceOutGlobalStore.getNegativeBasesCsv( await invoiceOutGlobalStore.getNegativeBasesCsv(
arrayData.value.store.userParams.from, arrayData.value.store.userParams.from,
arrayData.value.store.userParams.to arrayData.value.store.userParams.to,
params
); );
}; };
@ -213,11 +226,7 @@ const selectWorkerId = (id) => {
<InvoiceOutNegativeFilter data-key="InvoiceOutNegative" /> <InvoiceOutNegativeFilter data-key="InvoiceOutNegative" />
</QScrollArea> </QScrollArea>
</QDrawer> </QDrawer>
<QToolbar class="bg-vn-dark"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
<QTable <QTable
:columns="columns" :columns="columns"
@ -243,8 +252,14 @@ const selectWorkerId = (id) => {
" "
>{{ props.value }} >{{ props.value }}
</template> </template>
<CustomerDescriptorProxy :id="selectedCustomerId" /> <CustomerDescriptorProxy
<WorkerDescriptorProxy :id="selectedWorkerId" /> v-if="props.col.name === 'clientId'"
:id="selectedCustomerId"
/>
<VnUserLink
v-if="props.col.name === 'comercial'"
:worker-id="selectedWorkerId"
/>
</component> </component>
</QTd> </QTd>
</template> </template>

View File

@ -1,12 +0,0 @@
<script setup>
import OrderForm from 'pages/Order/Card/OrderForm.vue';
</script>
<template>
<QToolbar>
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<OrderForm />
</template>
<style lang="scss" scoped></style>

View File

@ -2,6 +2,7 @@
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import OrderDescriptor from 'pages/Order/Card/OrderDescriptor.vue'; import OrderDescriptor from 'pages/Order/Card/OrderDescriptor.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
</script> </script>
@ -15,9 +16,8 @@ const stateStore = useStateStore();
</QDrawer> </QDrawer>
<QPageContainer> <QPageContainer>
<QPage> <QPage>
<div class="q-pa-md"> <VnSubToolbar />
<RouterView></RouterView> <RouterView></RouterView>
</div>
</QPage> </QPage>
</QPageContainer> </QPageContainer>
</template> </template>

View File

@ -1,11 +1,14 @@
<script setup> <script setup>
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import axios from 'axios';
import VnInput from 'components/common/VnInput.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue'; import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnSelectFilter from 'components/common/VnSelectFilter.vue'; import VnSelectFilter from 'components/common/VnSelectFilter.vue';
import axios from 'axios'; import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
import { useRoute } from 'vue-router';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
@ -14,6 +17,10 @@ const props = defineProps({
type: String, type: String,
required: true, required: true,
}, },
tags: {
type: Array,
required: true,
},
}); });
const categoryList = ref(null); const categoryList = ref(null);
@ -26,6 +33,20 @@ const resetCategory = () => {
typeList.value = null; typeList.value = null;
}; };
const selectedOrder = ref(null);
const orderList = [
{ way: 'ASC', name: 'Ascendant' },
{ way: 'DESC', name: 'Descendant' },
];
const selectedOrderField = ref(null);
const OrderFields = [
{ field: 'relevancy DESC, name', name: 'Relevancy', priority: 999 },
{ field: 'showOrder, price', name: 'Color and price', priority: 999 },
{ field: 'name', name: 'Name', priority: 999 },
{ field: 'price', name: 'Price', priority: 999 },
];
const clearFilter = (key) => { const clearFilter = (key) => {
if (key === 'categoryFk') { if (key === 'categoryFk') {
resetCategory(); resetCategory();
@ -59,6 +80,11 @@ const onFilterInit = async ({ params }) => {
await loadTypes(params.categoryFk); await loadTypes(params.categoryFk);
selectedCategoryFk.value = params.categoryFk; selectedCategoryFk.value = params.categoryFk;
} }
if (params.orderBy) {
orderByParam.value = JSON.parse(params.orderBy);
selectedOrder.value = orderByParam.value?.way;
selectedOrderField.value = orderByParam.value?.field;
}
}; };
const selectedCategory = computed(() => const selectedCategory = computed(() =>
@ -81,6 +107,60 @@ function exprBuilder(param, value) {
} }
} }
const selectedTag = ref(null);
const tagValues = ref([{}]);
const tagOptions = ref(null);
const isButtonDisabled = computed(
() => !selectedTag.value || tagValues.value.some((item) => !item.value)
);
const applyTagFilter = (params, search) => {
if (!tagValues.value?.length) {
params.tagGroups = null;
search();
return;
}
if (!params.tagGroups) {
params.tagGroups = [];
}
params.tagGroups.push(
JSON.stringify({
values: tagValues.value,
tagSelection: {
...selectedTag.value,
orgShowField: selectedTag.value.name,
},
tagFk: selectedTag.value.tagFk,
})
);
search();
selectedTag.value = null;
tagValues.value = [{}];
};
const removeTagChip = (selection, params, search) => {
if (params.tagGroups) {
params.tagGroups = (params.tagGroups || []).filter(
(value) => value !== selection
);
}
search();
};
const orderByParam = ref(null);
const onOrderFieldChange = (value, params, search) => {
const orderBy = Object.assign({}, orderByParam.value, { field: value.field });
params.orderBy = JSON.stringify(orderBy);
search();
};
const onOrderChange = (value, params, search) => {
const orderBy = Object.assign({}, orderByParam.value, { way: value.way });
params.orderBy = JSON.stringify(orderBy);
search();
};
const setCategoryList = (data) => { const setCategoryList = (data) => {
categoryList.value = (data || []) categoryList.value = (data || [])
.filter((category) => category.display) .filter((category) => category.display)
@ -103,6 +183,7 @@ const getCategoryClass = (category, params) => {
:data-key="props.dataKey" :data-key="props.dataKey"
:hidden-tags="['orderFk', 'orderBy']" :hidden-tags="['orderFk', 'orderBy']"
:expr-builder="exprBuilder" :expr-builder="exprBuilder"
:custom-tags="['tagGroups']"
@init="onFilterInit" @init="onFilterInit"
@remove="clearFilter" @remove="clearFilter"
> >
@ -118,8 +199,27 @@ const getCategoryClass = (category, params) => {
<span>{{ formatFn(tag.value) }}</span> <span>{{ formatFn(tag.value) }}</span>
</div> </div>
</template> </template>
<template #customTags="{ tags: customTags, params, searchFn }">
<template v-for="tag in customTags" :key="tag.label">
<template v-if="tag.label === 'tagGroups'">
<VnFilterPanelChip
v-for="chip in tag.value"
:key="chip"
removable
@remove="removeTagChip(chip, params, searchFn)"
>
<strong> {{ JSON.parse(chip).tagSelection?.name }}: </strong>
<span>{{
(JSON.parse(chip).values || [])
.map((item) => item.value)
.join(' | ')
}}</span>
</VnFilterPanelChip>
</template>
</template>
</template>
<template #body="{ params, searchFn }"> <template #body="{ params, searchFn }">
<QList dense> <QList dense style="max-width: 256px">
<QItem class="category-filter q-mt-md"> <QItem class="category-filter q-mt-md">
<div <div
v-for="category in categoryList" v-for="category in categoryList"
@ -137,7 +237,7 @@ const getCategoryClass = (category, params) => {
</QIcon> </QIcon>
</div> </div>
</QItem> </QItem>
<QItem class="q-mt-md"> <QItem class="q-my-md">
<QItemSection> <QItemSection>
<VnSelectFilter <VnSelectFilter
:label="t('params.type')" :label="t('params.type')"
@ -171,6 +271,130 @@ const getCategoryClass = (category, params) => {
</VnSelectFilter> </VnSelectFilter>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QSeparator />
<QItem class="q-my-md">
<QItemSection>
<VnSelectFilter
:label="t('params.order')"
v-model="selectedOrder"
:options="orderList || []"
option-value="way"
option-label="name"
dense
outlined
rounded
:emit-value="false"
use-input
:is-clearable="false"
@update:model-value="
(value) => onOrderChange(value, params, searchFn)
"
/>
</QItemSection>
</QItem>
<QItem class="q-mb-md">
<QItemSection>
<VnSelectFilter
:label="t('params.order')"
v-model="selectedOrderField"
:options="OrderFields || []"
option-value="field"
option-label="name"
dense
outlined
rounded
:emit-value="false"
use-input
:is-clearable="false"
@update:model-value="
(value) => onOrderFieldChange(value, params, searchFn)
"
/>
</QItemSection>
</QItem>
<QSeparator />
<QItem class="q-mt-md">
<QItemSection>
<VnSelectFilter
:label="t('params.tag')"
v-model="selectedTag"
:options="props.tags || []"
option-value="id"
option-label="name"
dense
outlined
rounded
:emit-value="false"
use-input
/>
</QItemSection>
</QItem>
<QItem
v-for="(value, index) in tagValues"
:key="value"
class="q-mt-md filter-value"
>
<VnInput
v-if="selectedTag?.isFree"
v-model="value.value"
:label="t('params.value')"
is-outlined
class="filter-input"
/>
<VnSelectFilter
v-else
:label="t('params.value')"
v-model="value.value"
:options="tagOptions || []"
option-value="value"
option-label="value"
dense
outlined
rounded
emit-value
use-input
:disable="!selectedTag"
class="filter-input"
/>
<FetchData
v-if="selectedTag && !selectedTag.isFree"
:url="`Tags/${selectedTag?.id}/filterValue`"
limit="30"
auto-load
@on-fetch="(data) => (tagOptions = data)"
/>
<QIcon
name="delete"
class="filter-icon"
@click="(tagValues || []).splice(index, 1)"
/>
</QItem>
<QItem class="q-mt-lg">
<QIcon
name="add_circle"
class="filter-icon"
@click="tagValues.push({})"
/>
</QItem>
<QItem>
<QItemSection class="q-py-sm">
<QBtn
:label="t('Search')"
class="full-width"
color="primary"
dense
icon="search"
rounded
type="button"
unelevated
:disable="isButtonDisabled"
@click.stop="applyTagFilter(params, searchFn)"
/>
</QItemSection>
</QItem>
<QSeparator />
</QList> </QList>
</template> </template>
</VnFilterPanel> </VnFilterPanel>
@ -198,12 +422,29 @@ const getCategoryClass = (category, params) => {
.category-icon { .category-icon {
border-radius: 50%; border-radius: 50%;
background-color: var(--vn-label); background-color: var(--vn-light-gray);
font-size: 2.6rem; font-size: 2.6rem;
padding: 8px; padding: 8px;
cursor: pointer; cursor: pointer;
} }
} }
.filter-icon {
font-size: 24px;
color: $primary;
padding: 0 4px;
cursor: pointer;
}
.filter-input {
flex-shrink: 1;
min-width: 0;
}
.filter-value {
display: flex;
align-items: center;
}
</style> </style>
<i18n> <i18n>
@ -211,10 +452,16 @@ en:
params: params:
type: Type type: Type
orderBy: Order By orderBy: Order By
tag: Tag
value: Value
order: Order
es: es:
params: params:
type: Tipo type: Tipo
orderBy: Ordenar por orderBy: Ordenar por
tag: Etiqueta
value: Valor
order: Orden
Plant: Planta Plant: Planta
Flower: Flor Flower: Flor
Handmade: Confección Handmade: Confección

View File

@ -24,7 +24,7 @@ const dialog = ref(null);
<template> <template>
<div class="container order-catalog-item overflow-hidden"> <div class="container order-catalog-item overflow-hidden">
<div class="card shadow-6 bg-dark"> <QCard class="card shadow-6">
<div class="img-wrapper"> <div class="img-wrapper">
<QImg <QImg
:src="`/api/Images/catalog/200x200/${item.id}/download?access_token=${token}`" :src="`/api/Images/catalog/200x200/${item.id}/download?access_token=${token}`"
@ -76,7 +76,7 @@ const dialog = ref(null);
</p> </p>
</div> </div>
</div> </div>
</div> </QCard>
</div> </div>
</template> </template>

View File

@ -51,13 +51,13 @@ async function remove() {
<i18n> <i18n>
en: en:
deleteOrder: Delete order, deleteOrder: Delete order
confirmDeletion: Confirm deletion, confirmDeletion: Confirm deletion
confirmDeletionMessage: Are you sure you want to delete this order? confirmDeletionMessage: Are you sure you want to delete this order?
es: es:
deleteOrder: Eliminar pedido, deleteOrder: Eliminar pedido
confirmDeletion: Confirmar eliminación, confirmDeletion: Confirmar eliminación
confirmDeletionMessage: Seguro que quieres eliminar este pedido? confirmDeletionMessage: Seguro que quieres eliminar este pedido?
</i18n> </i18n>

View File

@ -9,6 +9,7 @@ import FetchData from 'components/FetchData.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnSelectFilter from 'components/common/VnSelectFilter.vue'; import VnSelectFilter from 'components/common/VnSelectFilter.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
@ -65,8 +66,8 @@ const fetchAgencyList = async (landed, addressFk) => {
}; };
const fetchOrderDetails = (order) => { const fetchOrderDetails = (order) => {
fetchAddressList(order?.addressFk) fetchAddressList(order?.addressFk);
fetchAgencyList(order?.landed, order?.addressFk) fetchAgencyList(order?.landed, order?.addressFk);
}; };
const orderMapper = (order) => { const orderMapper = (order) => {
@ -105,17 +106,14 @@ const orderFilter = {
</script> </script>
<template> <template>
<QToolbar>
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<FetchData <FetchData
url="Clients" url="Clients"
@on-fetch="(data) => (clientList = data)" @on-fetch="(data) => (clientList = data)"
:filter="{ fields: ['id', 'name', 'defaultAddressFk'] }" :filter="{ fields: ['id', 'name', 'defaultAddressFk'] }"
auto-load auto-load
/> />
<VnSubToolbar v-if="isNew" />
<div class="q-pa-md">
<FormModel <FormModel
:url="!isNew ? `Orders/${route.params.id}` : null" :url="!isNew ? `Orders/${route.params.id}` : null"
:url-create="isNew ? 'Orders/new' : null" :url-create="isNew ? 'Orders/new' : null"
@ -206,4 +204,5 @@ const orderFilter = {
</VnRow> </VnRow>
</template> </template>
</FormModel> </FormModel>
</div>
</template> </template>

View File

@ -56,6 +56,8 @@ const detailsColumns = ref([
<Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()"> <Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()">
<OrderSearchbar /> <OrderSearchbar />
</Teleport> </Teleport>
<div class="q-pa-md">
<CardSummary ref="summary" :url="`Orders/${entityId}/summary`"> <CardSummary ref="summary" :url="`Orders/${entityId}/summary`">
<template #header="{ entity }"> <template #header="{ entity }">
{{ t('order.summary.basket') }} #{{ entity?.id }} - {{ t('order.summary.basket') }} #{{ entity?.id }} -
@ -130,7 +132,9 @@ const detailsColumns = ref([
<span class="text-h6">{{ t('order.summary.subtotal') }}</span> <span class="text-h6">{{ t('order.summary.subtotal') }}</span>
</template> </template>
<template #value> <template #value>
<span class="text-h6">{{ toCurrency(entity?.subTotal) }}</span> <span class="text-h6">{{
toCurrency(entity?.subTotal)
}}</span>
</template> </template>
</VnLv> </VnLv>
<VnLv> <VnLv>
@ -177,11 +181,17 @@ const detailsColumns = ref([
<QTd key="description" :props="props" class="description"> <QTd key="description" :props="props" class="description">
<div class="name"> <div class="name">
<span>{{ props.row.item.name }}</span> <span>{{ props.row.item.name }}</span>
<span v-if="props.row.item.subName" class="subName"> <span
v-if="props.row.item.subName"
class="subName"
>
{{ props.row.item.subName }} {{ props.row.item.subName }}
</span> </span>
</div> </div>
<fetched-tags :item="props.row.item" :max-length="5" /> <fetched-tags
:item="props.row.item"
:max-length="5"
/>
</QTd> </QTd>
<QTd key="quantity" :props="props"> <QTd key="quantity" :props="props">
{{ props.row.quantity }} {{ props.row.quantity }}
@ -190,7 +200,9 @@ const detailsColumns = ref([
{{ props.row.price }} {{ props.row.price }}
</QTd> </QTd>
<QTd key="amount" :props="props"> <QTd key="amount" :props="props">
{{ toCurrency(props.row?.quantity * props.row?.price) }} {{
toCurrency(props.row?.quantity * props.row?.price)
}}
</QTd> </QTd>
</QTr> </QTr>
</template> </template>
@ -198,6 +210,7 @@ const detailsColumns = ref([
</QCard> </QCard>
</template> </template>
</CardSummary> </CardSummary>
</div>
</template> </template>
<style lang="scss"> <style lang="scss">
.cardSummary .summaryBody .vn-label-value.order-summary-address { .cardSummary .summaryBody .vn-label-value.order-summary-address {

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { onMounted, onUnmounted } from 'vue'; import {onMounted, onUnmounted, ref} from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnPaginate from 'components/ui/VnPaginate.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
@ -20,6 +20,22 @@ const catalogParams = {
orderBy: JSON.stringify({ field: 'relevancy DESC, name', way: 'ASC', isTag: false }), orderBy: JSON.stringify({ field: 'relevancy DESC, name', way: 'ASC', isTag: false }),
}; };
const tags = ref([])
function extractTags(items) {
const resultTags = [];
(items || []).forEach((item) => {
(item.tags || []).forEach((tag) => {
const index = resultTags.findIndex((item) => item.tagFk === tag.tagFk);
if (index === -1) {
resultTags.push({ ...tag, priority: 1 });
} else {
resultTags[index].priority += 1;
}
});
});
tags.value = resultTags
}
</script> </script>
<template> <template>
@ -50,7 +66,7 @@ const catalogParams = {
</Teleport> </Teleport>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above> <QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8"> <QScrollArea class="fit text-grey-8">
<OrderCatalogFilter data-key="OrderCatalogList" /> <OrderCatalogFilter data-key="OrderCatalogList" :tags="tags" />
</QScrollArea> </QScrollArea>
</QDrawer> </QDrawer>
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
@ -61,6 +77,7 @@ const catalogParams = {
:limit="50" :limit="50"
:user-params="catalogParams" :user-params="catalogParams"
auto-load auto-load
@on-fetch="extractTags"
> >
<template #body="{ rows }"> <template #body="{ rows }">
<div class="catalog-list"> <div class="catalog-list">

View File

@ -25,6 +25,7 @@ const orderSummary = ref({
vat: null, vat: null,
}); });
const componentKey = ref(0); const componentKey = ref(0);
const order = ref(0);
const refresh = () => { const refresh = () => {
componentKey.value += 1; componentKey.value += 1;
@ -63,6 +64,12 @@ async function confirmOrder() {
</script> </script>
<template> <template>
<FetchData
:key="componentKey"
:url="`Orders/${route.params.id}`"
@on-fetch="(data) => (order = data)"
auto-load
/>
<FetchData <FetchData
:key="componentKey" :key="componentKey"
:url="`Orders/${route.params.id}/getTotal`" :url="`Orders/${route.params.id}/getTotal`"
@ -177,7 +184,7 @@ async function confirmOrder() {
:value="toCurrency(row.price * row.quantity)" :value="toCurrency(row.price * row.quantity)"
/> />
</template> </template>
<template #actions> <template #actions v-if="!order?.isConfirmed">
<QBtn <QBtn
:label="t('remove')" :label="t('remove')"
@click.stop="confirmRemove(row)" @click.stop="confirmRemove(row)"
@ -190,7 +197,7 @@ async function confirmOrder() {
</template> </template>
</VnPaginate> </VnPaginate>
</div> </div>
<QPageSticky :offset="[20, 20]"> <QPageSticky :offset="[20, 20]" v-if="!order?.isConfirmed">
<QBtn fab icon="check" color="primary" @click="confirmOrder()" /> <QBtn fab icon="check" color="primary" @click="confirmOrder()" />
<QTooltip> <QTooltip>
{{ t('confirm') }} {{ t('confirm') }}

View File

@ -5,8 +5,8 @@ import { useI18n } from 'vue-i18n';
import CardDescriptor from 'components/ui/CardDescriptor.vue'; import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'components/ui/VnLv.vue'; import VnLv from 'components/ui/VnLv.vue';
import useCardDescription from 'composables/useCardDescription'; import useCardDescription from 'composables/useCardDescription';
import WorkerDescriptorProxy from "pages/Worker/Card/WorkerDescriptorProxy.vue"; import ShelvingDescriptorMenu from 'pages/Shelving/Card/ShelvingDescriptorMenu.vue';
import ShelvingDescriptorMenu from "pages/Shelving/Card/ShelvingDescriptorMenu.vue"; import VnUserLink from 'src/components/ui/VnUserLink.vue';
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -57,10 +57,10 @@ const setData = (entity) => (data.value = useCardDescription(entity.code, entity
<VnLv :label="t('shelving.summary.parking')" :value="entity.parking?.code" /> <VnLv :label="t('shelving.summary.parking')" :value="entity.parking?.code" />
<VnLv v-if="entity.worker" :label="t('shelving.summary.worker')"> <VnLv v-if="entity.worker" :label="t('shelving.summary.worker')">
<template #value> <template #value>
<span class="link"> <VnUserLink
{{ entity.worker?.user?.nickname }} :name="entity.worker?.user?.nickname"
<WorkerDescriptorProxy :id="entity.worker?.id" /> :worker-id="entity.worker?.id"
</span> />
</template> </template>
</VnLv> </VnLv>
</template> </template>

View File

@ -6,6 +6,7 @@ import VnRow from 'components/ui/VnRow.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
@ -59,11 +60,7 @@ const shelvingFilter = {
}; };
</script> </script>
<template> <template>
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<FetchData <FetchData
url="Parkings" url="Parkings"
:filter="parkingFilter" :filter="parkingFilter"

View File

@ -4,6 +4,7 @@ import { useStateStore } from 'stores/useStateStore';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import SupplierDescriptor from './SupplierDescriptor.vue'; import SupplierDescriptor from './SupplierDescriptor.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
@ -27,11 +28,8 @@ const { t } = useI18n();
</QDrawer> </QDrawer>
<QPageContainer> <QPageContainer>
<QPage> <QPage>
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<div class="q-pa-md"><RouterView></RouterView></div> <div class="q-pa-md"><RouterView></RouterView></div>
</QPage> </QPage>
</QPageContainer> </QPageContainer>

View File

@ -78,11 +78,11 @@ const setData = (entity) => {
<VnLv label="Alias" :value="entity.nickname" /> <VnLv label="Alias" :value="entity.nickname" />
<VnLv <VnLv
:label="t('supplier.summary.payMethod')" :label="t('supplier.summary.payMethod')"
:value="entity.payMethod.name" :value="entity?.payMethod?.name"
/> />
<VnLv <VnLv
:label="t('supplier.summary.payDeadline')" :label="t('supplier.summary.payDeadline')"
:value="entity.payDem.payDem" :value="entity?.payDem?.payDem"
/> />
<VnLv :label="t('supplier.summary.payDay')" :value="entity.payDay" /> <VnLv :label="t('supplier.summary.payDay')" :value="entity.payDay" />
<VnLv :label="t('supplier.summary.account')" :value="entity.account" /> <VnLv :label="t('supplier.summary.account')" :value="entity.account" />

View File

@ -3,11 +3,11 @@ import { onMounted, ref, 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 CardSummary from 'components/ui/CardSummary.vue'; import CardSummary from 'components/ui/CardSummary.vue';
import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import { getUrl } from 'src/composables/getUrl'; import { getUrl } from 'src/composables/getUrl';
import { useRole } from 'src/composables/useRole'; import { useRole } from 'src/composables/useRole';
import { dashIfEmpty } from 'src/filters'; import { dashIfEmpty } from 'src/filters';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
onUpdated(() => summaryRef.value.fetch()); onUpdated(() => summaryRef.value.fetch());
@ -71,13 +71,10 @@ const isAdministrative = computed(() => {
<VnLv label="Alias" :value="supplier.nickname" /> <VnLv label="Alias" :value="supplier.nickname" />
<VnLv :label="t('supplier.summary.responsible')"> <VnLv :label="t('supplier.summary.responsible')">
<template #value> <template #value>
<span class="link"> <VnUserLink
{{ dashIfEmpty(supplier.worker?.user?.nickname) }} :name="dashIfEmpty(supplier.worker?.user?.nickname)"
<WorkerDescriptorProxy :worker-id="supplier.worker?.user?.id"
v-if="supplier.worker?.user?.id"
:id="supplier.worker?.user?.id"
/> />
</span>
</template> </template>
</VnLv> </VnLv>
<VnLv :label="t('supplier.summary.notes')" class="q-mb-xs"> <VnLv :label="t('supplier.summary.notes')" class="q-mb-xs">

View File

@ -5,6 +5,7 @@ import VnSearchbar from 'components/ui/VnSearchbar.vue';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
@ -28,11 +29,7 @@ const newSupplierForm = reactive({
</template> </template>
<QPage> <QPage>
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<FormModel <FormModel
url-create="Suppliers/newSupplier" url-create="Suppliers/newSupplier"
model="supplier" model="supplier"

View File

@ -4,6 +4,7 @@ import { useStateStore } from 'stores/useStateStore';
import TicketDescriptor from './TicketDescriptor.vue'; import TicketDescriptor from './TicketDescriptor.vue';
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
@ -26,11 +27,8 @@ const { t } = useI18n();
</QDrawer> </QDrawer>
<QPageContainer> <QPageContainer>
<QPage> <QPage>
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<div class="q-pa-md"><RouterView></RouterView></div> <div class="q-pa-md"><RouterView></RouterView></div>
</QPage> </QPage>
</QPageContainer> </QPageContainer>

View File

@ -8,7 +8,7 @@ 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 VnLv from 'src/components/ui/VnLv.vue';
import useCardDescription from 'src/composables/useCardDescription'; import useCardDescription from 'src/composables/useCardDescription';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue';
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -106,13 +106,10 @@ const setData = (entity) =>
</VnLv> </VnLv>
<VnLv :label="t('ticket.summary.salesPerson')"> <VnLv :label="t('ticket.summary.salesPerson')">
<template #value> <template #value>
<span class="link"> <VnUserLink
{{ entity.client.salesPersonUser.name }} :name="entity.client.salesPersonUser?.name"
<WorkerDescriptorProxy :worker-id="entity.client.salesPersonFk"
:id="entity.client.salesPersonFk"
v-if="entity.client.salesPersonFk"
/> />
</span>
</template> </template>
</VnLv> </VnLv>
<VnLv :label="t('ticket.card.warehouse')" :value="entity.warehouse?.name" /> <VnLv :label="t('ticket.card.warehouse')" :value="entity.warehouse?.name" />

View File

@ -1,118 +1,16 @@
<script setup> <script setup>
import { date } from 'quasar'; import { useRoute } from 'vue-router';
import { computed } from 'vue'; import VnSms from 'src/components/ui/VnSms.vue';
import { useRouter } from 'vue-router';
import { useSession } from 'src/composables/useSession'; const route = useRoute();
import VnPaginate from 'src/components/ui/VnPaginate.vue'; const id = route.params.id;
import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.vue';
const router = useRouter(); const where = {
const session = useSession(); ticketFk: id,
const token = session.getToken();
const entityId = computed(function () {
return router.currentRoute.value.params.id;
});
const filter = {
fields: ['ticketFk', 'smsFk'],
include: {
relation: 'sms',
scope: {
fields: [
'senderFk',
'sender',
'destination',
'message',
'statusCode',
'status',
'created',
],
include: {
relation: 'sender',
scope: {
fields: ['name'],
},
},
},
},
where: {
ticketFk: entityId,
},
}; };
function formatNumer(number) {
if (number.length <= 10) return number;
return number.slice(0, 4) + ' ' + number.slice(4);
}
</script> </script>
<template> <template>
<div class="column items-center"> <div class="column items-center">
<div class="list"> <VnSms url="clientSms" :where="where" />
<VnPaginate
data-key="TicketSms"
url="TicketSms"
:filter="filter"
order="smsFk DESC"
:offset="100"
:limit="5"
auto-load
>
<template #body="{ rows }">
<QCard
flat
bordered
class="card q-pa-md"
v-for="row of rows"
:key="row.smsFk"
>
<QItem>
<QItmSection top avatar>
<QItemLabel class="column items-center">
<QAvatar>
<QImg
:src="`/api/Images/user/160x160/${row.sms.senderFk}/download?access_token=${token}`"
spinner-color="white"
/>
</QAvatar>
<span class="link">
{{ row.sms.sender.name }}
<WorkerDescriptorProxy :id="row.sms.senderFk" />
</span>
</QItemLabel>
</QItmSection>
<QSeparator spaced inset="item" />
<QItemSection>
<QItemLabel caption>{{
formatNumer(row.sms.destination)
}}</QItemLabel>
<QItemLabel>{{ row.sms.message }}</QItemLabel>
</QItemSection>
<QItemSection side top>
<QItemLabel caption>{{
date.formatDate(
row.sms.created,
'YYYY-MM-DD HH:mm:ss'
)
}}</QItemLabel>
<QItemLabel>
<QChip
:color="
row.sms.status == 'OK'
? 'positive'
: 'negative'
"
>
{{ row.sms.status }}
</QChip>
</QItemLabel>
</QItemSection>
</QItem>
</QCard>
</template>
</VnPaginate>
</div>
</div> </div>
</template> </template>

View File

@ -8,10 +8,10 @@ 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 VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue'; import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
import { getUrl } from 'src/composables/getUrl'; import { getUrl } from 'src/composables/getUrl';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
onUpdated(() => summaryRef.value.fetch()); onUpdated(() => summaryRef.value.fetch());
@ -49,7 +49,7 @@ async function setData(data) {
function formattedAddress() { function formattedAddress() {
if (!ticket.value) return ''; if (!ticket.value) return '';
const address = this.ticket.address; const address = ticket.value.address;
const postcode = address.postalCode; const postcode = address.postalCode;
const province = address.province ? `(${address.province.name})` : ''; const province = address.province ? `(${address.province.name})` : '';
@ -58,7 +58,7 @@ function formattedAddress() {
function isEditable() { function isEditable() {
try { try {
return !this.ticket.ticketState.state.alertLevel; return !ticket.value.ticketState.state.alertLevel;
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }
@ -67,10 +67,10 @@ function isEditable() {
} }
async function changeState(value) { async function changeState(value) {
if (!this.ticket.id) return; if (!ticket.value.id) return;
const formData = { const formData = {
ticketFk: this.ticket.id, ticketFk: ticket.value.id,
code: value, code: value,
}; };
@ -160,13 +160,10 @@ async function changeState(value) {
</VnLv> </VnLv>
<VnLv :label="t('ticket.summary.salesPerson')"> <VnLv :label="t('ticket.summary.salesPerson')">
<template #value> <template #value>
<span class="link"> <VnUserLink
{{ ticket.client?.salesPersonUser?.name }} :name="ticket.client?.salesPersonUser?.name"
<WorkerDescriptorProxy :worker-id="ticket.client?.salesPersonFk"
:id="ticket.client.salesPersonFk"
v-if="ticket.client.salesPersonFk"
/> />
</span>
</template> </template>
</VnLv> </VnLv>
<VnLv <VnLv

View File

@ -87,7 +87,7 @@ function viewSummary(id) {
v-for="row of rows" v-for="row of rows"
:key="row.id" :key="row.id"
:id="row.id" :id="row.id"
:title="`${row.nickname} (${row.id})`" :title="`${row.nickname}`"
@click="navigate(row.id)" @click="navigate(row.id)"
> >
<template #list-items> <template #list-items>

View File

@ -2,6 +2,7 @@
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import TravelDescriptor from './TravelDescriptor.vue'; import TravelDescriptor from './TravelDescriptor.vue';
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
</script> </script>
@ -15,11 +16,8 @@ const stateStore = useStateStore();
</QDrawer> </QDrawer>
<QPageContainer> <QPageContainer>
<QPage> <QPage>
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<div class="q-pa-md"><RouterView></RouterView></div> <div class="q-pa-md"><RouterView></RouterView></div>
</QPage> </QPage>
</QPageContainer> </QPageContainer>

View File

@ -8,7 +8,7 @@ import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { toDate } from 'src/filters'; import { toDate } from 'src/filters';
const { t } = useI18n(); const { t } = useI18n();
@ -57,11 +57,7 @@ onBeforeMount(() => {
auto-load auto-load
/> />
<QPage> <QPage>
<QToolbar class="bg-vn-dark"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<FormModel <FormModel
url-update="Travels" url-update="Travels"
model="travel" model="travel"

View File

@ -4,6 +4,7 @@ import { useStateStore } from 'stores/useStateStore';
import WorkerDescriptor from './WorkerDescriptor.vue'; import WorkerDescriptor from './WorkerDescriptor.vue';
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
@ -26,11 +27,8 @@ const { t } = useI18n();
</QDrawer> </QDrawer>
<QPageContainer> <QPageContainer>
<QPage> <QPage>
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<div class="q-pa-md"><RouterView></RouterView></div> <div class="q-pa-md"><RouterView></RouterView></div>
</QPage> </QPage>
</QPageContainer> </QPageContainer>

View File

@ -2,12 +2,12 @@
import { ref, onMounted, computed } from 'vue'; import { ref, onMounted, computed } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import CardSummary from 'components/ui/CardSummary.vue'; import { dashIfEmpty } from 'src/filters';
import { getUrl } from 'src/composables/getUrl'; import { getUrl } from 'src/composables/getUrl';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import WorkerDescriptorProxy from './WorkerDescriptorProxy.vue';
import { dashIfEmpty } from 'src/filters';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue'; import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
import CardSummary from 'components/ui/CardSummary.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
@ -83,13 +83,11 @@ const filter = {
<VnLv :label="t('worker.list.email')" :value="worker.user.email" /> <VnLv :label="t('worker.list.email')" :value="worker.user.email" />
<VnLv :label="t('worker.summary.boss')" link> <VnLv :label="t('worker.summary.boss')" link>
<template #value> <template #value>
<span class="link"> <VnUserLink
{{ dashIfEmpty(worker.boss?.name) }}
<WorkerDescriptorProxy
:id="worker.bossFk"
v-if="worker.boss" v-if="worker.boss"
:name="dashIfEmpty(worker.boss?.name)"
:worker-id="worker.bossFk"
/> />
</span>
</template> </template>
</VnLv> </VnLv>
<VnLv :value="worker.mobileExtension"> <VnLv :value="worker.mobileExtension">

View File

@ -11,6 +11,7 @@ import VnSelectCreate from 'src/components/common/VnSelectCreate.vue';
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue'; import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue'; import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { useUserConfig } from 'src/composables/useUserConfig'; import { useUserConfig } from 'src/composables/useUserConfig';
@ -122,11 +123,7 @@ onMounted(async () => {
/> />
<QPage> <QPage>
<QToolbar class="bg-vn-dark"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<FormModel <FormModel
url-create="Workers/new" url-create="Workers/new"
model="worker" model="worker"

View File

@ -16,6 +16,7 @@ export default {
'InvoiceInVat', 'InvoiceInVat',
'InvoiceInDueDay', 'InvoiceInDueDay',
'InvoiceInIntrastat', 'InvoiceInIntrastat',
'InvoiceInLog',
], ],
}, },
children: [ children: [
@ -92,6 +93,15 @@ export default {
component: () => component: () =>
import('src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue'), import('src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue'),
}, },
{
name: 'InvoiceInLog',
path: 'log',
meta: {
title: 'log',
icon: 'history',
},
component: () => import('src/pages/InvoiceIn/Card/InvoiceInLog.vue'),
},
], ],
}, },
], ],

View File

@ -1,7 +1,9 @@
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import { useUserConfig } from 'src/composables/useUserConfig'; import { useUserConfig } from 'src/composables/useUserConfig';
import useNotify from 'src/composables/useNotify.js';
import { exportFile } from 'quasar'; import { exportFile } from 'quasar';
import { useArrayData } from 'composables/useArrayData';
import useNotify from 'src/composables/useNotify.js';
import axios from 'axios'; import axios from 'axios';
const { notify } = useNotify(); const { notify } = useNotify();
@ -240,9 +242,10 @@ export const useInvoiceOutGlobalStore = defineStore({
throw err; throw err;
}, },
async getNegativeBasesCsv(from, to) { async getNegativeBasesCsv() {
try { try {
const params = { from: from, to: to }; const arrayData = useArrayData('InvoiceOutNegative');
const params = arrayData.store.currentFilter;
const { data } = await axios.get('InvoiceOuts/negativeBasesCsv', { const { data } = await axios.get('InvoiceOuts/negativeBasesCsv', {
params, params,

View File

@ -11,6 +11,7 @@ export const useNavigationStore = defineStore('navigationStore', () => {
'claim', 'claim',
'ticket', 'ticket',
'invoiceOut', 'invoiceOut',
'invoiceIn',
'worker', 'worker',
'shelving', 'shelving',
'order', 'order',
@ -18,7 +19,6 @@ export const useNavigationStore = defineStore('navigationStore', () => {
'route', 'route',
'supplier', 'supplier',
'travel', 'travel',
'invoiceIn',
'entry', 'entry',
]; ];
const pinnedModules = ref([]); const pinnedModules = ref([]);

View File

@ -5,6 +5,7 @@ export const useStateStore = defineStore('stateStore', () => {
const isMounted = ref(false); const isMounted = ref(false);
const leftDrawer = ref(false); const leftDrawer = ref(false);
const rightDrawer = ref(false); const rightDrawer = ref(false);
const subToolbar = ref(false);
function toggleLeftDrawer() { function toggleLeftDrawer() {
leftDrawer.value = !leftDrawer.value; leftDrawer.value = !leftDrawer.value;
@ -14,6 +15,10 @@ export const useStateStore = defineStore('stateStore', () => {
rightDrawer.value = !rightDrawer.value; rightDrawer.value = !rightDrawer.value;
} }
function toggleSubToolbar() {
subToolbar.value = !subToolbar.value;
}
function setMounted() { function setMounted() {
isMounted.value = true; isMounted.value = true;
} }
@ -31,10 +36,7 @@ export const useStateStore = defineStore('stateStore', () => {
} }
function isSubToolbarShown() { function isSubToolbarShown() {
return ( return subToolbar.value;
!!document.querySelector('#st-data') &&
!!document.querySelector('#st-actions')
);
} }
return { return {
@ -47,5 +49,6 @@ export const useStateStore = defineStore('stateStore', () => {
isLeftDrawerShown, isLeftDrawerShown,
isRightDrawerShown, isRightDrawerShown,
isSubToolbarShown, isSubToolbarShown,
toggleSubToolbar,
}; };
}); });

View File

@ -1,8 +1,8 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('InvoiceInList', () => { describe('InvoiceInList', () => {
const firstCard = '.q-card:nth-child(1)'; const firstCard = '.q-card:nth-child(1)';
const firstId = const firstChipId =
'.q-card:nth-child(1) .list-items > .vn-label-value:first-child > .value > span'; ':nth-child(1) > :nth-child(1) > .justify-between > .flex > .q-chip > .q-chip__content';
const firstDetailBtn = '.q-card:nth-child(1) .q-btn:nth-child(2)'; const firstDetailBtn = '.q-card:nth-child(1) .q-btn:nth-child(2)';
const summaryHeaders = '.summaryBody .header'; const summaryHeaders = '.summaryBody .header';
@ -12,9 +12,10 @@ describe('InvoiceInList', () => {
}); });
it('should redirect on clicking a invoice', () => { it('should redirect on clicking a invoice', () => {
cy.get(firstId) cy.get(firstChipId)
.invoke('text') .invoke('text')
.then((id) => { .then((content) => {
const id = content.substring(4);
cy.get(firstCard).click(); cy.get(firstCard).click();
cy.url().should('include', `/invoice-in/${id}/summary`); cy.url().should('include', `/invoice-in/${id}/summary`);
}); });

View File

@ -6,6 +6,7 @@ describe('WagonCreate', () => {
}); });
it('should create and delete a new wagon', () => { it('should create and delete a new wagon', () => {
cy.waitForElement('.q-card');
cy.get('input').eq(0).type('1234'); cy.get('input').eq(0).type('1234');
cy.get('input').eq(1).type('1234ABCD'); cy.get('input').eq(1).type('1234ABCD');
cy.get('input').eq(2).type('100'); cy.get('input').eq(2).type('100');
@ -16,18 +17,14 @@ describe('WagonCreate', () => {
cy.get('button[type="submit"]').click(); cy.get('button[type="submit"]').click();
// Check data has been saved successfully // Check data has been saved successfully
cy.get('div.text-h6').contains('1234').click(); cy.waitForElement('.q-card');
cy.get('input').eq(0).should('have.value', '1234');
cy.get('input').eq(1).should('have.value', '1234ABCD'); cy.get('.title').should('have.text', '1234');
cy.get('input').eq(2).should('have.value', '100'); cy.get('[title-label="Plate"] > .value > span').should('have.text', '1234ABCD');
cy.get('input').eq(3).should('have.value', 'Wagon Type #1'); cy.get(':nth-child(2) > .value > span').should('have.text', '100');
cy.get(':nth-child(3) > .value > span').should('have.text', 'Wagon Type #1');
// Delete wagon type created // Delete wagon type created
cy.go('back'); cy.get('.actions > .q-btn--standard').click();
cy.get('div.text-h6')
.contains('1234')
.parentsUntil('div.q-card')
.find('div.q-card__actions')
.find('button').last().click();
}); });
}); });

View File

@ -38,7 +38,9 @@ describe('WagonTypeCreate', () => {
cy.get('button[type="submit"]').click(); cy.get('button[type="submit"]').click();
// Check data has been saved successfully // Check data has been saved successfully
cy.get('div.text-h6').contains('Example for testing').click(); cy.get(':nth-child(1) > :nth-child(1) > .justify-between > .flex > .title')
.contains('Example for testing')
.click();
cy.get('input').first().should('have.value', 'Example for testing'); cy.get('input').first().should('have.value', 'Example for testing');
cy.get('div.wagon-tray').should('have.length', 4); cy.get('div.wagon-tray').should('have.length', 4);
cy.get('div.position').eq(0).find('input').should('have.value', '150'); cy.get('div.position').eq(0).find('input').should('have.value', '150');
@ -47,11 +49,8 @@ describe('WagonTypeCreate', () => {
// Delete wagon type created // Delete wagon type created
cy.go('back'); cy.go('back');
cy.get('div.text-h6') cy.get(
.contains('Example for testing') ':nth-child(2) > :nth-child(1) > .card-list-body > .actions > .q-btn--standard'
.parentsUntil('div.q-card') ).click();
.find('div.q-card__actions')
.find('button').last().click();
}); });
}); });

View File

@ -1,6 +1,6 @@
describe('WorkerList', () => { describe('WorkerList', () => {
const workerFieldNames = const workerFieldNames =
'.card-list-body > .list-items > :nth-child(2) > .value > span'; '.card-list-body > .list-items > :nth-child(1) > .value > span';
beforeEach(() => { beforeEach(() => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
cy.login('developer'); cy.login('developer');

View File

@ -138,22 +138,19 @@ Cypress.Commands.add('validateRow', (rowSelector, expectedValues) => {
Cypress.Commands.add('removeRow', (rowIndex) => { Cypress.Commands.add('removeRow', (rowIndex) => {
let rowsBefore; let rowsBefore;
let rowsAfter; cy.get('tbody > tr:visible')
cy.get('tr')
.its('length') .its('length')
.then((length) => { .then((length) => {
rowsBefore = length;
cy.get('.q-checkbox').eq(rowIndex).click(); cy.get('.q-checkbox').eq(rowIndex).click();
cy.removeCard(); cy.removeCard();
cy.get('.q-dialog button').eq(2).click(); cy.get('.q-dialog button').eq(2).click();
rowsBefore = length;
}) })
.then(() => { .then(() => {
cy.get('tr') // Check the existence of tbody before performing the second assertion.
.its('length') cy.get('tbody').then(($tbody) => {
.then((length) => { if ($tbody.length > 0)
rowsAfter = length; cy.get('tbody > tr:visible').should('have.length', rowsBefore - 1);
expect(rowsBefore).to.eq(rowsAfter + 1);
}); });
}); });
}); });

View File

@ -0,0 +1,25 @@
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import VnSms from 'src/components/ui/VnSms.vue';
describe('VnSms', () => {
let vm;
beforeAll(() => {
vm = createWrapper(VnSms, {
global: {
stubs: ['VnPaginate'],
mocks: {},
},
}).vm;
});
afterEach(() => {
vi.clearAllMocks();
});
it('should format number correctly', () => {
const formattedNumber = vm.formatNumber('123456789012');
expect(formattedNumber).toBe('1234 56789012');
});
});