forked from verdnatura/salix-front
create entries basic structure and add create entry and clone travel with entries feature to travel list and travel summary
This commit is contained in:
parent
8b24ac9fe4
commit
113df44705
|
@ -207,6 +207,18 @@ export default {
|
||||||
contactChannel: 'Contact channel',
|
contactChannel: 'Contact channel',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
entry: {
|
||||||
|
pageTitles: {
|
||||||
|
entries: 'Entries',
|
||||||
|
list: 'List',
|
||||||
|
createEntry: 'New entry',
|
||||||
|
summary: 'Summary',
|
||||||
|
create: 'Create',
|
||||||
|
},
|
||||||
|
list: {
|
||||||
|
newEntry: 'New entry',
|
||||||
|
},
|
||||||
|
},
|
||||||
ticket: {
|
ticket: {
|
||||||
pageTitles: {
|
pageTitles: {
|
||||||
tickets: 'Tickets',
|
tickets: 'Tickets',
|
||||||
|
|
|
@ -206,6 +206,17 @@ export default {
|
||||||
contactChannel: 'Canal de contacto',
|
contactChannel: 'Canal de contacto',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
entry: {
|
||||||
|
pageTitles: {
|
||||||
|
entries: 'Entradas',
|
||||||
|
list: 'Listado',
|
||||||
|
summary: 'Resumen',
|
||||||
|
create: 'Crear',
|
||||||
|
},
|
||||||
|
list: {
|
||||||
|
newEntry: 'Nueva entrada',
|
||||||
|
},
|
||||||
|
},
|
||||||
ticket: {
|
ticket: {
|
||||||
pageTitles: {
|
pageTitles: {
|
||||||
tickets: 'Tickets',
|
tickets: 'Tickets',
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<script setup>
|
||||||
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
import LeftMenu from 'components/LeftMenu.vue';
|
||||||
|
|
||||||
|
const stateStore = useStateStore();
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<!-- Entry searchbar -->
|
||||||
|
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||||
|
<QScrollArea class="fit">
|
||||||
|
<!-- EntryDescriptor -->
|
||||||
|
<QSeparator />
|
||||||
|
<LeftMenu source="card" />
|
||||||
|
</QScrollArea>
|
||||||
|
</QDrawer>
|
||||||
|
<QPageContainer>
|
||||||
|
<QPage>
|
||||||
|
<QToolbar class="bg-vn-dark justify-end">
|
||||||
|
<div id="st-data"></div>
|
||||||
|
<QSpace />
|
||||||
|
<div id="st-actions"></div>
|
||||||
|
</QToolbar>
|
||||||
|
<div class="q-pa-md"><RouterView></RouterView></div>
|
||||||
|
</QPage>
|
||||||
|
</QPageContainer>
|
||||||
|
</template>
|
|
@ -0,0 +1,135 @@
|
||||||
|
<script setup>
|
||||||
|
import { reactive, ref } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
|
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 { toDate } from 'src/filters';
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const route = useRoute();
|
||||||
|
|
||||||
|
const newEntryForm = reactive({
|
||||||
|
supplierFk: null,
|
||||||
|
travelFk: route.query?.travelFk || null,
|
||||||
|
companyFk: null,
|
||||||
|
});
|
||||||
|
|
||||||
|
const suppliersOptions = ref([]);
|
||||||
|
const travelsOptionsOptions = ref([]);
|
||||||
|
const companiesOptions = ref([]);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<FetchData
|
||||||
|
url="Suppliers"
|
||||||
|
:filter="{ fields: ['id', 'nickname'] }"
|
||||||
|
order="nickname"
|
||||||
|
@on-fetch="(data) => (suppliersOptions = data)"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
|
<FetchData
|
||||||
|
url="Travels/filter"
|
||||||
|
:filter="{ fields: ['id', 'warehouseInName'] }"
|
||||||
|
order="id"
|
||||||
|
@on-fetch="(data) => (travelsOptionsOptions = data)"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
|
<FetchData
|
||||||
|
ref="companiesRef"
|
||||||
|
url="Companies"
|
||||||
|
:filter="{ fields: ['id', 'code'] }"
|
||||||
|
order="code"
|
||||||
|
@on-fetch="(data) => (companiesOptions = data)"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- Agregar searchbar de entries -->
|
||||||
|
|
||||||
|
<QPage>
|
||||||
|
<QToolbar class="bg-vn-dark justify-end">
|
||||||
|
<div id="st-data"></div>
|
||||||
|
<QSpace />
|
||||||
|
<div id="st-actions"></div>
|
||||||
|
</QToolbar>
|
||||||
|
<FormModel url-create="Entries" model="entry" :form-initial-data="newEntryForm">
|
||||||
|
<template #form="{ data, validate }">
|
||||||
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
|
<VnSelectFilter
|
||||||
|
:label="t('Supplier *')"
|
||||||
|
class="full-width"
|
||||||
|
v-model="data.supplierFk"
|
||||||
|
:options="suppliersOptions"
|
||||||
|
option-value="id"
|
||||||
|
option-label="nickname"
|
||||||
|
hide-selected
|
||||||
|
:rules="validate('entry.supplierFk')"
|
||||||
|
>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>{{ scope.opt?.nickname }}</QItemLabel>
|
||||||
|
<QItemLabel caption>
|
||||||
|
#{{ scope.opt?.id }}
|
||||||
|
</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelectFilter>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
|
<VnSelectFilter
|
||||||
|
:label="t('Travel *')"
|
||||||
|
class="full-width"
|
||||||
|
v-model="data.travelFk"
|
||||||
|
:options="travelsOptionsOptions"
|
||||||
|
option-value="id"
|
||||||
|
option-label="warehouseInName"
|
||||||
|
map-options
|
||||||
|
hide-selected
|
||||||
|
:rules="validate('entry.travelFk')"
|
||||||
|
>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel
|
||||||
|
>{{ scope.opt?.agencyModeName }} -
|
||||||
|
{{ scope.opt?.warehouseInName }} ({{
|
||||||
|
toDate(scope.opt?.shipped)
|
||||||
|
}}) → {{ scope.opt?.warehouseOutName }} ({{
|
||||||
|
toDate(scope.opt?.landed)
|
||||||
|
}})</QItemLabel
|
||||||
|
>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelectFilter>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
|
<VnSelectFilter
|
||||||
|
:label="t('Company *')"
|
||||||
|
class="full-width"
|
||||||
|
v-model="data.companyFk"
|
||||||
|
:options="companiesOptions"
|
||||||
|
option-value="id"
|
||||||
|
option-label="code"
|
||||||
|
map-options
|
||||||
|
hide-selected
|
||||||
|
:rules="validate('entry.companyFk')"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
</template>
|
||||||
|
</FormModel>
|
||||||
|
</QPage>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Supplier *: Proveedor *
|
||||||
|
Travel *: Envío *
|
||||||
|
Company *: Empresa *
|
||||||
|
</i18n>
|
|
@ -0,0 +1,22 @@
|
||||||
|
<script setup>
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const redirectToCreateView = () => {
|
||||||
|
router.push({ name: 'EntryCreate' });
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<QPage class="column items-center q-pa-md">
|
||||||
|
<QPageSticky :offset="[20, 20]">
|
||||||
|
<QBtn fab icon="add" color="primary" @click="redirectToCreateView()" />
|
||||||
|
<QTooltip>
|
||||||
|
{{ t('entry.list.newEntry') }}
|
||||||
|
</QTooltip>
|
||||||
|
</QPageSticky>
|
||||||
|
</QPage>
|
||||||
|
</template>
|
|
@ -0,0 +1,17 @@
|
||||||
|
<script setup>
|
||||||
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
import LeftMenu from 'src/components/LeftMenu.vue';
|
||||||
|
|
||||||
|
const stateStore = useStateStore();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||||
|
<QScrollArea class="fit text-grey-8">
|
||||||
|
<LeftMenu />
|
||||||
|
</QScrollArea>
|
||||||
|
</QDrawer>
|
||||||
|
<QPageContainer>
|
||||||
|
<RouterView></RouterView>
|
||||||
|
</QPageContainer>
|
||||||
|
</template>
|
|
@ -51,13 +51,3 @@ const newSupplierForm = reactive({
|
||||||
</FormModel>
|
</FormModel>
|
||||||
</QPage>
|
</QPage>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.card {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
width: 100%;
|
|
||||||
background-color: var(--vn-dark);
|
|
||||||
padding: 40px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -2,15 +2,17 @@
|
||||||
import { onMounted, ref, computed, onUpdated } from 'vue';
|
import { onMounted, ref, computed, onUpdated } from 'vue';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
import { QCheckbox, QIcon } from 'quasar';
|
||||||
import CardSummary from 'components/ui/CardSummary.vue';
|
import CardSummary from 'components/ui/CardSummary.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import { getUrl } from 'src/composables/getUrl';
|
|
||||||
import { toDate } from 'src/filters';
|
|
||||||
import travelService from 'src/services/travel.service';
|
|
||||||
import { QCheckbox, QIcon } from 'quasar';
|
|
||||||
import { toCurrency } from 'filters/index';
|
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
|
|
||||||
|
import travelService from 'src/services/travel.service';
|
||||||
|
import { toDate, toCurrency } from 'src/filters';
|
||||||
|
import { getUrl } from 'src/composables/getUrl';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
onUpdated(() => summaryRef.value.fetch());
|
onUpdated(() => summaryRef.value.fetch());
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -40,9 +42,17 @@ const cloneTravel = () => {
|
||||||
redirectToCreateView(stringifiedTravelData);
|
redirectToCreateView(stringifiedTravelData);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const cloneTravelWithEntries = () => {
|
||||||
|
try {
|
||||||
|
axios.post(`Travels/${$props.id}/cloneWithEntries`);
|
||||||
|
} catch (err) {
|
||||||
|
console.err('Error cloning travel with entries');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const headerMenuOptions = [
|
const headerMenuOptions = [
|
||||||
{ name: t('travel.summary.cloneShipping'), action: cloneTravel },
|
{ name: t('travel.summary.cloneShipping'), action: cloneTravel },
|
||||||
{ name: t('travel.summary.CloneTravelAndEntries'), action: null },
|
{ name: t('travel.summary.CloneTravelAndEntries'), action: cloneTravelWithEntries },
|
||||||
{ name: t('travel.summary.AddEntry'), action: null },
|
{ name: t('travel.summary.AddEntry'), action: null },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,10 @@ const redirectToCreateView = (queryParams) => {
|
||||||
router.push({ name: 'TravelCreate', query: { travelData: queryParams } });
|
router.push({ name: 'TravelCreate', query: { travelData: queryParams } });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const redirectCreateEntryView = (travelData) => {
|
||||||
|
router.push({ name: 'EntryCreate', query: { travelFk: travelData.id } });
|
||||||
|
};
|
||||||
|
|
||||||
const viewSummary = (id) => {
|
const viewSummary = (id) => {
|
||||||
quasar.dialog({
|
quasar.dialog({
|
||||||
component: TravelSummaryDialog,
|
component: TravelSummaryDialog,
|
||||||
|
@ -103,7 +107,7 @@ onMounted(async () => {
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
:label="t('addEntry')"
|
:label="t('addEntry')"
|
||||||
@click.stop="viewSummary(row.id)"
|
@click.stop="redirectCreateEntryView(row)"
|
||||||
class="bg-vn-dark"
|
class="bg-vn-dark"
|
||||||
outline
|
outline
|
||||||
style="margin-top: 15px"
|
style="margin-top: 15px"
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
import { RouterView } from 'vue-router';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
path: '/entry',
|
||||||
|
name: 'Entry',
|
||||||
|
meta: {
|
||||||
|
title: 'entries',
|
||||||
|
icon: 'vn:entry',
|
||||||
|
},
|
||||||
|
component: RouterView,
|
||||||
|
redirect: { name: 'EntryMain' },
|
||||||
|
menus: {
|
||||||
|
main: ['EntryList'],
|
||||||
|
card: [],
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
name: 'EntryMain',
|
||||||
|
component: () => import('src/pages/Entry/EntryMain.vue'),
|
||||||
|
redirect: { name: 'EntryList' },
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'list',
|
||||||
|
name: 'EntryList',
|
||||||
|
meta: {
|
||||||
|
title: 'list',
|
||||||
|
icon: 'view_list',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Entry/EntryList.vue'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'create',
|
||||||
|
name: 'EntryCreate',
|
||||||
|
meta: {
|
||||||
|
title: 'create',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Entry/EntryCreate.vue'),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// name: 'EntryCard',
|
||||||
|
// path: ':id',
|
||||||
|
// component: () => import('src/pages/Entry/Card/EntryCard.vue'),
|
||||||
|
// redirect: { name: 'EntrySummary' },
|
||||||
|
// children: [
|
||||||
|
// {
|
||||||
|
// name: 'EntrySummary',
|
||||||
|
// path: 'summary',
|
||||||
|
// meta: {
|
||||||
|
// title: 'summary',
|
||||||
|
// icon: 'launch',
|
||||||
|
// },
|
||||||
|
// component: () =>
|
||||||
|
// import('src/pages/Entry/Card/EntrySummary.vue'),
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// },
|
||||||
|
],
|
||||||
|
};
|
|
@ -11,6 +11,7 @@ import Supplier from './Supplier';
|
||||||
import Travel from './travel';
|
import Travel from './travel';
|
||||||
import Order from './order';
|
import Order from './order';
|
||||||
import Department from './department';
|
import Department from './department';
|
||||||
|
import Entry from './entry';
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
Customer,
|
Customer,
|
||||||
|
@ -26,4 +27,5 @@ export default [
|
||||||
Order,
|
Order,
|
||||||
invoiceIn,
|
invoiceIn,
|
||||||
Department,
|
Department,
|
||||||
|
Entry,
|
||||||
];
|
];
|
||||||
|
|
|
@ -11,6 +11,7 @@ import travel from './modules/travel';
|
||||||
import department from './modules/department';
|
import department from './modules/department';
|
||||||
import shelving from 'src/router/modules/shelving';
|
import shelving from 'src/router/modules/shelving';
|
||||||
import order from 'src/router/modules/order';
|
import order from 'src/router/modules/order';
|
||||||
|
import entry from 'src/router/modules/entry';
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
|
@ -63,6 +64,7 @@ const routes = [
|
||||||
supplier,
|
supplier,
|
||||||
travel,
|
travel,
|
||||||
department,
|
department,
|
||||||
|
entry,
|
||||||
{
|
{
|
||||||
path: '/:catchAll(.*)*',
|
path: '/:catchAll(.*)*',
|
||||||
name: 'NotFound',
|
name: 'NotFound',
|
||||||
|
|
|
@ -19,6 +19,7 @@ export const useNavigationStore = defineStore('navigationStore', () => {
|
||||||
'supplier',
|
'supplier',
|
||||||
'travel',
|
'travel',
|
||||||
'invoiceIn',
|
'invoiceIn',
|
||||||
|
'entry',
|
||||||
];
|
];
|
||||||
const pinnedModules = ref([]);
|
const pinnedModules = ref([]);
|
||||||
const role = useRole();
|
const role = useRole();
|
||||||
|
|
Loading…
Reference in New Issue