forked from verdnatura/salix-front
feat: refs #6321 update
This commit is contained in:
parent
d0eb1d97ac
commit
7da3f132ea
|
@ -29,8 +29,16 @@ module.exports = configure(function (/* ctx */) {
|
||||||
// app boot file (/src/boot)
|
// app boot file (/src/boot)
|
||||||
// --> boot files are part of "main.js"
|
// --> boot files are part of "main.js"
|
||||||
// https://v2.quasar.dev/quasar-cli/boot-files
|
// https://v2.quasar.dev/quasar-cli/boot-files
|
||||||
boot: ['i18n', 'axios', 'vnDate', 'validations', 'quasar', 'quasar.defaults'],
|
boot: [
|
||||||
|
'i18n',
|
||||||
|
'axios',
|
||||||
|
'vnDate',
|
||||||
|
'validations',
|
||||||
|
'quasar',
|
||||||
|
'quasar.defaults',
|
||||||
|
'global-components',
|
||||||
|
],
|
||||||
|
importStrategy: 'auto',
|
||||||
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#css
|
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#css
|
||||||
css: ['app.scss'],
|
css: ['app.scss'],
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
// src/boot/global-components.js
|
||||||
|
import { defineAsyncComponent } from 'vue';
|
||||||
|
|
||||||
|
const components = import.meta.glob('src/components/**/*.vue');
|
||||||
|
export default ({ app }) => {
|
||||||
|
for (const path in components) {
|
||||||
|
const componentName = path
|
||||||
|
.split('/')
|
||||||
|
.pop()
|
||||||
|
.replace(/\.\w+$/, '');
|
||||||
|
app.component(componentName, defineAsyncComponent(components[path]));
|
||||||
|
}
|
||||||
|
};
|
|
@ -17,8 +17,12 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const valueClass = computed(() => (props.value > 0 ? 'positive' : 'negative'));
|
const valueClass = computed(() =>
|
||||||
const iconName = computed(() => (props.value > 0 ? 'arrow_upward' : 'arrow_downward'));
|
props.value === 0 ? 'neutral' : props.value > 0 ? 'positive' : 'negative'
|
||||||
|
);
|
||||||
|
const iconName = computed(() =>
|
||||||
|
props.value === 0 ? 'equal' : props.value > 0 ? 'arrow_upward' : 'arrow_downward'
|
||||||
|
);
|
||||||
const formattedValue = computed(() => props.value);
|
const formattedValue = computed(() => props.value);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -29,6 +33,9 @@ const formattedValue = computed(() => props.value);
|
||||||
.negative {
|
.negative {
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
.neutral {
|
||||||
|
color: orange;
|
||||||
|
}
|
||||||
.value-icon {
|
.value-icon {
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,11 +23,6 @@ const gradientStyle = (value) =>
|
||||||
)}, ${colorSpacer} 10%)`;
|
)}, ${colorSpacer} 10%)`;
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
item: {
|
|
||||||
type: Object,
|
|
||||||
required: true,
|
|
||||||
default: () => {},
|
|
||||||
},
|
|
||||||
itemLack: {
|
itemLack: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
|
@ -38,7 +33,7 @@ const $props = defineProps({
|
||||||
required: false,
|
required: false,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
tickets: {
|
sales: {
|
||||||
type: Array,
|
type: Array,
|
||||||
required: false,
|
required: false,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
|
@ -47,15 +42,19 @@ const $props = defineProps({
|
||||||
const proposalSelected = ref([]);
|
const proposalSelected = ref([]);
|
||||||
const quantity = ref(-1);
|
const quantity = ref(-1);
|
||||||
const defaultColumnAttrs = {
|
const defaultColumnAttrs = {
|
||||||
align: 'left',
|
align: 'center',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
};
|
};
|
||||||
const ticket = computed(() => $props.tickets[0]);
|
const ticket = computed(() => $props.sales[0]);
|
||||||
const saleFk = computed(() => ticket.value.saleFk);
|
const saleFk = computed(() => ticket.value.saleFk);
|
||||||
const statusConditionalValue = (row) => {
|
const statusConditionalValue = (row) => {
|
||||||
const total = MATCH_VALUES.reduce((acc, i) => acc + row[`match${i}`], 0);
|
const total = MATCH_VALUES.reduce((acc, i) => acc + row[`match${i}`], 0);
|
||||||
return total;
|
return total;
|
||||||
};
|
};
|
||||||
|
const popupProxyRef = ref(null);
|
||||||
|
const proposalTableRef = ref(null);
|
||||||
|
const emit = defineEmits(['onDialogClosed', 'itemReplaced']);
|
||||||
|
|
||||||
const conditionalValuePrice = (price) => (price > 1.3 ? 'match' : 'not-match');
|
const conditionalValuePrice = (price) => (price > 1.3 ? 'match' : 'not-match');
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
|
@ -63,18 +62,13 @@ const columns = computed(() => [
|
||||||
label: t('proposal.available'),
|
label: t('proposal.available'),
|
||||||
name: 'available',
|
name: 'available',
|
||||||
field: 'available',
|
field: 'available',
|
||||||
component: 'input',
|
|
||||||
type: 'number',
|
type: 'number',
|
||||||
class: 'shrink',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
label: t('proposal.difference'),
|
label: t('proposal.difference'),
|
||||||
name: 'difference',
|
name: 'difference',
|
||||||
component: 'input',
|
style: 'max-width: 75px',
|
||||||
type: 'number',
|
|
||||||
class: 'shrink',
|
|
||||||
style: 'background-color:red;max-width: 75px',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
|
@ -88,9 +82,6 @@ const columns = computed(() => [
|
||||||
label: t('proposal.counter'),
|
label: t('proposal.counter'),
|
||||||
name: 'counter',
|
name: 'counter',
|
||||||
field: 'counter',
|
field: 'counter',
|
||||||
component: 'input',
|
|
||||||
type: 'number',
|
|
||||||
class: 'shrink',
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -107,9 +98,6 @@ const columns = computed(() => [
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
label: t('proposal.price2'),
|
label: t('proposal.price2'),
|
||||||
name: 'price2',
|
name: 'price2',
|
||||||
field: 'price2',
|
|
||||||
component: 'input',
|
|
||||||
type: 'number',
|
|
||||||
class: 'shrink',
|
class: 'shrink',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -131,12 +119,18 @@ const columns = computed(() => [
|
||||||
|
|
||||||
async function confirm() {
|
async function confirm() {
|
||||||
try {
|
try {
|
||||||
const params = {
|
// const params = {
|
||||||
saleFk: saleFk.value,
|
// saleFk: saleFk.value,
|
||||||
newItemFK: proposalSelected.value[0].id,
|
// substitutionFk: proposalSelected.value[0].id,
|
||||||
quantity: quantity.value,
|
// quantity: quantity.value,
|
||||||
};
|
// };
|
||||||
// const { data } = await axios.post('Sales/replaceItem', params);
|
// const { data } = await axios.post('Sales/replaceItem', params);
|
||||||
|
const params = [saleFk.value, proposalSelected.value[0].id, quantity.value];
|
||||||
|
const { data } = await axios.post('Applications/sale_replaceItem/execute-proc', {
|
||||||
|
schema: 'vn',
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
proposalTableRef.value.reload();
|
||||||
emit('itemReplaced', {
|
emit('itemReplaced', {
|
||||||
type: 'refresh',
|
type: 'refresh',
|
||||||
itemProposal: proposalSelected.value[0],
|
itemProposal: proposalSelected.value[0],
|
||||||
|
@ -149,8 +143,6 @@ async function confirm() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// const { dialogRef, onDialogOK, onDialogCancel } = useDialogPluginComponent();
|
// const { dialogRef, onDialogOK, onDialogCancel } = useDialogPluginComponent();
|
||||||
const popupProxyRef = ref(null);
|
|
||||||
const emit = defineEmits(['onDialogClosed', 'itemReplaced']);
|
|
||||||
|
|
||||||
// function onDialogClose() {
|
// function onDialogClose() {
|
||||||
// console.log('Dialog has been closed');
|
// console.log('Dialog has been closed');
|
||||||
|
@ -161,16 +153,20 @@ onUnmounted(() => {});
|
||||||
function handleSelection(value, _) {
|
function handleSelection(value, _) {
|
||||||
quantity.value = value.available;
|
quantity.value = value.available;
|
||||||
}
|
}
|
||||||
const isSelectionAvailable = (data) => {
|
// const isSelectionAvailable = (data) => {
|
||||||
if (!data?.row) return false;
|
// if (!data?.row) return false;
|
||||||
const { row } = data;
|
// const { row } = data;
|
||||||
return $props.replaceAction && row.available >= $props.itemLack.lack * -1;
|
// return $props.replaceAction && row.available >= Math.abs($props.itemLack.lack);
|
||||||
};
|
// };
|
||||||
// watch(proposalSelected, ({ available }) => (quantity.value = available));
|
// watch(proposalSelected, ({ available }) => (quantity.value = available));
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div style="min-width: 65vw">
|
<div style="min-width: 65vw">
|
||||||
|
{{ sales }}
|
||||||
|
<br />
|
||||||
|
{{ itemLack }}
|
||||||
<VnTable
|
<VnTable
|
||||||
|
ref="proposalTableRef"
|
||||||
data-key="ItemsGetSimilar"
|
data-key="ItemsGetSimilar"
|
||||||
url="Items/getSimilar"
|
url="Items/getSimilar"
|
||||||
:filter="{
|
:filter="{
|
||||||
|
@ -194,10 +190,9 @@ const isSelectionAvailable = (data) => {
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<template #top-left>
|
<template #top-left>
|
||||||
<div v-if="$props.replaceAction" style="display: flex">
|
<div v-if="$props.replaceAction" class="q-ml-xs" style="display: flex">
|
||||||
<QBtn
|
<QBtn
|
||||||
:label="t('globals.replace')"
|
:label="t('globals.replace')"
|
||||||
class="q-py-xs"
|
|
||||||
color="primary"
|
color="primary"
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
@click="confirm"
|
@click="confirm"
|
||||||
|
@ -216,10 +211,10 @@ const isSelectionAvailable = (data) => {
|
||||||
/></div
|
/></div
|
||||||
></template>
|
></template>
|
||||||
<template #body-selection="props">
|
<template #body-selection="props">
|
||||||
|
<!-- {{ isSelectionAvailable(props) }} -->
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
class="q-ma-xs"
|
class="q-ma-xs"
|
||||||
flat
|
flat
|
||||||
v-if="isSelectionAvailable(props)"
|
|
||||||
v-model="props.selected"
|
v-model="props.selected"
|
||||||
@update:model-value="(evt, _) => handleSelection(props.row, null)"
|
@update:model-value="(evt, _) => handleSelection(props.row, null)"
|
||||||
>
|
>
|
||||||
|
@ -231,9 +226,11 @@ const isSelectionAvailable = (data) => {
|
||||||
{{ row.id }}
|
{{ row.id }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
<!-- <QBtn flat color="blue" dense>{{ }}</QBtn> -->
|
<!-- <QBtn flat color="blue" dense>{{ }}</QBtn> -->
|
||||||
<p class="link">{{ row.longName }}</p>
|
<span class="link">{{ row.longName }}</span>
|
||||||
<ItemDescriptorProxy :id="row.id" />
|
<ItemDescriptorProxy :id="row.id" />
|
||||||
<div style="display: flex">
|
<div style="display: flex; flex-direction: row">
|
||||||
|
<div style="display: flex; flex-direction: column">
|
||||||
|
<span style="font-size: xx-small">{{ row.price2 }}</span>
|
||||||
<VnImg
|
<VnImg
|
||||||
:id="row.id"
|
:id="row.id"
|
||||||
spinner-color="primary"
|
spinner-color="primary"
|
||||||
|
@ -242,8 +239,12 @@ const isSelectionAvailable = (data) => {
|
||||||
width="50px"
|
width="50px"
|
||||||
class="image remove-bg"
|
class="image remove-bg"
|
||||||
/>
|
/>
|
||||||
|
<span style="font-size: xx-small">ID: {{ row.id }}</span>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; align-items: center">
|
||||||
<FetchedTags :item="row" />
|
<FetchedTags :item="row" />
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<!-- </QTd> -->
|
<!-- </QTd> -->
|
||||||
</template>
|
</template>
|
||||||
<template #column-status="{ row }">
|
<template #column-status="{ row }">
|
||||||
|
@ -265,9 +266,7 @@ const isSelectionAvailable = (data) => {
|
||||||
}}</span>
|
}}</span>
|
||||||
</template>
|
</template>
|
||||||
<template #column-difference="{ row }">
|
<template #column-difference="{ row }">
|
||||||
<QTd style="width: 75px; background-color: red"
|
<VnStockValueDisplay :value="sales[0].price - row.price2" />
|
||||||
><VnStockValueDisplay :value="row.id % 2 === 0 ? 10 : -10"
|
|
||||||
/></QTd>
|
|
||||||
</template>
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,11 +6,6 @@ import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||||
const emit = defineEmits(['onDialogClosed', 'itemReplaced']);
|
const emit = defineEmits(['onDialogClosed', 'itemReplaced']);
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
item: {
|
|
||||||
type: Object,
|
|
||||||
required: true,
|
|
||||||
default: () => {},
|
|
||||||
},
|
|
||||||
itemLack: {
|
itemLack: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
|
@ -21,7 +16,7 @@ const $props = defineProps({
|
||||||
required: false,
|
required: false,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
tickets: {
|
sales: {
|
||||||
type: Array,
|
type: Array,
|
||||||
required: false,
|
required: false,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
|
@ -37,12 +32,12 @@ const $props = defineProps({
|
||||||
<QBtn icon="close" flat round dense v-close-popup />
|
<QBtn icon="close" flat round dense v-close-popup />
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<QCardSection class="row items-center">
|
<QCardSection class="row items-center">
|
||||||
<VnImg :id="item.id" class="rounded image-wrapper"></VnImg>
|
<VnImg :id="itemLack.id" class="rounded image-wrapper"></VnImg>
|
||||||
<QBtn flat class="link text-blue">
|
<QBtn flat class="link text-blue">
|
||||||
{{ item.longName }}
|
{{ itemLack.longName }}
|
||||||
<ItemDescriptorProxy :id="item.id" />
|
<ItemDescriptorProxy :id="itemLack.id" />
|
||||||
</QBtn>
|
</QBtn>
|
||||||
<FetchedTags :item="item" />
|
<FetchedTags :item="itemLack" />
|
||||||
|
|
||||||
<!-- {{ tickets[0].saleFk }} -->
|
<!-- {{ tickets[0].saleFk }} -->
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
|
|
|
@ -89,6 +89,7 @@ itemType:
|
||||||
category: Category
|
category: Category
|
||||||
temperature: Temperature
|
temperature: Temperature
|
||||||
proposal:
|
proposal:
|
||||||
|
difference: Difference
|
||||||
title: Items proposal
|
title: Items proposal
|
||||||
itemFk: Item
|
itemFk: Item
|
||||||
longName: Name
|
longName: Name
|
||||||
|
|
|
@ -1,41 +1,20 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref, watch } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useSession } from 'composables/useSession';
|
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import { useQuasar } from 'quasar';
|
import { toHour } from 'src/filters';
|
||||||
import { toDate } from 'src/filters';
|
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
|
|
||||||
import axios from 'axios';
|
|
||||||
import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue';
|
import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue';
|
||||||
import RouteListTicketsDialog from 'pages/Route/Card/RouteListTicketsDialog.vue';
|
|
||||||
import RouteSummary from 'pages/Route/Card/RouteSummary.vue';
|
import RouteSummary from 'pages/Route/Card/RouteSummary.vue';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
|
import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
|
||||||
|
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import { usePrintService } from 'src/composables/usePrintService';
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
const $props = defineProps({
|
|
||||||
filter: {
|
|
||||||
type: Object,
|
|
||||||
default: () => ({}),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const { openReport } = usePrintService();
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const quasar = useQuasar();
|
|
||||||
const session = useSession();
|
|
||||||
const selectedRows = ref([]);
|
|
||||||
const tableRef = ref([]);
|
const tableRef = ref([]);
|
||||||
const confirmationDialog = ref(false);
|
const routeFilter = {
|
||||||
const startingDate = ref(null);
|
|
||||||
const router = useRouter();
|
|
||||||
const filterLack = ref({
|
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
relation: 'workers',
|
relation: 'workers',
|
||||||
|
@ -44,17 +23,16 @@ const filterLack = ref({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
where: { alertLevel: 'FREE' },
|
};
|
||||||
});
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
isId: true,
|
||||||
name: 'id',
|
name: 'id',
|
||||||
label: 'Id',
|
label: 'Id',
|
||||||
chip: {
|
chip: {
|
||||||
condition: () => true,
|
condition: () => true,
|
||||||
},
|
},
|
||||||
isId: true,
|
|
||||||
columnFilter: false,
|
columnFilter: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -62,138 +40,52 @@ const columns = computed(() => [
|
||||||
name: 'workerFk',
|
name: 'workerFk',
|
||||||
label: t('Worker'),
|
label: t('Worker'),
|
||||||
create: true,
|
create: true,
|
||||||
component: 'select',
|
|
||||||
attrs: {
|
|
||||||
url: 'Workers/activeWithInheritedRole',
|
|
||||||
fields: ['id', 'name'],
|
|
||||||
useLike: false,
|
|
||||||
optionFilter: 'firstName',
|
|
||||||
find: {
|
|
||||||
value: 'workerFk',
|
|
||||||
label: 'workerUserName',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
columnFilter: {
|
|
||||||
inWhere: true,
|
|
||||||
},
|
|
||||||
useLike: false,
|
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef),
|
format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef),
|
||||||
|
columnFilter: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'agencyModeFk',
|
name: 'agencyName',
|
||||||
label: t('Agency'),
|
label: t('Agency'),
|
||||||
isTitle: true,
|
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
create: true,
|
create: true,
|
||||||
component: 'select',
|
|
||||||
attrs: {
|
|
||||||
url: 'agencyModes',
|
|
||||||
fields: ['id', 'name'],
|
|
||||||
find: {
|
|
||||||
value: 'agencyModeFk',
|
|
||||||
label: 'agencyName',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
columnClass: 'expand',
|
columnClass: 'expand',
|
||||||
|
columnFilter: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'vehicleFk',
|
name: 'vehiclePlateNumber',
|
||||||
label: t('Vehicle'),
|
label: t('Vehicle'),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
create: true,
|
create: true,
|
||||||
component: 'select',
|
|
||||||
attrs: {
|
|
||||||
url: 'vehicles',
|
|
||||||
fields: ['id', 'numberPlate'],
|
|
||||||
optionLabel: 'numberPlate',
|
|
||||||
optionFilterValue: 'numberPlate',
|
|
||||||
find: {
|
|
||||||
value: 'vehicleFk',
|
|
||||||
label: 'vehiclePlateNumber',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
columnFilter: {
|
|
||||||
inWhere: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
align: 'left',
|
|
||||||
name: 'created',
|
|
||||||
label: t('Date'),
|
|
||||||
columnFilter: false,
|
columnFilter: false,
|
||||||
cardVisible: true,
|
|
||||||
create: true,
|
|
||||||
component: 'date',
|
|
||||||
format: ({ date }) => toDate(date),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
align: 'left',
|
|
||||||
name: 'from',
|
|
||||||
label: t('From'),
|
|
||||||
visible: false,
|
|
||||||
cardVisible: true,
|
|
||||||
create: true,
|
|
||||||
component: 'date',
|
|
||||||
format: ({ date }) => toDate(date),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
align: 'left',
|
|
||||||
name: 'to',
|
|
||||||
label: t('To'),
|
|
||||||
visible: false,
|
|
||||||
cardVisible: true,
|
|
||||||
create: true,
|
|
||||||
component: 'date',
|
|
||||||
format: ({ date }) => toDate(date),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
align: 'center',
|
|
||||||
name: 'm3',
|
|
||||||
label: t('Volume'),
|
|
||||||
cardVisible: true,
|
|
||||||
columnClass: 'shrink',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'started',
|
name: 'started',
|
||||||
label: t('hourStarted'),
|
label: t('hourStarted'),
|
||||||
component: 'time',
|
cardVisible: true,
|
||||||
columnFilter: false,
|
columnFilter: false,
|
||||||
|
format: (row) => toHour(row.started),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'finished',
|
name: 'finished',
|
||||||
label: t('hourFinished'),
|
label: t('hourFinished'),
|
||||||
component: 'time',
|
cardVisible: true,
|
||||||
columnFilter: false,
|
columnFilter: false,
|
||||||
},
|
format: (row) => toHour(row.started),
|
||||||
{
|
|
||||||
align: 'center',
|
|
||||||
name: 'kmStart',
|
|
||||||
label: t('KmStart'),
|
|
||||||
columnClass: 'shrink',
|
|
||||||
create: true,
|
|
||||||
visible: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
align: 'center',
|
|
||||||
name: 'kmEnd',
|
|
||||||
label: t('KmEnd'),
|
|
||||||
columnClass: 'shrink',
|
|
||||||
create: true,
|
|
||||||
visible: false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'description',
|
name: 'description',
|
||||||
label: t('Description'),
|
label: t('Description'),
|
||||||
|
cardVisible: true,
|
||||||
isTitle: true,
|
isTitle: true,
|
||||||
create: true,
|
create: true,
|
||||||
component: 'input',
|
|
||||||
field: 'description',
|
field: 'description',
|
||||||
|
columnFilter: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -207,212 +99,53 @@ const columns = computed(() => [
|
||||||
align: 'right',
|
align: 'right',
|
||||||
name: 'tableActions',
|
name: 'tableActions',
|
||||||
actions: [
|
actions: [
|
||||||
{
|
|
||||||
title: t('Add tickets'),
|
|
||||||
icon: 'vn:ticketAdd',
|
|
||||||
action: (row) => openTicketsDialog(row?.id),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: t('components.smartCard.viewSummary'),
|
title: t('components.smartCard.viewSummary'),
|
||||||
icon: 'preview',
|
icon: 'preview',
|
||||||
action: (row) => viewSummary(row?.id, RouteSummary),
|
action: (row) => viewSummary(row?.id, RouteSummary),
|
||||||
},
|
color: 'primary',
|
||||||
{
|
|
||||||
title: t('Route summary'),
|
|
||||||
icon: 'arrow_forward',
|
|
||||||
isPrimary: true,
|
|
||||||
action: (row) => navigate(row?.id),
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
watch($props.filter, (v) => (filterLack.value.where = v));
|
|
||||||
function navigate(id) {
|
|
||||||
router.push({ path: `/route/${id}` });
|
|
||||||
}
|
|
||||||
|
|
||||||
const cloneRoutes = () => {
|
|
||||||
if (!selectedRows.value.length || !startingDate.value) return;
|
|
||||||
axios.post('Routes/clone', {
|
|
||||||
created: startingDate.value,
|
|
||||||
ids: selectedRows.value.map((row) => row?.id),
|
|
||||||
});
|
|
||||||
startingDate.value = null;
|
|
||||||
tableRef.value.reload();
|
|
||||||
};
|
|
||||||
|
|
||||||
const showRouteReport = () => {
|
|
||||||
const ids = selectedRows.value.map((row) => row?.id);
|
|
||||||
const idString = ids.join(',');
|
|
||||||
let url = `Routes/${idString}/driver-route-pdf`;
|
|
||||||
let params = {};
|
|
||||||
if (selectedRows.value.length >= 1) {
|
|
||||||
params = {
|
|
||||||
id: idString,
|
|
||||||
};
|
|
||||||
url = `Routes/downloadZip`;
|
|
||||||
}
|
|
||||||
openReport(url, params, '_blank');
|
|
||||||
};
|
|
||||||
|
|
||||||
function markAsServed() {
|
|
||||||
selectedRows.value.forEach(async (row) => {
|
|
||||||
await axios.patch(`Routes/${row?.id}`, { isOk: true });
|
|
||||||
});
|
|
||||||
tableRef.value.reload();
|
|
||||||
startingDate.value = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const openTicketsDialog = (id) => {
|
|
||||||
quasar
|
|
||||||
.dialog({
|
|
||||||
component: RouteListTicketsDialog,
|
|
||||||
componentProps: {
|
|
||||||
id,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.onOk(() => tableRef.value.reload());
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<RouteSearchbar />
|
<RouteSearchbar />
|
||||||
<QDialog v-model="confirmationDialog">
|
|
||||||
<QCard style="min-width: 350px">
|
|
||||||
<QCardSection>
|
|
||||||
<p class="text-h6 q-ma-none">{{ t('Select the starting date') }}</p>
|
|
||||||
</QCardSection>
|
|
||||||
|
|
||||||
<QCardSection class="q-pt-none">
|
|
||||||
<VnInputDate
|
|
||||||
:label="t('Stating date')"
|
|
||||||
v-model="startingDate"
|
|
||||||
autofocus
|
|
||||||
/>
|
|
||||||
</QCardSection>
|
|
||||||
<QCardActions align="right">
|
|
||||||
<QBtn flat :label="t('Cancel')" v-close-popup class="text-primary" />
|
|
||||||
<QBtn color="primary" v-close-popup @click="cloneRoutes">
|
|
||||||
{{ t('globals.clone') }}
|
|
||||||
</QBtn>
|
|
||||||
</QCardActions>
|
|
||||||
</QCard>
|
|
||||||
</QDialog>
|
|
||||||
<VnSubToolbar />
|
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
<template #right-panel>
|
<template #right-panel>
|
||||||
<RouteFilter data-key="RouteList" />
|
<RouteFilter data-key="RouteList" />
|
||||||
</template>
|
</template>
|
||||||
</RightMenu>
|
</RightMenu>
|
||||||
<VnTable
|
<VnTable
|
||||||
class="route-list"
|
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="RouteList"
|
data-key="RouteList"
|
||||||
url="Routes/filter"
|
url="Routes/filter"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
:is-editable="true"
|
:filter="routeFilter"
|
||||||
:filter="filterLack"
|
|
||||||
redirect="route"
|
redirect="route"
|
||||||
:row-click="false"
|
|
||||||
:create="{
|
:create="{
|
||||||
urlCreate: 'Routes',
|
urlCreate: 'Routes',
|
||||||
title: t('Create route'),
|
title: t('Create route'),
|
||||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||||
formInitialData: {},
|
formInitialData: {},
|
||||||
}"
|
}"
|
||||||
save-url="Routes/crud"
|
|
||||||
:disable-option="{ card: true }"
|
|
||||||
table-height="85vh"
|
table-height="85vh"
|
||||||
v-model:selected="selectedRows"
|
|
||||||
:table="{
|
|
||||||
'row-key': 'id',
|
|
||||||
selection: 'multiple',
|
|
||||||
}"
|
|
||||||
>
|
>
|
||||||
<template #moreBeforeActions>
|
<template #column-workerFk="{ row }">
|
||||||
<QBtn
|
<span class="link" @click.stop>
|
||||||
icon="vn:clone"
|
{{ row?.workerUserName }}
|
||||||
color="primary"
|
<WorkerDescriptorProxy :id="row?.workerFk" v-if="row?.workerFk" />
|
||||||
class="q-mr-sm"
|
</span>
|
||||||
:disable="!selectedRows?.length"
|
|
||||||
@click="confirmationDialog = true"
|
|
||||||
>
|
|
||||||
<QTooltip>{{ t('Clone Selected Routes') }}</QTooltip>
|
|
||||||
</QBtn>
|
|
||||||
<QBtn
|
|
||||||
icon="cloud_download"
|
|
||||||
color="primary"
|
|
||||||
class="q-mr-sm"
|
|
||||||
:disable="!selectedRows?.length"
|
|
||||||
@click="showRouteReport"
|
|
||||||
>
|
|
||||||
<QTooltip>{{ t('Download selected routes as PDF') }}</QTooltip>
|
|
||||||
</QBtn>
|
|
||||||
<QBtn
|
|
||||||
icon="check"
|
|
||||||
color="primary"
|
|
||||||
class="q-mr-sm"
|
|
||||||
:disable="!selectedRows?.length"
|
|
||||||
@click="markAsServed()"
|
|
||||||
>
|
|
||||||
<QTooltip>{{ t('Mark as served') }}</QTooltip>
|
|
||||||
</QBtn>
|
|
||||||
</template>
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.table-input-cell {
|
|
||||||
max-width: 143px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.route-list {
|
|
||||||
width: 100%;
|
|
||||||
max-height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table-actions {
|
|
||||||
gap: 12px;
|
|
||||||
}
|
|
||||||
th:last-child,
|
|
||||||
td:last-child {
|
|
||||||
background-color: var(--vn-section-color);
|
|
||||||
position: sticky;
|
|
||||||
right: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
|
||||||
newRoute: New Route
|
|
||||||
hourStarted: Started hour
|
|
||||||
hourFinished: Finished hour
|
|
||||||
es:
|
es:
|
||||||
From: Desde
|
|
||||||
To: Hasta
|
|
||||||
Worker: Trabajador
|
Worker: Trabajador
|
||||||
Agency: Agencia
|
Agency: Agencia
|
||||||
Vehicle: Vehículo
|
Vehicle: Vehículo
|
||||||
Volume: Volumen
|
|
||||||
Date: Fecha
|
|
||||||
Description: Descripción
|
Description: Descripción
|
||||||
Hour started: Hora inicio
|
Hour started: Hora inicio
|
||||||
Hour finished: Hora fin
|
Hour finished: Hora fin
|
||||||
KmStart: Km inicio
|
|
||||||
KmEnd: Km fin
|
|
||||||
Served: Servida
|
|
||||||
newRoute: Nueva Ruta
|
|
||||||
Clone Selected Routes: Clonar rutas seleccionadas
|
|
||||||
Select the starting date: Seleccione la fecha de inicio
|
|
||||||
Stating date: Fecha de inicio
|
|
||||||
Cancel: Cancelar
|
|
||||||
Mark as served: Marcar como servidas
|
|
||||||
Download selected routes as PDF: Descargar rutas seleccionadas como PDF
|
|
||||||
Add ticket: Añadir tickets
|
|
||||||
Preview: Vista previa
|
|
||||||
Summary: Resumen
|
|
||||||
Route is closed: La ruta está cerrada
|
|
||||||
Route is not served: La ruta no está servida
|
|
||||||
hourStarted: Hora de inicio
|
|
||||||
hourFinished: Hora de fin
|
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -176,10 +176,9 @@ const itemProposalSelected = ref(null);
|
||||||
<QIcon name="import_export" class="rotate-90"></QIcon>
|
<QIcon name="import_export" class="rotate-90"></QIcon>
|
||||||
<ItemProposalProxy
|
<ItemProposalProxy
|
||||||
ref="proposalDialogRef"
|
ref="proposalDialogRef"
|
||||||
:item="item"
|
|
||||||
:item-lack="itemLack"
|
:item-lack="itemLack"
|
||||||
:replace-action="true"
|
:replace-action="true"
|
||||||
:tickets="selectedRows"
|
:sales="selectedRows"
|
||||||
@item-replaced="itemProposalEvt"
|
@item-replaced="itemProposalEvt"
|
||||||
></ItemProposalProxy>
|
></ItemProposalProxy>
|
||||||
<QTooltip bottom anchor="bottom right">
|
<QTooltip bottom anchor="bottom right">
|
||||||
|
@ -217,13 +216,13 @@ const itemProposalSelected = ref(null);
|
||||||
:color="itemLack.lack === 0 ? 'green' : 'red'"
|
:color="itemLack.lack === 0 ? 'green' : 'red'"
|
||||||
:label="itemLack.lack"
|
:label="itemLack.lack"
|
||||||
/>
|
/>
|
||||||
<QBadge
|
<!-- <QBadge
|
||||||
color="secondary"
|
color="secondary"
|
||||||
class="q-ml-xs q-mt-xs"
|
class="q-ml-xs q-mt-xs"
|
||||||
v-if="itemLack"
|
v-if="itemLack"
|
||||||
:label="toCurrency(itemLack.lack)"
|
:label="toCurrency(itemLack.quantity * itemLack.price)"
|
||||||
outline
|
outline
|
||||||
/>
|
/> -->
|
||||||
</div>
|
</div>
|
||||||
<QBtn flat class="link text-blue">
|
<QBtn flat class="link text-blue">
|
||||||
{{ item.longName }}
|
{{ item.longName }}
|
||||||
|
|
|
@ -2,18 +2,14 @@
|
||||||
import { computed, ref, reactive } from 'vue';
|
import { computed, ref, reactive } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
|
||||||
import NegativeOriginDialog from 'pages/Ticket/Negative/components/NegativeOriginDialog.vue';
|
import NegativeOriginDialog from 'pages/Ticket/Negative/components/NegativeOriginDialog.vue';
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
|
||||||
import { onBeforeMount } from 'vue';
|
import { onBeforeMount } from 'vue';
|
||||||
import { dashIfEmpty, toDate, toHour } from 'src/filters';
|
import { dashIfEmpty, toDate, toHour } from 'src/filters';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
import { useRole } from 'src/composables/useRole';
|
import { useRole } from 'src/composables/useRole';
|
||||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
import VnImg from 'src/components/ui/VnImg.vue';
|
|
||||||
import TicketLackFilter from './TicketLackFilter.vue';
|
import TicketLackFilter from './TicketLackFilter.vue';
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
|
|
|
@ -43,9 +43,9 @@ const { notify } = useNotify();
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const itemLack = ref(null);
|
const itemLack = ref(null);
|
||||||
const getInputEvents = (colField, props) => ({
|
const getInputEvents = ({ col, ...rows }) => ({
|
||||||
'update:modelValue': () => saveChange(colField, props),
|
'update:modelValue': () => saveChange(col.name, rows),
|
||||||
'keyup.enter': () => saveChange(colField, props),
|
'keyup.enter': () => saveChange(col.name, rows),
|
||||||
});
|
});
|
||||||
const saveChange = async (field, { rowIndex, row }) => {
|
const saveChange = async (field, { rowIndex, row }) => {
|
||||||
try {
|
try {
|
||||||
|
@ -175,8 +175,9 @@ const columns = computed(() => [
|
||||||
]);
|
]);
|
||||||
const itemLackForm = ref();
|
const itemLackForm = ref();
|
||||||
|
|
||||||
const reload = async () => {
|
const reload = async (data) => {
|
||||||
itemLackForm.value.fetch();
|
// window.location.reload();
|
||||||
|
console.err(data);
|
||||||
};
|
};
|
||||||
defineExpose({ reload });
|
defineExpose({ reload });
|
||||||
const emit = defineEmits(['update:selection']);
|
const emit = defineEmits(['update:selection']);
|
||||||
|
|
Loading…
Reference in New Issue