Merge branch 'dev' into 7587-addClaimedTicketRefToRefundTicket
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
commit
59ebc4ddc8
|
@ -5,7 +5,7 @@ import SkeletonDescriptor from 'components/ui/SkeletonDescriptor.vue';
|
|||
import { useArrayData } from 'composables/useArrayData';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useClipboard } from 'src/composables/useClipboard';
|
||||
import VnMoreOptions from './VnMoreOptions.vue';
|
||||
|
||||
|
@ -42,6 +42,7 @@ const $props = defineProps({
|
|||
|
||||
const state = useState();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const { copyText } = useClipboard();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
|
@ -50,6 +51,9 @@ let store;
|
|||
let entity;
|
||||
const isLoading = ref(false);
|
||||
const isSameDataKey = computed(() => $props.dataKey === route.meta.moduleName);
|
||||
const DESCRIPTOR_PROXY = 'DescriptorProxy';
|
||||
const moduleName = ref();
|
||||
const isSameModuleName = route.matched[1].meta.moduleName !== moduleName.value;
|
||||
defineExpose({ getData });
|
||||
|
||||
onBeforeMount(async () => {
|
||||
|
@ -76,15 +80,18 @@ onBeforeMount(async () => {
|
|||
);
|
||||
});
|
||||
|
||||
const routeName = computed(() => {
|
||||
const DESCRIPTOR_PROXY = 'DescriptorProxy';
|
||||
|
||||
function getName() {
|
||||
let name = $props.dataKey;
|
||||
if ($props.dataKey.includes(DESCRIPTOR_PROXY)) {
|
||||
name = name.split(DESCRIPTOR_PROXY)[0];
|
||||
}
|
||||
return `${name}Summary`;
|
||||
return name;
|
||||
}
|
||||
const routeName = computed(() => {
|
||||
let routeName = getName();
|
||||
return `${routeName}Summary`;
|
||||
});
|
||||
|
||||
async function getData() {
|
||||
store.url = $props.url;
|
||||
store.filter = $props.filter ?? {};
|
||||
|
@ -120,20 +127,35 @@ function copyIdText(id) {
|
|||
|
||||
const emit = defineEmits(['onFetch']);
|
||||
|
||||
const iconModule = computed(() => route.matched[1].meta.icon);
|
||||
const toModule = computed(() =>
|
||||
route.matched[1].path.split('/').length > 2
|
||||
? route.matched[1].redirect
|
||||
: route.matched[1].children[0].redirect,
|
||||
);
|
||||
const iconModule = computed(() => {
|
||||
moduleName.value = getName();
|
||||
if (isSameModuleName) {
|
||||
return router.options.routes[1].children.find((r) => r.name === moduleName.value)
|
||||
?.meta?.icon;
|
||||
} else {
|
||||
return route.matched[1].meta.icon;
|
||||
}
|
||||
});
|
||||
|
||||
const toModule = computed(() => {
|
||||
moduleName.value = getName();
|
||||
if (isSameModuleName) {
|
||||
return router.options.routes[1].children.find((r) => r.name === moduleName.value)
|
||||
?.children[0]?.redirect;
|
||||
} else {
|
||||
return route.matched[1].path.split('/').length > 2
|
||||
? route.matched[1].redirect
|
||||
: route.matched[1].children[0].redirect;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="descriptor">
|
||||
<template v-if="entity && !isLoading">
|
||||
<div class="header bg-primary q-pa-sm justify-between">
|
||||
<slot name="header-extra-action"
|
||||
><QBtn
|
||||
<slot name="header-extra-action">
|
||||
<QBtn
|
||||
round
|
||||
flat
|
||||
dense
|
||||
|
@ -141,13 +163,13 @@ const toModule = computed(() =>
|
|||
:icon="iconModule"
|
||||
color="white"
|
||||
class="link"
|
||||
:to="$attrs['to-module'] ?? toModule"
|
||||
:to="toModule"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('globals.goToModuleIndex') }}
|
||||
</QTooltip>
|
||||
</QBtn></slot
|
||||
>
|
||||
</QBtn>
|
||||
</slot>
|
||||
<QBtn
|
||||
@click.stop="viewSummary(entity.id, $props.summary, $props.width)"
|
||||
round
|
||||
|
@ -230,7 +252,6 @@ const toModule = computed(() =>
|
|||
</div>
|
||||
<slot name="after" />
|
||||
</template>
|
||||
<!-- Skeleton -->
|
||||
<SkeletonDescriptor v-if="!entity || isLoading" />
|
||||
</div>
|
||||
<QInnerLoading
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import VnCardBeta from 'src/components/common/VnCardBeta.vue';
|
||||
</script>
|
||||
<template>
|
||||
<VnCard data-key="Wagon" url="Wagons" />
|
||||
<VnCardBeta data-key="Wagon" url="Wagons" :descriptor="{}" />
|
||||
</template>
|
||||
|
|
|
@ -8,6 +8,7 @@ import VnTable from 'src/components/VnTable/VnTable.vue';
|
|||
import { computed, ref } from 'vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSection from 'src/components/common/VnSection.vue';
|
||||
|
||||
const quasar = useQuasar();
|
||||
const arrayData = useArrayData('WagonList');
|
||||
|
@ -15,6 +16,7 @@ const store = arrayData.store;
|
|||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const tableRef = ref();
|
||||
const dataKey = 'WagonList';
|
||||
const filter = {
|
||||
include: {
|
||||
relation: 'type',
|
||||
|
@ -75,101 +77,110 @@ function navigate(id) {
|
|||
}
|
||||
|
||||
async function remove(row) {
|
||||
try {
|
||||
await axios.delete(`Wagons/${row.id}`).then(async () => {
|
||||
quasar.notify({
|
||||
message: t('wagon.list.removeItem'),
|
||||
type: 'positive',
|
||||
});
|
||||
store.data.splice(store.data.indexOf(row), 1);
|
||||
window.location.reload();
|
||||
await axios.delete(`Wagons/${row.id}`).then(async () => {
|
||||
quasar.notify({
|
||||
message: t('wagon.list.removeItem'),
|
||||
type: 'positive',
|
||||
});
|
||||
} catch (error) {
|
||||
//
|
||||
}
|
||||
store.data.splice(store.data.indexOf(row), 1);
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="WagonList"
|
||||
url="Wagons"
|
||||
:filter="filter"
|
||||
<VnSection
|
||||
:data-key="dataKey"
|
||||
:columns="columns"
|
||||
order="id DESC"
|
||||
:column-search="false"
|
||||
:default-mode="'card'"
|
||||
:disable-option="{ table: true }"
|
||||
:create="{
|
||||
urlCreate: 'Wagons',
|
||||
title: t('Create new wagon'),
|
||||
onDataSaved: () => tableRef.reload(),
|
||||
formInitialData: {},
|
||||
prefix="card"
|
||||
:array-data-props="{
|
||||
url: 'Wagons',
|
||||
exprBuilder,
|
||||
order: 'id DESC',
|
||||
}"
|
||||
>
|
||||
<template #more-create-dialog="{ data }">
|
||||
<VnInput
|
||||
filled
|
||||
v-model="data.label"
|
||||
:label="t('wagon.create.label')"
|
||||
type="number"
|
||||
min="0"
|
||||
:rules="[(val) => !!val || t('wagon.warnings.labelNotEmpty')]"
|
||||
/>
|
||||
<VnInput
|
||||
filled
|
||||
v-model="data.plate"
|
||||
:label="t('wagon.list.plate')"
|
||||
:rules="[(val) => !!val || t('wagon.warnings.plateNotEmpty')]"
|
||||
/>
|
||||
<VnInput
|
||||
filled
|
||||
v-model="data.volume"
|
||||
:label="t('wagon.list.volume')"
|
||||
type="number"
|
||||
min="0"
|
||||
:rules="[(val) => !!val || t('wagon.warnings.volumeNotEmpty')]"
|
||||
/>
|
||||
<VnSelect
|
||||
url="WagonTypes"
|
||||
filled
|
||||
v-model="data.typeFk"
|
||||
use-input
|
||||
fill-input
|
||||
hide-selected
|
||||
input-debounce="0"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
emit-value
|
||||
map-options
|
||||
:label="t('globals.type')"
|
||||
:options="filteredWagonTypes"
|
||||
:rules="[(val) => !!val || t('wagon.warnings.typeNotEmpty')]"
|
||||
@filter="filterType"
|
||||
<template #body>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
:data-key="dataKey"
|
||||
:create="{
|
||||
urlCreate: 'Wagons',
|
||||
title: t('Create new wagon'),
|
||||
onDataSaved: () => tableRef.reload(),
|
||||
formInitialData: {},
|
||||
}"
|
||||
:filter="filter"
|
||||
:columns="columns"
|
||||
:column-search="false"
|
||||
:default-mode="'card'"
|
||||
:disable-option="{ table: true }"
|
||||
:right-search="false"
|
||||
>
|
||||
<template v-if="data.typeFk" #append>
|
||||
<QIcon
|
||||
name="cancel"
|
||||
@click.stop.prevent="data.typeFk = null"
|
||||
class="cursor-pointer"
|
||||
<template #more-create-dialog="{ data }">
|
||||
<VnInput
|
||||
filled
|
||||
v-model="data.label"
|
||||
:label="t('wagon.create.label')"
|
||||
type="number"
|
||||
min="0"
|
||||
:rules="[(val) => !!val || t('wagon.warnings.labelNotEmpty')]"
|
||||
/>
|
||||
<VnInput
|
||||
filled
|
||||
v-model="data.plate"
|
||||
:label="t('wagon.list.plate')"
|
||||
:rules="[(val) => !!val || t('wagon.warnings.plateNotEmpty')]"
|
||||
/>
|
||||
<VnInput
|
||||
filled
|
||||
v-model="data.volume"
|
||||
:label="t('wagon.list.volume')"
|
||||
type="number"
|
||||
min="0"
|
||||
:rules="[
|
||||
(val) => !!val || t('wagon.warnings.volumeNotEmpty'),
|
||||
]"
|
||||
/>
|
||||
<VnSelect
|
||||
url="WagonTypes"
|
||||
filled
|
||||
v-model="data.typeFk"
|
||||
use-input
|
||||
fill-input
|
||||
hide-selected
|
||||
input-debounce="0"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
emit-value
|
||||
map-options
|
||||
:label="t('globals.type')"
|
||||
:options="filteredWagonTypes"
|
||||
:rules="[(val) => !!val || t('wagon.warnings.typeNotEmpty')]"
|
||||
@filter="filterType"
|
||||
>
|
||||
<template v-if="data.typeFk" #append>
|
||||
<QIcon
|
||||
name="cancel"
|
||||
@click.stop.prevent="data.typeFk = null"
|
||||
class="cursor-pointer"
|
||||
/>
|
||||
</template>
|
||||
<template #no-option>
|
||||
<QItem>
|
||||
<QItemSection class="text-grey">
|
||||
{{ t('wagon.warnings.noData') }}
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</template>
|
||||
<template #no-option>
|
||||
<QItem>
|
||||
<QItemSection class="text-grey">
|
||||
{{ t('wagon.warnings.noData') }}
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</VnTable>
|
||||
</template>
|
||||
</VnTable>
|
||||
</VnSection>
|
||||
</QPage>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Create new wagon: Crear nuevo vagón
|
||||
</i18n>
|
||||
</i18n>
|
||||
|
|
|
@ -1,52 +1,60 @@
|
|||
import { RouterView } from 'vue-router';
|
||||
|
||||
const wagonCard = {
|
||||
name: 'WagonCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/Wagon/Card/WagonCard.vue'),
|
||||
redirect: { name: 'WagonEdit' },
|
||||
meta: {
|
||||
menu: ['WagonEdit'],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'edit',
|
||||
name: 'WagonEdit',
|
||||
meta: {
|
||||
title: 'wagonEdit',
|
||||
icon: 'edit',
|
||||
},
|
||||
component: () => import('src/pages/Wagon/WagonCreate.vue'),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default {
|
||||
path: '/wagon',
|
||||
name: 'Wagon',
|
||||
path: '/wagon',
|
||||
meta: {
|
||||
title: 'wagons',
|
||||
icon: 'vn:trolley',
|
||||
moduleName: 'Wagon',
|
||||
menu: ['WagonList', 'WagonTypeList', 'WagonCounter'],
|
||||
},
|
||||
component: RouterView,
|
||||
redirect: { name: 'WagonMain' },
|
||||
menus: {
|
||||
main: ['WagonList', 'WagonTypeList', 'WagonCounter', 'WagonTray'],
|
||||
card: [],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: '/wagon',
|
||||
path: '',
|
||||
name: 'WagonMain',
|
||||
component: () => import('src/components/common/VnModule.vue'),
|
||||
redirect: { name: 'WagonList' },
|
||||
redirect: { name: 'WagonIndexMain' },
|
||||
children: [
|
||||
{
|
||||
path: 'list',
|
||||
name: 'WagonList',
|
||||
meta: {
|
||||
title: 'list',
|
||||
icon: 'vn:trolley',
|
||||
},
|
||||
path: '',
|
||||
name: 'WagonIndexMain',
|
||||
redirect: { name: 'WagonList' },
|
||||
component: () => import('src/pages/Wagon/WagonList.vue'),
|
||||
},
|
||||
{
|
||||
path: 'create',
|
||||
name: 'WagonCreate',
|
||||
meta: {
|
||||
title: 'wagonCreate',
|
||||
icon: 'create',
|
||||
},
|
||||
component: () => import('src/pages/Wagon/WagonCreate.vue'),
|
||||
},
|
||||
{
|
||||
path: ':id/edit',
|
||||
name: 'WagonEdit',
|
||||
meta: {
|
||||
title: 'wagonEdit',
|
||||
icon: 'edit',
|
||||
},
|
||||
component: () => import('src/pages/Wagon/WagonCreate.vue'),
|
||||
children: [
|
||||
{
|
||||
name: 'WagonList',
|
||||
path: 'list',
|
||||
meta: {
|
||||
title: 'list',
|
||||
icon: 'view_list',
|
||||
},
|
||||
},
|
||||
wagonCard,
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'counter',
|
||||
|
@ -57,40 +65,32 @@ export default {
|
|||
},
|
||||
component: () => import('src/pages/Wagon/WagonCounter.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/wagon/type',
|
||||
name: 'WagonTypeMain',
|
||||
component: () => import('src/components/common/VnModule.vue'),
|
||||
redirect: { name: 'WagonTypeList' },
|
||||
children: [
|
||||
{
|
||||
path: 'list',
|
||||
name: 'WagonTypeList',
|
||||
meta: {
|
||||
title: 'typesList',
|
||||
icon: 'view_list',
|
||||
},
|
||||
component: () => import('src/pages/Wagon/Type/WagonTypeList.vue'),
|
||||
},
|
||||
{
|
||||
path: 'create',
|
||||
name: 'WagonTypeCreate',
|
||||
meta: {
|
||||
title: 'typeCreate',
|
||||
icon: 'create',
|
||||
},
|
||||
component: () => import('src/pages/Wagon/Type/WagonTypeList.vue'),
|
||||
},
|
||||
{
|
||||
path: ':id/edit',
|
||||
name: 'WagonTypeEdit',
|
||||
meta: {
|
||||
title: 'typeEdit',
|
||||
icon: 'edit',
|
||||
},
|
||||
component: () => import('src/pages/Wagon/Type/WagonTypeEdit.vue'),
|
||||
path: 'type',
|
||||
name: 'WagonTypeMain',
|
||||
redirect: { name: 'WagonTypeList' },
|
||||
children: [
|
||||
{
|
||||
path: 'list',
|
||||
name: 'WagonTypeList',
|
||||
meta: {
|
||||
title: 'typesList',
|
||||
icon: 'view_list',
|
||||
},
|
||||
component: () =>
|
||||
import('src/pages/Wagon/Type/WagonTypeList.vue'),
|
||||
},
|
||||
{
|
||||
path: ':id/edit',
|
||||
name: 'WagonTypeEdit',
|
||||
meta: {
|
||||
title: 'typeEdit',
|
||||
icon: 'edit',
|
||||
},
|
||||
component: () =>
|
||||
import('src/pages/Wagon/Type/WagonTypeEdit.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
describe('Route extended list', () => {
|
||||
describe.skip('Route extended list', () => {
|
||||
const getSelector = (colField) => `tr:last-child > [data-col-field="${colField}"]`;
|
||||
|
||||
const selectors = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
describe.skip('WagonCreate', () => {
|
||||
describe('WagonCreate', () => {
|
||||
beforeEach(() => {
|
||||
cy.viewport(1280, 720);
|
||||
cy.login('developer');
|
||||
|
@ -17,7 +17,7 @@ describe.skip('WagonCreate', () => {
|
|||
'.grid-create > [label="Volume"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Volume_input"]',
|
||||
).type('100');
|
||||
cy.selectOption('[data-cy="Type_select"]', '1');
|
||||
|
||||
cy.dataCy('FormModelPopup_save').click();
|
||||
cy.get('[title="Remove"] > .q-btn__content > .q-icon').first().click();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@ describe('WagonTypeCreate', () => {
|
|||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
cy.visit('/#/wagon/type/create');
|
||||
cy.visit('/#/wagon/type/list');
|
||||
cy.waitForElement('.q-page', 6000);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue