forked from verdnatura/salix-front
Merge pull request '8322-Wagon' (!1569) from 8322-Wagon into dev
Reviewed-on: verdnatura/salix-front#1569
This commit is contained in:
commit
1f6667fbce
|
@ -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,7 +77,6 @@ function navigate(id) {
|
|||
}
|
||||
|
||||
async function remove(row) {
|
||||
try {
|
||||
await axios.delete(`Wagons/${row.id}`).then(async () => {
|
||||
quasar.notify({
|
||||
message: t('wagon.list.removeItem'),
|
||||
|
@ -84,30 +85,36 @@ async function remove(row) {
|
|||
store.data.splice(store.data.indexOf(row), 1);
|
||||
window.location.reload();
|
||||
});
|
||||
} catch (error) {
|
||||
//
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<VnSection
|
||||
:data-key="dataKey"
|
||||
:columns="columns"
|
||||
prefix="card"
|
||||
:array-data-props="{
|
||||
url: 'Wagons',
|
||||
exprBuilder,
|
||||
order: 'id DESC',
|
||||
}"
|
||||
>
|
||||
<template #body>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="WagonList"
|
||||
url="Wagons"
|
||||
:filter="filter"
|
||||
:columns="columns"
|
||||
order="id DESC"
|
||||
:column-search="false"
|
||||
:default-mode="'card'"
|
||||
:disable-option="{ table: true }"
|
||||
: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 #more-create-dialog="{ data }">
|
||||
<VnInput
|
||||
|
@ -130,7 +137,9 @@ async function remove(row) {
|
|||
:label="t('wagon.list.volume')"
|
||||
type="number"
|
||||
min="0"
|
||||
:rules="[(val) => !!val || t('wagon.warnings.volumeNotEmpty')]"
|
||||
:rules="[
|
||||
(val) => !!val || t('wagon.warnings.volumeNotEmpty'),
|
||||
]"
|
||||
/>
|
||||
<VnSelect
|
||||
url="WagonTypes"
|
||||
|
@ -166,6 +175,8 @@ async function remove(row) {
|
|||
</VnSelect>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
</VnSection>
|
||||
</QPage>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -1,46 +1,16 @@
|
|||
import { RouterView } from 'vue-router';
|
||||
|
||||
export default {
|
||||
path: '/wagon',
|
||||
name: 'Wagon',
|
||||
const wagonCard = {
|
||||
name: 'WagonCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/Wagon/Card/WagonCard.vue'),
|
||||
redirect: { name: 'WagonEdit' },
|
||||
meta: {
|
||||
title: 'wagons',
|
||||
icon: 'vn:trolley',
|
||||
moduleName: 'Wagon',
|
||||
},
|
||||
component: RouterView,
|
||||
redirect: { name: 'WagonMain' },
|
||||
menus: {
|
||||
main: ['WagonList', 'WagonTypeList', 'WagonCounter', 'WagonTray'],
|
||||
card: [],
|
||||
menu: ['WagonEdit'],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: '/wagon',
|
||||
name: 'WagonMain',
|
||||
component: () => import('src/components/common/VnModule.vue'),
|
||||
redirect: { name: 'WagonList' },
|
||||
children: [
|
||||
{
|
||||
path: 'list',
|
||||
name: 'WagonList',
|
||||
meta: {
|
||||
title: 'list',
|
||||
icon: 'vn:trolley',
|
||||
},
|
||||
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',
|
||||
path: 'edit',
|
||||
name: 'WagonEdit',
|
||||
meta: {
|
||||
title: 'wagonEdit',
|
||||
|
@ -48,6 +18,44 @@ export default {
|
|||
},
|
||||
component: () => import('src/pages/Wagon/WagonCreate.vue'),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default {
|
||||
name: 'Wagon',
|
||||
path: '/wagon',
|
||||
meta: {
|
||||
title: 'wagons',
|
||||
icon: 'vn:trolley',
|
||||
moduleName: 'Wagon',
|
||||
menu: ['WagonList', 'WagonTypeList', 'WagonCounter'],
|
||||
},
|
||||
component: RouterView,
|
||||
redirect: { name: 'WagonMain' },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: 'WagonMain',
|
||||
component: () => import('src/components/common/VnModule.vue'),
|
||||
redirect: { name: 'WagonIndexMain' },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: 'WagonIndexMain',
|
||||
redirect: { name: 'WagonList' },
|
||||
component: () => import('src/pages/Wagon/WagonList.vue'),
|
||||
children: [
|
||||
{
|
||||
name: 'WagonList',
|
||||
path: 'list',
|
||||
meta: {
|
||||
title: 'list',
|
||||
icon: 'view_list',
|
||||
},
|
||||
},
|
||||
wagonCard,
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'counter',
|
||||
name: 'WagonCounter',
|
||||
|
@ -57,12 +65,9 @@ export default {
|
|||
},
|
||||
component: () => import('src/pages/Wagon/WagonCounter.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/wagon/type',
|
||||
path: 'type',
|
||||
name: 'WagonTypeMain',
|
||||
component: () => import('src/components/common/VnModule.vue'),
|
||||
redirect: { name: 'WagonTypeList' },
|
||||
children: [
|
||||
{
|
||||
|
@ -72,16 +77,8 @@ export default {
|
|||
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'),
|
||||
component: () =>
|
||||
import('src/pages/Wagon/Type/WagonTypeList.vue'),
|
||||
},
|
||||
{
|
||||
path: ':id/edit',
|
||||
|
@ -90,7 +87,10 @@ export default {
|
|||
title: 'typeEdit',
|
||||
icon: 'edit',
|
||||
},
|
||||
component: () => import('src/pages/Wagon/Type/WagonTypeEdit.vue'),
|
||||
component: () =>
|
||||
import('src/pages/Wagon/Type/WagonTypeEdit.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -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