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/),
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
- (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

4
package-lock.json generated
View File

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

View File

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

View File

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

View File

@ -30,7 +30,7 @@ const $props = defineProps({
params: {
type: Object,
default: null,
}
},
});
const emit = defineEmits(['onFetch']);
@ -42,9 +42,9 @@ onMounted(async () => {
}
});
async function fetch() {
async function fetch(fetchFilter = {}) {
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.sortBy) filter.order = $props.sortBy;
if ($props.limit) filter.limit = $props.limit;

View File

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

View File

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

View File

@ -1,17 +1,18 @@
<script setup>
import { onMounted, computed } from 'vue';
import { Dark, Quasar } from 'quasar';
import { Dark, Quasar, useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import axios from 'axios';
import { useState } from 'src/composables/useState';
import { useSession } from 'src/composables/useSession';
import { localeEquivalence } from "src/i18n/index";
const state = useState();
const session = useSession();
const router = useRouter();
const { t, locale } = useI18n();
const quasar = useQuasar();
const userLocale = computed({
get() {
@ -20,13 +21,11 @@ const userLocale = computed({
set(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 {
const langList = import.meta.glob('../../node_modules/quasar/lang/*.mjs');
langList[`../../node_modules/quasar/lang/${value}.mjs`]().then((lang) => {
/* @vite-ignore */
import(`../../node_modules/quasar/lang/${value}.mjs`).then((lang) => {
Quasar.lang.set(lang.default);
});
} catch (error) {
@ -81,6 +80,14 @@ function logout() {
session.destroy();
router.push('/login');
}
function copyUserToken(){
navigator.clipboard.writeText(session.getToken());
quasar.notify({
type: 'positive',
message: t('components.userPanel.copyToken'),
});
}
</script>
<template>
@ -122,7 +129,8 @@ function logout() {
<div class="text-subtitle1 q-mt-md">
<strong>{{ user.nickname }}</strong>
</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
id="logout"
@ -143,4 +151,10 @@ function logout() {
.panel {
width: 150px;
}
.copyUserToken {
&:hover{
cursor: alias;
}
}
</style>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,8 @@
<script setup>
import { useSession } from 'src/composables/useSession';
const $props = defineProps({
worker: { type: Number, required: true },
workerId: { type: Number, required: true },
description: { type: String, default: null },
});
const session = useSession();
@ -11,7 +12,7 @@ const token = session.getToken();
<div class="avatar-picture column items-center">
<QAvatar color="orange">
<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"
/>
</QAvatar>

View File

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

View File

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

View File

@ -168,7 +168,12 @@ async function onLoad(...params) {
</QCard>
</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>
<div v-if="isLoading" class="info-row q-pa-md text-center">
<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;
cancelRequest();
@ -90,7 +90,7 @@ export function useArrayData(key, userOptions) {
Object.assign(params, userParams);
store.isLoading = true;
store.currentFilter = params;
const response = await axios.get(store.url, {
signal: canceller.signal,
params,
@ -100,15 +100,12 @@ export function useArrayData(key, userOptions) {
hasMoreData.value = response.data.length === limit;
if (append === true) {
if (append) {
if (!store.data) store.data = [];
for (const row of response.data) store.data.push(row);
}
if (append === false) {
} else {
store.data = response.data;
updateStateParams();
updateRouter && updateStateParams();
}
store.isLoading = false;
@ -156,7 +153,9 @@ export function useArrayData(key, userOptions) {
delete store.userParams[param];
delete params[param];
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) {
delete store.filter.where;
}

View File

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

View File

@ -17,9 +17,9 @@ a {
// Removes chrome autofill background
input:-webkit-autofill,
select:-webkit-autofill {
color: $input-text-color !important;
color: var(--vn-text) ;
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;
background-clip: text !important;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -127,11 +127,14 @@ async function updateDestination(claimDestinationFk, row, options = {}) {
}
async function regularizeClaim() {
const query = `Claims/${claimId}/regularizeClaim`;
await axios.post(query);
if (claim.value.responsibility >= Math.ceil(DEFAULT_MAX_RESPONSABILITY) / 2) {
await axios.post(`Claims/${claimId}/regularizeClaim`);
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
.dialog({
component: VnConfirm,
@ -141,29 +144,19 @@ async function regularizeClaim() {
},
})
.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() {
const greugeTypeFreightId = await getGreugeTypeId();
const freightPickUpPrice = await getGreugeConfig();
const greugeTypeFreightId = (
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,
description: `${t('ClaimGreugeDescription')} ${claimId}`.toUpperCase(),
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) {
const query = `Claims/${claimId}/updateClaimAction`;
await axios.patch(query, data);
@ -302,6 +282,8 @@ async function importToNewRefundTicket() {
selection="multiple"
v-model:selected="selectedRows"
:grid="$q.screen.lt.md"
:pagination="{ rowsPerPage: 0 }"
:hide-bottom="true"
>
<template #body-cell-ticket="{ value }">
<QTd align="center">
@ -355,7 +337,23 @@ async function importToNewRefundTicket() {
</QItemSection>
<QItemSection side>
<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 v-else>
{{ column.value }}
@ -437,25 +435,6 @@ async function importToNewRefundTicket() {
</QCardActions>
</QCard>
</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>
<style lang="scss" scoped>
.slider-container {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
<script setup>
import { onMounted, ref, computed } from 'vue';
import { onMounted, ref, computed, watch } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { toDate, toCurrency } from 'src/filters';
@ -7,8 +7,9 @@ import CardSummary from 'components/ui/CardSummary.vue';
import FetchData from 'components/FetchData.vue';
import { getUrl } from 'src/composables/getUrl';
import { useSession } from 'src/composables/useSession';
import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.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 { t } = useI18n();
@ -26,12 +27,26 @@ const entityId = computed(() => $props.id || route.params.id);
const claimUrl = ref();
const salixUrl = ref();
const claimDmsRef = ref();
const claimDmsFilter = ref({
include: [
{
relation: 'dms',
},
],
where: { claimFk: entityId.value },
});
onMounted(async () => {
salixUrl.value = await getUrl('');
claimUrl.value = salixUrl.value + `claim/${entityId.value}/`;
});
watch(entityId, async (id) => {
claimDmsFilter.value.where = { claimFk: id };
await claimDmsRef.value.fetch();
});
const detailsColumns = ref([
{
name: 'item',
@ -118,7 +133,7 @@ const developmentColumns = ref([
{
name: 'worker',
label: 'claim.summary.worker',
field: (row) => row.worker.user.nickname,
field: (row) => row.worker?.user.nickname,
sortable: true,
},
{
@ -131,18 +146,9 @@ const developmentColumns = ref([
const claimDms = ref([]);
const multimediaDialog = ref();
const multimediaSlide = ref();
const claimDmsFilter = ref({
include: [
{
relation: 'dms',
},
],
where: { claimFk: entityId.value },
});
function setClaimDms(data) {
if (!data) return;
claimDms.value = [];
data.forEach((media) => {
claimDms.value.push({
isVideo: media.dms.contentType == 'video/mp4',
@ -165,6 +171,7 @@ function openDialog(dmsId) {
@on-fetch="(data) => setClaimDms(data)"
limit="20"
auto-load
ref="claimDmsRef"
/>
<CardSummary ref="summary" :url="`Claims/${entityId}/getSummary`">
<template #header="{ entity: { claim } }">
@ -189,30 +196,30 @@ function openDialog(dmsId) {
</VnLv>
<VnLv :label="t('claim.summary.assignedTo')">
<template #value>
<span class="link">
{{ claim.worker.user.nickname }}
<WorkerDescriptorProxy :id="claim.workerFk" />
</span>
<VnUserLink
:name="claim.worker?.user?.nickname"
:worker-id="claim.workerFk"
/>
</template>
</VnLv>
<VnLv :label="t('claim.summary.attendedBy')">
<template #value>
<span class="link">
{{ claim.client.salesPersonUser.name }}
<WorkerDescriptorProxy :id="claim.client.salesPersonFk" />
</span>
<VnUserLink
:name="claim.client?.salesPersonUser?.name"
:worker-id="claim.client?.salesPersonFk"
/>
</template>
</VnLv>
</QCard>
<QCard class="vn-one">
<a class="header" :href="claimUrl + 'note/index'">
<QCard class="vn-max claimVnNotes">
<a class="header" :href="`#/claim/${entityId}/notes`">
{{ t('claim.summary.notes') }}
<QIcon name="open_in_new" color="primary" />
</a>
<!-- Use VnNotes and maybe VirtualScroll-->
<ClaimNotes :add-note="false" style="height: 350px" order="created ASC" />
</QCard>
<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') }}
<QIcon name="open_in_new" color="primary" />
</a>
@ -306,20 +313,6 @@ function openDialog(dmsId) {
/>
</div>
</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
v-model="multimediaDialog"
transition-show="slide-up"
@ -362,6 +355,13 @@ function openDialog(dmsId) {
</template>
</CardSummary>
</template>
<style lang="scss">
.claimVnNotes {
.q-card {
max-width: 100%;
}
}
</style>
<style lang="scss" scoped>
.q-dialog__inner--minimized > div {
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 ClaimSummaryDialog from './Card/ClaimSummaryDialog.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 router = useRouter();
@ -38,15 +38,6 @@ function viewSummary(id) {
},
});
}
function viewDescriptor(id) {
quasar.dialog({
component: CustomerDescriptorProxy,
componentProps: {
id,
},
});
}
</script>
<template>
@ -84,7 +75,7 @@ function viewDescriptor(id) {
<VnPaginate
data-key="ClaimList"
url="Claims/filter"
order="id DESC"
order="claimStateFk"
auto-load
>
<template #body="{ rows }">
@ -106,10 +97,10 @@ function viewDescriptor(id) {
</VnLv>
<VnLv :label="t('claim.list.assignedTo')" @click.stop>
<template #value>
<span class="link">
{{ row.workerName }}
<WorkerDescriptorProxy :id="row.workerFk" />
</span>
<VnUserLink
:name="row.workerName"
:worker-id="row.workerFk"
/>
</template>
</VnLv>
<VnLv

View File

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

View File

@ -4,9 +4,9 @@ import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { toCurrency } from 'src/filters';
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 useCardDescription from 'src/composables/useCardDescription';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const $props = defineProps({
id: {
@ -44,10 +44,10 @@ const setData = (entity) => (data.value = useCardDescription(entity.name, entity
<template #body="{ entity }">
<VnLv v-if="entity.salesPersonUser" :label="t('customer.card.salesPerson')">
<template #value>
<span class="link">
{{ entity.salesPersonUser.name }}
<WorkerDescriptorProxy :id="entity.salesPersonFk" />
</span>
<VnUserLink
:name="entity.salesPersonUser?.name"
:worker-id="entity.salesPersonFk"
/>
</template>
</VnLv>
<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>
<div class="flex justify-center">Sms</div>
<div class="column items-center">
<VnSms url="clientSms" :where="where" />
</div>
</template>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,6 +4,7 @@ import { useStateStore } from 'stores/useStateStore';
import InvoiceInDescriptor from './InvoiceInDescriptor.vue';
import LeftMenu from 'components/LeftMenu.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { useArrayData } from 'src/composables/useArrayData';
import { onMounted, watch } from 'vue';
import { useRoute } from 'vue-router';
@ -74,11 +75,7 @@ onMounted(async () => {
</QDrawer>
<QPageContainer>
<QPage>
<QToolbar class="bg-vn-dark justify-end">
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<VnSubToolbar />
<div class="q-pa-md"><RouterView></RouterView></div>
</QPage>
</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)"
>
<template #header="{ entity: invoiceIn }">
<div>{{ invoiceIn.id }} - {{ invoiceIn.supplier.name }}</div>
<div>{{ invoiceIn.id }} - {{ invoiceIn.supplier?.name }}</div>
</template>
<template #body="{ entity: invoiceIn }">
<!--Basic Data-->
@ -216,7 +216,7 @@ function getLink(param) {
</QCardSection>
<VnLv
:label="t('invoiceIn.summary.supplier')"
:value="invoiceIn.supplier.name"
:value="invoiceIn.supplier?.name"
/>
<VnLv
:label="t('invoiceIn.summary.supplierRef')"
@ -224,7 +224,7 @@ function getLink(param) {
/>
<VnLv
:label="t('invoiceIn.summary.currency')"
:value="invoiceIn.currency.code"
:value="invoiceIn.currency?.code"
/>
<VnLv
:label="t('invoiceIn.summary.docNumber')"
@ -265,7 +265,7 @@ function getLink(param) {
</QCardSection>
<VnLv
:label="t('invoiceIn.summary.sage')"
:value="invoiceIn.sageWithholding.withholding"
:value="invoiceIn.sageWithholding?.withholding"
/>
<VnLv
:label="t('invoiceIn.summary.vat')"
@ -273,7 +273,7 @@ function getLink(param) {
/>
<VnLv
:label="t('invoiceIn.summary.company')"
:value="invoiceIn.company.code"
:value="invoiceIn.company?.code"
/>
<VnLv
:label="t('invoiceIn.summary.booked')"

View File

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

View File

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

View File

@ -4,13 +4,14 @@ import { useI18n } from 'vue-i18n';
import { QCheckbox, QBtn } from 'quasar';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import InvoiceOutNegativeFilter from './InvoiceOutNegativeBasesFilter.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { toCurrency } from 'src/filters';
import { useInvoiceOutGlobalStore } from 'src/stores/invoiceOutGlobal.js';
import { useStateStore } from 'stores/useStateStore';
import { useArrayData } from 'composables/useArrayData';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const invoiceOutGlobalStore = useInvoiceOutGlobalStore();
const stateStore = useStateStore();
@ -187,9 +188,21 @@ const columns = computed(() => [
]);
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(
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" />
</QScrollArea>
</QDrawer>
<QToolbar class="bg-vn-dark">
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<VnSubToolbar />
<QPage class="column items-center q-pa-md">
<QTable
:columns="columns"
@ -243,8 +252,14 @@ const selectWorkerId = (id) => {
"
>{{ props.value }}
</template>
<CustomerDescriptorProxy :id="selectedCustomerId" />
<WorkerDescriptorProxy :id="selectedWorkerId" />
<CustomerDescriptorProxy
v-if="props.col.name === 'clientId'"
:id="selectedCustomerId"
/>
<VnUserLink
v-if="props.col.name === 'comercial'"
:worker-id="selectedWorkerId"
/>
</component>
</QTd>
</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 { useStateStore } from 'stores/useStateStore';
import OrderDescriptor from 'pages/Order/Card/OrderDescriptor.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const stateStore = useStateStore();
</script>
@ -15,9 +16,8 @@ const stateStore = useStateStore();
</QDrawer>
<QPageContainer>
<QPage>
<div class="q-pa-md">
<VnSubToolbar />
<RouterView></RouterView>
</div>
</QPage>
</QPageContainer>
</template>

View File

@ -1,11 +1,14 @@
<script setup>
import { computed, ref } from 'vue';
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 VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnSelectFilter from 'components/common/VnSelectFilter.vue';
import axios from 'axios';
import { useRoute } from 'vue-router';
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
const { t } = useI18n();
const route = useRoute();
@ -14,6 +17,10 @@ const props = defineProps({
type: String,
required: true,
},
tags: {
type: Array,
required: true,
},
});
const categoryList = ref(null);
@ -26,6 +33,20 @@ const resetCategory = () => {
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) => {
if (key === 'categoryFk') {
resetCategory();
@ -59,6 +80,11 @@ const onFilterInit = async ({ params }) => {
await loadTypes(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(() =>
@ -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) => {
categoryList.value = (data || [])
.filter((category) => category.display)
@ -103,6 +183,7 @@ const getCategoryClass = (category, params) => {
:data-key="props.dataKey"
:hidden-tags="['orderFk', 'orderBy']"
:expr-builder="exprBuilder"
:custom-tags="['tagGroups']"
@init="onFilterInit"
@remove="clearFilter"
>
@ -118,8 +199,27 @@ const getCategoryClass = (category, params) => {
<span>{{ formatFn(tag.value) }}</span>
</div>
</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 }">
<QList dense>
<QList dense style="max-width: 256px">
<QItem class="category-filter q-mt-md">
<div
v-for="category in categoryList"
@ -137,7 +237,7 @@ const getCategoryClass = (category, params) => {
</QIcon>
</div>
</QItem>
<QItem class="q-mt-md">
<QItem class="q-my-md">
<QItemSection>
<VnSelectFilter
:label="t('params.type')"
@ -171,6 +271,130 @@ const getCategoryClass = (category, params) => {
</VnSelectFilter>
</QItemSection>
</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>
</template>
</VnFilterPanel>
@ -198,12 +422,29 @@ const getCategoryClass = (category, params) => {
.category-icon {
border-radius: 50%;
background-color: var(--vn-label);
background-color: var(--vn-light-gray);
font-size: 2.6rem;
padding: 8px;
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>
<i18n>
@ -211,10 +452,16 @@ en:
params:
type: Type
orderBy: Order By
tag: Tag
value: Value
order: Order
es:
params:
type: Tipo
orderBy: Ordenar por
tag: Etiqueta
value: Valor
order: Orden
Plant: Planta
Flower: Flor
Handmade: Confección

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
<script setup>
import { useStateStore } from 'stores/useStateStore';
import { useRoute } from 'vue-router';
import { onMounted, onUnmounted } from 'vue';
import {onMounted, onUnmounted, ref} from 'vue';
import { useI18n } from 'vue-i18n';
import VnPaginate from 'components/ui/VnPaginate.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 }),
};
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>
<template>
@ -50,7 +66,7 @@ const catalogParams = {
</Teleport>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8">
<OrderCatalogFilter data-key="OrderCatalogList" />
<OrderCatalogFilter data-key="OrderCatalogList" :tags="tags" />
</QScrollArea>
</QDrawer>
<QPage class="column items-center q-pa-md">
@ -61,6 +77,7 @@ const catalogParams = {
:limit="50"
:user-params="catalogParams"
auto-load
@on-fetch="extractTags"
>
<template #body="{ rows }">
<div class="catalog-list">

View File

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

View File

@ -5,8 +5,8 @@ import { useI18n } from 'vue-i18n';
import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'components/ui/VnLv.vue';
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({
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 v-if="entity.worker" :label="t('shelving.summary.worker')">
<template #value>
<span class="link">
{{ entity.worker?.user?.nickname }}
<WorkerDescriptorProxy :id="entity.worker?.id" />
</span>
<VnUserLink
:name="entity.worker?.user?.nickname"
:worker-id="entity.worker?.id"
/>
</template>
</VnLv>
</template>

View File

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

View File

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

View File

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

View File

@ -3,11 +3,11 @@ import { onMounted, ref, computed, onUpdated } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CardSummary from 'components/ui/CardSummary.vue';
import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import { getUrl } from 'src/composables/getUrl';
import { useRole } from 'src/composables/useRole';
import { dashIfEmpty } from 'src/filters';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
onUpdated(() => summaryRef.value.fetch());
@ -71,13 +71,10 @@ const isAdministrative = computed(() => {
<VnLv label="Alias" :value="supplier.nickname" />
<VnLv :label="t('supplier.summary.responsible')">
<template #value>
<span class="link">
{{ dashIfEmpty(supplier.worker?.user?.nickname) }}
<WorkerDescriptorProxy
v-if="supplier.worker?.user?.id"
:id="supplier.worker?.user?.id"
<VnUserLink
:name="dashIfEmpty(supplier.worker?.user?.nickname)"
:worker-id="supplier.worker?.user?.id"
/>
</span>
</template>
</VnLv>
<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 VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { useStateStore } from 'stores/useStateStore';
@ -28,11 +29,7 @@ const newSupplierForm = reactive({
</template>
<QPage>
<QToolbar class="bg-vn-dark justify-end">
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<VnSubToolbar />
<FormModel
url-create="Suppliers/newSupplier"
model="supplier"

View File

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

View File

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

View File

@ -1,118 +1,16 @@
<script setup>
import { date } from 'quasar';
import { computed } from 'vue';
import { useRouter } from 'vue-router';
import { useRoute } from 'vue-router';
import VnSms from 'src/components/ui/VnSms.vue';
import { useSession } from 'src/composables/useSession';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.vue';
const route = useRoute();
const id = route.params.id;
const router = useRouter();
const session = useSession();
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,
},
const where = {
ticketFk: id,
};
function formatNumer(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="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>
<VnSms url="clientSms" :where="where" />
</div>
</template>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,12 +2,12 @@
import { ref, onMounted, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CardSummary from 'components/ui/CardSummary.vue';
import { dashIfEmpty } from 'src/filters';
import { getUrl } from 'src/composables/getUrl';
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 CardSummary from 'components/ui/CardSummary.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const route = useRoute();
const { t } = useI18n();
@ -83,13 +83,11 @@ const filter = {
<VnLv :label="t('worker.list.email')" :value="worker.user.email" />
<VnLv :label="t('worker.summary.boss')" link>
<template #value>
<span class="link">
{{ dashIfEmpty(worker.boss?.name) }}
<WorkerDescriptorProxy
:id="worker.bossFk"
<VnUserLink
v-if="worker.boss"
:name="dashIfEmpty(worker.boss?.name)"
:worker-id="worker.bossFk"
/>
</span>
</template>
</VnLv>
<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 CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { useUserConfig } from 'src/composables/useUserConfig';
@ -122,11 +123,7 @@ onMounted(async () => {
/>
<QPage>
<QToolbar class="bg-vn-dark">
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<VnSubToolbar />
<FormModel
url-create="Workers/new"
model="worker"

View File

@ -16,6 +16,7 @@ export default {
'InvoiceInVat',
'InvoiceInDueDay',
'InvoiceInIntrastat',
'InvoiceInLog',
],
},
children: [
@ -92,6 +93,15 @@ export default {
component: () =>
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 { useUserConfig } from 'src/composables/useUserConfig';
import useNotify from 'src/composables/useNotify.js';
import { exportFile } from 'quasar';
import { useArrayData } from 'composables/useArrayData';
import useNotify from 'src/composables/useNotify.js';
import axios from 'axios';
const { notify } = useNotify();
@ -240,9 +242,10 @@ export const useInvoiceOutGlobalStore = defineStore({
throw err;
},
async getNegativeBasesCsv(from, to) {
async getNegativeBasesCsv() {
try {
const params = { from: from, to: to };
const arrayData = useArrayData('InvoiceOutNegative');
const params = arrayData.store.currentFilter;
const { data } = await axios.get('InvoiceOuts/negativeBasesCsv', {
params,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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