forked from verdnatura/salix-front
TravelSummary improvements
This commit is contained in:
parent
cbd8af7fae
commit
91cd4c35e8
|
@ -6,6 +6,7 @@ import { useI18n } from 'vue-i18n';
|
||||||
import { QCheckbox, QIcon } from 'quasar';
|
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 EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
|
||||||
|
|
||||||
import travelService from 'src/services/travel.service';
|
import travelService from 'src/services/travel.service';
|
||||||
import { toDate, toCurrency } from 'src/filters';
|
import { toDate, toCurrency } from 'src/filters';
|
||||||
|
@ -55,60 +56,6 @@ const headerMenuOptions = [
|
||||||
{ name: t('travel.summary.AddEntry'), action: null },
|
{ name: t('travel.summary.AddEntry'), action: null },
|
||||||
];
|
];
|
||||||
|
|
||||||
const tableColumnComponents = {
|
|
||||||
isConfirmed: {
|
|
||||||
component: () => QCheckbox,
|
|
||||||
props: (prop) => ({
|
|
||||||
disable: true,
|
|
||||||
'model-value': Boolean(prop.value),
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
id: {
|
|
||||||
component: () => 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => openEntryDescriptor(),
|
|
||||||
},
|
|
||||||
supplierName: {
|
|
||||||
component: () => 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
reference: {
|
|
||||||
component: () => 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
freightValue: {
|
|
||||||
component: () => 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
packageValue: {
|
|
||||||
component: () => 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
cc: {
|
|
||||||
component: () => 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
pallet: {
|
|
||||||
component: () => 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
m3: {
|
|
||||||
component: () => 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
observation: {
|
|
||||||
component: (props) => (props.value ? QIcon : null),
|
|
||||||
props: () => ({ name: 'insert_drive_file', color: 'primary', size: '25px' }),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const entriesTableColumns = computed(() => {
|
const entriesTableColumns = computed(() => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
@ -182,8 +129,6 @@ async function setTravelData(data) {
|
||||||
const redirectToCreateView = (queryParams) => {
|
const redirectToCreateView = (queryParams) => {
|
||||||
router.push({ name: 'TravelCreate', query: { travelData: queryParams } });
|
router.push({ name: 'TravelCreate', query: { travelData: queryParams } });
|
||||||
};
|
};
|
||||||
|
|
||||||
const openEntryDescriptor = () => {};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -269,31 +214,31 @@ const openEntryDescriptor = () => {};
|
||||||
row-key="id"
|
row-key="id"
|
||||||
class="full-width q-mt-md"
|
class="full-width q-mt-md"
|
||||||
>
|
>
|
||||||
<template #body-cell="props">
|
<template #body-cell-isConfirmed="{ row }">
|
||||||
<QTd :props="props">
|
<QTd auto-width>
|
||||||
<component
|
<QIcon
|
||||||
:is="
|
:name="row.isConfirmed ? 'check' : 'close'"
|
||||||
tableColumnComponents[props.col.name].component(props)
|
:color="row.isConfirmed ? 'positive' : 'negative'"
|
||||||
"
|
size="sm"
|
||||||
v-bind="
|
/>
|
||||||
tableColumnComponents[props.col.name].props(props)
|
</QTd>
|
||||||
"
|
</template>
|
||||||
@click="
|
<template #body-cell-id="{ row }">
|
||||||
tableColumnComponents[props.col.name].event(props)
|
<QTd auto-width>
|
||||||
"
|
<QBtn flat color="blue">
|
||||||
class="col-content"
|
{{ row.id }}
|
||||||
>
|
<EntryDescriptorProxy :id="row.id" />
|
||||||
<template
|
</QBtn>
|
||||||
v-if="
|
</QTd>
|
||||||
props.col.name !== 'observation' &&
|
</template>
|
||||||
props.col.name !== 'isConfirmed'
|
<template #body-cell-observation="{ row }">
|
||||||
"
|
<QTd auto-width>
|
||||||
>{{ props.value }}</template
|
<QIcon
|
||||||
>
|
v-if="row.observation"
|
||||||
<QTooltip v-if="props.col.toolTip">{{
|
name="insert_drive_file"
|
||||||
props.col.toolTip
|
color="primary"
|
||||||
}}</QTooltip>
|
size="sm"
|
||||||
</component>
|
/>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { reactive, ref, onBeforeMount } from 'vue';
|
import { reactive, ref, onBeforeMount } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||||
|
@ -13,6 +13,7 @@ import { toDate } from 'src/filters';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
const newTravelForm = reactive({
|
const newTravelForm = reactive({
|
||||||
ref: null,
|
ref: null,
|
||||||
|
@ -43,6 +44,10 @@ onBeforeMount(() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const redirectToTravelBasicData = (_, { id }) => {
|
||||||
|
router.push({ name: 'TravelBasicData', params: { id } });
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -63,6 +68,7 @@ onBeforeMount(() => {
|
||||||
model="travel"
|
model="travel"
|
||||||
:form-initial-data="newTravelForm"
|
:form-initial-data="newTravelForm"
|
||||||
:observe-form-changes="viewAction === 'create'"
|
:observe-form-changes="viewAction === 'create'"
|
||||||
|
@on-data-saved="redirectToTravelBasicData"
|
||||||
>
|
>
|
||||||
<template #form="{ data }">
|
<template #form="{ data }">
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
|
|
Loading…
Reference in New Issue