This commit is contained in:
Javier Segarra 2024-06-10 17:06:20 +02:00
parent fd4ff94f4c
commit b370fe673b
4 changed files with 197 additions and 70 deletions

View File

@ -6,6 +6,10 @@ import { useArrayData } from 'composables/useArrayData';
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps({ const props = defineProps({
append: {
type: Boolean,
default: true,
},
dataKey: { dataKey: {
type: String, type: String,
required: true, required: true,
@ -155,11 +159,14 @@ defineExpose({ fetch, addFilter });
</script> </script>
<template> <template>
<div class="full-width"> <div v-if="append" class="full-width">
{{ !props.autoLoad && !store.data && !isLoading }}
{{ props.skeleton && props.autoLoad && !store.data }}
<div <div
v-if="!props.autoLoad && !store.data && !isLoading" v-if="!props.autoLoad && !store.data && !isLoading"
class="info-row q-pa-md text-center" class="info-row q-pa-md text-center"
> >
asd
<h5> <h5>
{{ t('No data to display') }} {{ t('No data to display') }}
</h5> </h5>

View File

@ -120,7 +120,20 @@ const columns = computed(() => [
field: 'located', field: 'located',
}, },
]); ]);
const columnPrices = computed(() => [
{
...defaultColumnAttrs,
label: t('proposal.ticket'),
name: 'ticketFk',
field: 'counter',
},
{
...defaultColumnAttrs,
label: t('proposal.Diff'),
name: 'Diff',
field: 'counter',
},
]);
async function confirm() { async function confirm() {
quantity.value = 0; quantity.value = 0;
// const response = { address: address.value }; // const response = { address: address.value };
@ -160,70 +173,152 @@ async function confirm() {
<span class="text-h6 text-grey">{{ t('proposal.title') }}</span> <span class="text-h6 text-grey">{{ t('proposal.title') }}</span>
</QCardSection> </QCardSection>
<QCardSection class="row items-center justify-center column items-stretch"> <QCardSection class="row items-center justify-center column items-stretch">
<VnPaginate <VnRow style="display: flex">
data-key="ItemsGetSimilar" <VnPaginate
url="Items/getSimilar" :append="false"
:filter="{ style="width: 70vw !important"
where: { data-key="ItemsGetSimilar"
itemFk: $props.item.itemFk, url="Items/getSimilar"
warehouseFk: $props.item.warehouseFk, :filter="{
}, where: {
}" itemFk: $props.item.itemFk,
auto-load warehouseFk: $props.item.warehouseFk,
> },
<template #body="{ rows }"> }"
<QTable auto-load
:rows="rows" >
:columns="columns" <template #body="{ rows }">
row-key="id" <QTable
selection="single" :rows="rows"
:pagination="{ rowsPerPage: 0 }" :columns="columns"
class="full-width q-mt-md" row-key="id"
:no-data-label="t('globals.noResults')" selection="single"
v-model:selected="proposalSelected" :pagination="{ rowsPerPage: 0 }"
:dense="$q.screen.lt.md" class="full-width q-mt-md"
flat :no-data-label="t('globals.noResults')"
:grid="$q.screen.lt.md" v-model:selected="proposalSelected"
auto-load :dense="$q.screen.lt.md"
:rows-per-page-options="[0]" flat
hide-pagination :grid="$q.screen.lt.md"
> auto-load
<template #top-row="{ cols }"> :rows-per-page-options="[0]"
<QTr> hide-pagination
<QTd /> >
<QTd <template #top-row="{ cols }">
v-for="(col, index) in cols" <QTr>
:key="index" <QTd />
style="max-width: 100px" <QTd
> v-for="(col, index) in cols"
<component :key="index"
:is="col.columnFilter.component" style="max-width: 100px"
v-if="col.columnFilter" >
v-model="col.columnFilter.filterValue" <component
v-bind="col.columnFilter.attrs" :is="col.columnFilter.component"
v-on="col.columnFilter.event(col)" v-if="col.columnFilter"
dense v-model="col.columnFilter.filterValue"
/> v-bind="col.columnFilter.attrs"
v-on="col.columnFilter.event(col)"
dense
/>
</QTd>
</QTr>
</template>
<template #body-cell-longName="{ row, value }">
<QTd align="right" class="text-primary">
<QBtn flat color="blue" dense>{{ value }}</QBtn>
<ItemDescriptorProxy :id="row.id" />
</QTd> </QTd>
</QTr> </template>
</template> <template #body-cell-status="{ value }">
<template #body-cell-longName="{ row, value }"> <QTd class="col" align="center">
<QTd align="right" class="text-primary"> <div
<QBtn flat color="blue" dense>{{ value }}</QBtn> :style="{ 'background-color': value }"
<ItemDescriptorProxy :id="row.id" /> style="height: 10px"
</QTd> ></div>
</template> </QTd>
<template #body-cell-status="{ value }"> </template>
<QTd class="col" align="center"> </QTable>
<div </template>
:style="{ 'background-color': value }" </VnPaginate>
style="height: 10px" <VnPaginate
></div> class="q-ml-sm"
</QTd> :append="false"
</template> style="width: 20vw !important; margin-left: 40px !important"
</QTable> data-key="ItemsGetSimilar"
</template> url="Items/getSimilar"
</VnPaginate> :filter="{
where: {
itemFk: $props.item.itemFk,
warehouseFk: $props.item.warehouseFk,
},
}"
auto-load
>
<template #body>
<QTable
:rows="[
{
name: 'Frozen Yogurt',
calories: 159,
fat: 6.0,
carbs: 24,
protein: 4.0,
sodium: 87,
calcium: '14%',
iron: '1%',
},
]"
:columns="columnPrices"
row-key="id"
selection="single"
:pagination="{ rowsPerPage: 0 }"
class="full-width q-mt-md"
:no-data-label="t('globals.noResults')"
v-model:selected="proposalSelected"
:dense="$q.screen.lt.md"
flat
:grid="$q.screen.lt.md"
auto-load
:rows-per-page-options="[0]"
hide-pagination
>
<template #top-row="{ cols }">
<QTr>
<QTd />
<QTd
v-for="(col, index) in cols"
:key="index"
style="max-width: 100px"
>
<component
:is="col.columnFilter.component"
v-if="col.columnFilter"
v-model="col.columnFilter.filterValue"
v-bind="col.columnFilter.attrs"
v-on="col.columnFilter.event(col)"
dense
/>
</QTd>
</QTr>
</template>
<template #body-cell-longName="{ row, value }">
<QTd align="right" class="text-primary">
<QBtn flat color="blue" dense>{{ value }}</QBtn>
<ItemDescriptorProxy :id="row.id" />
</QTd>
</template>
<template #body-cell-status="{ value }">
<QTd class="col" align="center">
<div
:style="{ 'background-color': value }"
style="height: 10px"
></div>
</QTd>
</template>
</QTable>
</template>
</VnPaginate>
</VnRow>
</QCardSection> </QCardSection>
<QCardActions align="right"> <QCardActions align="right">
<QBtn :label="t('globals.cancel')" color="primary" flat v-close-popup /> <QBtn :label="t('globals.cancel')" color="primary" flat v-close-popup />

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { computed, onMounted, ref, toRefs } from 'vue'; import { computed, onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import axios from 'axios'; import axios from 'axios';
import { useDialogPluginComponent } from 'quasar'; import { useDialogPluginComponent } from 'quasar';

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import { computed, nextTick, onMounted, onUnmounted, ref, toRefs } from 'vue'; import { computed, nextTick, onMounted, onUnmounted, ref, toRefs } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { QBtn, QCheckbox } from 'quasar'; import { QBtn, QCheckbox, useQuasar } from 'quasar';
import axios from 'axios'; import axios from 'axios';
import HandleSplited from 'pages/Ticket/Negative/HandleSplited.vue'; import HandleSplited from 'pages/Ticket/Negative/HandleSplited.vue';
import ChangeQuantityDialog from 'pages/Ticket/Negative/ChangeQuantityDialog.vue'; import ChangeQuantityDialog from 'pages/Ticket/Negative/ChangeQuantityDialog.vue';
@ -18,6 +18,7 @@ import { toDate, toHour } from 'src/filters';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useDialogPluginComponent } from 'quasar'; import { useDialogPluginComponent } from 'quasar';
import { useSession } from 'src/composables/useSession';
const { openConfirmationModal } = useVnConfirm(); const { openConfirmationModal } = useVnConfirm();
const { t } = useI18n(); const { t } = useI18n();
@ -37,6 +38,9 @@ const componentIsRendered = ref(false);
const showFree = ref(true); const showFree = ref(true);
const resultSplit = ref([]); const resultSplit = ref([]);
const selectedRows = ref([]); const selectedRows = ref([]);
const session = useSession();
const token = session.getTokenMultimedia();
const originalRowDataCopy = ref(null); const originalRowDataCopy = ref(null);
const $props = defineProps({ const $props = defineProps({
@ -298,8 +302,11 @@ const handleRows = (rows) => {
if (showFree.value) return rows.filter(({ alertLevel }) => alertLevel === 0); if (showFree.value) return rows.filter(({ alertLevel }) => alertLevel === 0);
return rows.sort(freeFirst); return rows.sort(freeFirst);
}; };
const quasar = useQuasar();
const split = async () => { const split = async () => {
const body = selectedRows.value; const body = selectedRows.value;
// const {data} = await axios.post(`Tickets/split`, body); // const {data} = await axios.post(`Tickets/split`, body);
// resultSplit.value = data; // resultSplit.value = data;
resultSplit.value = [ resultSplit.value = [
@ -307,6 +314,12 @@ const split = async () => {
{ ticket: 32, newTicket: 1000006, status: 'noSplit' }, { ticket: 32, newTicket: 1000006, status: 'noSplit' },
{ ticket: 32, newTicket: 1000007, status: 'error' }, { ticket: 32, newTicket: 1000007, status: 'error' },
]; ];
quasar.dialog({
component: HandleSplited,
componentProps: {
tickets: resultSplit.value,
},
});
}; };
</script> </script>
@ -330,6 +343,19 @@ const split = async () => {
> >
</Teleport> </Teleport>
<Teleport to="#st-data" v-if="stateStore?.isSubToolbarShown()"> <Teleport to="#st-data" v-if="stateStore?.isSubToolbarShown()">
<QImg
:src="`/api/Images/catalog/50x50/${item.itemFk}/download?access_token=${token}`"
spinner-color="primary"
:ratio="1"
height="50px"
width="50px"
class="image remove-bg"
:alt="'asdads'"
/>
<span class="text-h6">{{ item.longName }}</span>
<span>{{ item }}</span>
<QSpace />
<QBtnGroup push style="column-gap: 1px"> <QBtnGroup push style="column-gap: 1px">
<QBtn <QBtn
color="primary" color="primary"
@ -381,7 +407,6 @@ const split = async () => {
</QBtnGroup> </QBtnGroup>
<QCheckbox v-model="showFree" :label="t('negative.detail.showFree')" /> <QCheckbox v-model="showFree" :label="t('negative.detail.showFree')" />
</Teleport> </Teleport>
<VnPaginate <VnPaginate
:data-key="URL_KEY" :data-key="URL_KEY"
:url="`${URL_KEY}/${entityId}/detail`" :url="`${URL_KEY}/${entityId}/detail`"
@ -497,12 +522,12 @@ const split = async () => {
:selected-rows="selectedRows" :selected-rows="selectedRows"
> >
</ChangeQuantityDialog> </ChangeQuantityDialog>
<HandleSplited <!--<HandleSplited
ref="splitDialogRef" ref="splitDialogRef"
@hide="onDialogHide" @hide="onDialogHide"
v-model="showSplitDialog" v-model="showSplitDialog"
:tickets="resultSplit" :tickets="resultSplit"
></HandleSplited> ></HandleSplited>-->
<ItemProposal <ItemProposal
ref="proposalDialogRef" ref="proposalDialogRef"
@hide="onDialogHide" @hide="onDialogHide"