Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into hyervoni-branch-PR-2
gitea/salix-front/pipeline/head This commit looks good
Details
gitea/salix-front/pipeline/head This commit looks good
Details
This commit is contained in:
commit
9d3c427579
|
@ -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",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "salix-front",
|
||||
"version": "24.00.01",
|
||||
"version": "24.02.01",
|
||||
"description": "Salix frontend",
|
||||
"productName": "Salix",
|
||||
"author": "Verdnatura",
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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,16 +21,14 @@ 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) {
|
||||
} catch (error) {
|
||||
//
|
||||
}
|
||||
},
|
||||
|
@ -84,6 +83,10 @@ function logout() {
|
|||
|
||||
function copyUserToken(){
|
||||
navigator.clipboard.writeText(session.getToken());
|
||||
quasar.notify({
|
||||
type: 'positive',
|
||||
message: t('components.userPanel.copyToken'),
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -69,6 +69,10 @@ function getBreadcrumb(param) {
|
|||
> div {
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
&--last,
|
||||
&__separator {
|
||||
color: var(--vn-label);
|
||||
}
|
||||
}
|
||||
@media (max-width: $breakpoint-md) {
|
||||
.q-breadcrumbs {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<script setup>
|
||||
import { useSession } from 'src/composables/useSession';
|
||||
import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
const $props = defineProps({
|
||||
worker: { type: Number, required: true },
|
||||
description: { type: String, default: null },
|
||||
clickable: { type: Boolean, default: false },
|
||||
});
|
||||
const session = useSession();
|
||||
const token = session.getToken();
|
||||
|
@ -22,5 +24,6 @@ const token = session.getToken();
|
|||
</p>
|
||||
</slot>
|
||||
</div>
|
||||
<WorkerDescriptorProxy :v-if="$props.clickable" :id="$props.worker" />
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
<script setup>
|
||||
import { onBeforeMount } from 'vue';
|
||||
import { date } from 'quasar';
|
||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||
import VnAvatar from '../ui/VnAvatar.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>
|
||||
<VnAvatar
|
||||
class="cursor-pointer"
|
||||
:worker="row.sms.senderFk"
|
||||
:title="row.sms.sender.name"
|
||||
:clickable="true"
|
||||
/>
|
||||
</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>
|
|
@ -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>
|
|
@ -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();
|
||||
|
@ -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;
|
||||
|
|
|
@ -62,7 +62,7 @@ export default {
|
|||
selectRows: 'Select all { numberRows } row(s)',
|
||||
allRows: 'All { numberRows } row(s)',
|
||||
markAll: 'Mark all',
|
||||
noResults: 'No results'
|
||||
noResults: 'No results',
|
||||
},
|
||||
errors: {
|
||||
statusUnauthorized: 'Access denied',
|
||||
|
@ -914,6 +914,7 @@ export default {
|
|||
components: {
|
||||
topbar: {},
|
||||
userPanel: {
|
||||
copyToken: 'Token copied to clipboard',
|
||||
settings: 'Settings',
|
||||
logOut: 'Log Out',
|
||||
},
|
||||
|
|
|
@ -913,6 +913,7 @@ export default {
|
|||
components: {
|
||||
topbar: {},
|
||||
userPanel: {
|
||||
copyToken: 'Token copiado al portapapeles',
|
||||
settings: 'Configuración',
|
||||
logOut: 'Cerrar sesión',
|
||||
},
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import en from './en';
|
||||
import es from './es';
|
||||
|
||||
export const localeEquivalence = {
|
||||
'en':'en-GB'
|
||||
}
|
||||
export default {
|
||||
en: en,
|
||||
es: es,
|
||||
|
|
|
@ -282,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">
|
||||
|
@ -335,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 }}
|
||||
|
@ -417,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 {
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -54,6 +54,7 @@ const columns = computed(() => [
|
|||
optionValue: 'id',
|
||||
optionLabel: 'description',
|
||||
tabIndex: 1,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'claimResult',
|
||||
|
@ -66,6 +67,7 @@ const columns = computed(() => [
|
|||
optionValue: 'id',
|
||||
optionLabel: 'description',
|
||||
tabIndex: 2,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'claimResponsible',
|
||||
|
@ -78,6 +80,7 @@ const columns = computed(() => [
|
|||
optionValue: 'id',
|
||||
optionLabel: 'description',
|
||||
tabIndex: 3,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'worker',
|
||||
|
@ -89,6 +92,7 @@ const columns = computed(() => [
|
|||
optionValue: 'id',
|
||||
optionLabel: 'nickname',
|
||||
tabIndex: 4,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'claimRedelivery',
|
||||
|
@ -101,6 +105,7 @@ const columns = computed(() => [
|
|||
optionValue: 'id',
|
||||
optionLabel: 'description',
|
||||
tabIndex: 5,
|
||||
align: 'left',
|
||||
},
|
||||
]);
|
||||
</script>
|
||||
|
@ -158,6 +163,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 +171,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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -132,7 +132,7 @@ const developmentColumns = ref([
|
|||
{
|
||||
name: 'worker',
|
||||
label: 'claim.summary.worker',
|
||||
field: (row) => row.worker.user.nickname,
|
||||
field: (row) => row.worker?.user.nickname,
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
|
|
|
@ -38,15 +38,6 @@ function viewSummary(id) {
|
|||
},
|
||||
});
|
||||
}
|
||||
|
||||
function viewDescriptor(id) {
|
||||
quasar.dialog({
|
||||
component: CustomerDescriptorProxy,
|
||||
componentProps: {
|
||||
id,
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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"
|
||||
/>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv
|
||||
:label="t('invoiceIn.list.isBooked')"
|
||||
:value="!!row.isBooked"
|
||||
/>
|
||||
</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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -11,6 +11,7 @@ export const useNavigationStore = defineStore('navigationStore', () => {
|
|||
'claim',
|
||||
'ticket',
|
||||
'invoiceOut',
|
||||
'invoiceIn',
|
||||
'worker',
|
||||
'shelving',
|
||||
'order',
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
});
|
||||
|
|
|
@ -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`);
|
||||
});
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue