forked from verdnatura/salix-front
updates
This commit is contained in:
parent
679710eb4d
commit
7b047e1637
|
@ -27,10 +27,20 @@ export function useRole() {
|
|||
|
||||
return false;
|
||||
}
|
||||
function likeAny(roles) {
|
||||
const roleStore = state.getRoles();
|
||||
for (const role of roles) {
|
||||
if (!roleStore.value.findIndex((rs) => rs.startsWith(role)) !== -1)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return {
|
||||
fetch,
|
||||
hasAny,
|
||||
likeAny,
|
||||
state,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,11 +3,17 @@ import { ref, computed } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
import FetchedTags from 'components/ui/FetchedTags.vue';
|
||||
import { useSession } from 'src/composables/useSession';
|
||||
|
||||
const { t } = useI18n();
|
||||
const session = useSession();
|
||||
|
||||
const primaryColor = 'red';
|
||||
const colorSpacer = '#ecf0f1';
|
||||
const gradientStyle = computed(() => {
|
||||
return `linear-gradient(to right, ${primaryColor} ${compatibility.value}, ${colorSpacer} 10%)`;
|
||||
});
|
||||
const $props = defineProps({
|
||||
item: {
|
||||
type: Object,
|
||||
|
@ -30,36 +36,39 @@ const defaultColumnAttrs = {
|
|||
align: 'left',
|
||||
sortable: true,
|
||||
};
|
||||
const compatibility = ref(null);
|
||||
// const compatibility = computed(() => `linear-gradient(to right,red 10%, white 10%);`);
|
||||
const statusConditionalValue = (row) => {
|
||||
const total = [5, 6, 7, 8].reduce((acc, i) => acc + row[`match${i}`], 0);
|
||||
const STATUS_VALUES = { 2: '$secondary', 3: 'positive', 4: 'warning' };
|
||||
const status = STATUS_VALUES[total - 2];
|
||||
if (!status) return 'white';
|
||||
return status;
|
||||
const values = [5, 6, 7, 8];
|
||||
const total = values.reduce((acc, i) => acc + row[`match${i}`], 0);
|
||||
const STATUS_VALUES = { 1: 'white', 2: '$secondary', 3: 'positive', 4: 'warning' };
|
||||
const status = STATUS_VALUES[total];
|
||||
compatibility.value = `${100 * (total / values.length)}%`;
|
||||
return { status, total, compatibility };
|
||||
};
|
||||
const conditionalValue = (tag) => (tag === 1 ? 'match' : 'not-match');
|
||||
// const conditionalValue = (tag) => (tag === 1 ? 'match' : 'not-match');
|
||||
const conditionalValuePrice = (price) =>
|
||||
price > currentTicket.value.price * 1.3 ? 'match' : 'not-match';
|
||||
const changeTicket = (type, _index = 0) => {
|
||||
const value = type ? 1 : -1;
|
||||
const nextIndex = index.value + value + _index;
|
||||
const ticket = $props.tickets[nextIndex];
|
||||
if (ticket.ticketFk === currentTicket.value.ticketFk)
|
||||
return changeTicket(true, nextIndex - 1);
|
||||
index.value = nextIndex;
|
||||
};
|
||||
// const changeTicket = (type, _index = 0) => {
|
||||
// const value = type ? 1 : -1;
|
||||
// const nextIndex = index.value + value + _index;
|
||||
// const ticket = $props.tickets[nextIndex];
|
||||
// if (ticket.ticketFk === currentTicket.value.ticketFk)
|
||||
// return changeTicket(true, nextIndex - 1);
|
||||
// index.value = nextIndex;
|
||||
// };
|
||||
const columns = computed(() => [
|
||||
{
|
||||
...defaultColumnAttrs,
|
||||
label: t('proposal.counter'),
|
||||
name: 'counter',
|
||||
field: 'counter',
|
||||
label: t('proposal.available'),
|
||||
name: 'available',
|
||||
field: 'available',
|
||||
},
|
||||
{
|
||||
...defaultColumnAttrs,
|
||||
label: t('proposal.itemFk'),
|
||||
name: 'id',
|
||||
field: 'id',
|
||||
label: t('proposal.difference'),
|
||||
name: 'difference',
|
||||
field: (item) => 21,
|
||||
},
|
||||
{
|
||||
...defaultColumnAttrs,
|
||||
|
@ -67,6 +76,13 @@ const columns = computed(() => [
|
|||
name: 'status',
|
||||
field: statusConditionalValue,
|
||||
},
|
||||
{
|
||||
...defaultColumnAttrs,
|
||||
label: t('proposal.counter'),
|
||||
name: 'counter',
|
||||
field: 'counter',
|
||||
},
|
||||
|
||||
{
|
||||
align: 'center',
|
||||
sortable: true,
|
||||
|
@ -74,13 +90,13 @@ const columns = computed(() => [
|
|||
name: 'longName',
|
||||
field: 'longName',
|
||||
},
|
||||
{
|
||||
...defaultColumnAttrs,
|
||||
label: t('proposal.subName'),
|
||||
name: 'subName',
|
||||
field: 'subName',
|
||||
},
|
||||
{
|
||||
// {
|
||||
// ...defaultColumnAttrs,
|
||||
// label: t('proposal.subName'),
|
||||
// name: 'subName',
|
||||
// field: 'subName',
|
||||
// },
|
||||
/*{
|
||||
...defaultColumnAttrs,
|
||||
label: t('proposal.value5'),
|
||||
name: 'value5',
|
||||
|
@ -107,12 +123,18 @@ const columns = computed(() => [
|
|||
name: 'value8',
|
||||
field: 'value8',
|
||||
classes: ({ match8 }) => conditionalValue(match8),
|
||||
},
|
||||
},*/
|
||||
{
|
||||
...defaultColumnAttrs,
|
||||
label: t('proposal.available'),
|
||||
name: 'available',
|
||||
field: 'available',
|
||||
label: t('proposal.tags'),
|
||||
name: 'tags',
|
||||
},
|
||||
|
||||
{
|
||||
...defaultColumnAttrs,
|
||||
label: t('proposal.price2'),
|
||||
name: 'price2',
|
||||
field: 'price2',
|
||||
},
|
||||
{
|
||||
...defaultColumnAttrs,
|
||||
|
@ -120,12 +142,6 @@ const columns = computed(() => [
|
|||
name: 'minQuantity',
|
||||
field: 'minQuantity',
|
||||
},
|
||||
{
|
||||
...defaultColumnAttrs,
|
||||
label: t('proposal.price2'),
|
||||
name: 'price2',
|
||||
field: 'price2',
|
||||
},
|
||||
{
|
||||
...defaultColumnAttrs,
|
||||
label: t('proposal.located'),
|
||||
|
@ -156,7 +172,7 @@ async function confirm() {
|
|||
<QCard class="q-pa-lg">
|
||||
<QCardSection class="row items-center q-pb-none">
|
||||
<QImg
|
||||
:src="`/api/Images/catalog/50x50/${item.itemFk}/download?access_token=${token}`"
|
||||
:src="`/api/Images/catalog/50x50/${item.id}/download?access_token=${token}`"
|
||||
spinner-color="primary"
|
||||
:ratio="1"
|
||||
height="50px"
|
||||
|
@ -166,6 +182,9 @@ async function confirm() {
|
|||
/>
|
||||
|
||||
<span class="text-h6">{{ item.longName }}</span>
|
||||
<span class="text"
|
||||
><sub>{{ item.longName }}</sub></span
|
||||
>
|
||||
<QSpace />
|
||||
<QBtn icon="close" flat round dense v-close-popup />
|
||||
</QCardSection>
|
||||
|
@ -233,18 +252,41 @@ async function confirm() {
|
|||
</template>
|
||||
<template #body-cell-longName="{ row, value }">
|
||||
<QTd align="right" class="text-primary">
|
||||
<QTooltip>
|
||||
{{ row.id }}
|
||||
</QTooltip>
|
||||
<QImg
|
||||
:src="`/api/Images/catalog/50x50/${row.id}/download?access_token=${token}`"
|
||||
spinner-color="primary"
|
||||
:ratio="1"
|
||||
height="50px"
|
||||
width="50px"
|
||||
class="image remove-bg"
|
||||
:alt="'asdads'"
|
||||
/>
|
||||
<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>
|
||||
:style="{ background: gradientStyle }"
|
||||
class="compatibility"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ value }}
|
||||
</QTooltip>
|
||||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-tags="{ row }">
|
||||
<QTd class="col" align="center"
|
||||
><FetchedTags :item="row" :max-length="5"
|
||||
/></QTd>
|
||||
</template>
|
||||
|
||||
<template #body-cell-price2="{ row, value }">
|
||||
<QTd
|
||||
class="col"
|
||||
|
@ -271,25 +313,14 @@ async function confirm() {
|
|||
@click="proposalSelected = []"
|
||||
/>
|
||||
|
||||
<QBtnDropdown
|
||||
top
|
||||
split
|
||||
:label="t('proposal.replace')"
|
||||
<QBtn
|
||||
:label="t('globals.replace')"
|
||||
color="primary"
|
||||
:loading="isLoading"
|
||||
@click="confirm"
|
||||
:disable="proposalSelected.length < 1 || quantity === 0"
|
||||
unelevated
|
||||
><QList>
|
||||
<QItem clickable @click="confirm">
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
{{ t('proposal.replaceAndConfirm') }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList></QBtnDropdown
|
||||
>
|
||||
/>
|
||||
<QInput
|
||||
v-model.number="quantity"
|
||||
v-if="quantity > -1"
|
||||
|
@ -304,6 +335,10 @@ async function confirm() {
|
|||
</QDialog>
|
||||
</template>
|
||||
<style lang="scss">
|
||||
.compatibility {
|
||||
height: 10px;
|
||||
}
|
||||
|
||||
.match {
|
||||
color: $negative;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,13 @@ import { useStateStore } from 'stores/useStateStore';
|
|||
import { useDialogPluginComponent } from 'quasar';
|
||||
import { useSession } from 'src/composables/useSession';
|
||||
import ZoneDescriptorProxy from 'pages/Zone/Card/ZoneDescriptorProxy.vue';
|
||||
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
onMounted(() => {
|
||||
stateStore.rightDrawer = false;
|
||||
nextTick(() => {
|
||||
componentIsRendered.value = true;
|
||||
});
|
||||
});
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
const { t } = useI18n();
|
||||
const URL_KEY = 'Tickets/ItemLack';
|
||||
|
@ -40,29 +46,27 @@ const showFree = ref(true);
|
|||
const resultSplit = ref([]);
|
||||
const selectedRows = ref([]);
|
||||
const session = useSession();
|
||||
|
||||
import { useRoute } from 'vue-router';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import VnRow from 'src/components/ui/VnRow.vue';
|
||||
const route = useRoute();
|
||||
const token = session.getTokenMultimedia();
|
||||
|
||||
const originalRowDataCopy = ref(null);
|
||||
const $props = defineProps({
|
||||
item: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
filter: {
|
||||
type: Object,
|
||||
required: false,
|
||||
default: () => {
|
||||
true;
|
||||
},
|
||||
},
|
||||
});
|
||||
onMounted(() => {
|
||||
stateStore.rightDrawer = false;
|
||||
nextTick(() => {
|
||||
componentIsRendered.value = true;
|
||||
});
|
||||
});
|
||||
// const $props = defineProps({
|
||||
// item: {
|
||||
// type: Number,
|
||||
// required: true,
|
||||
// },
|
||||
// filter: {
|
||||
// type: Object,
|
||||
// required: false,
|
||||
// default: () => {
|
||||
// true;
|
||||
// },
|
||||
// },
|
||||
// });
|
||||
|
||||
onUnmounted(() => (stateStore.rightDrawer = true));
|
||||
|
||||
const copyOriginalRowsData = (rows) => {
|
||||
|
@ -103,7 +107,8 @@ const saveChange = async (field, { rowIndex, row }) => {
|
|||
console.error('Error saving changes', err);
|
||||
}
|
||||
};
|
||||
const entityId = computed(() => $props.item.itemFk);
|
||||
const entityId = computed(() => route.params.id);
|
||||
const item = ref({});
|
||||
function isComponentVn(col) {
|
||||
return tableColumnComponents?.value[col.name]?.component === 'span' ?? false;
|
||||
}
|
||||
|
@ -241,7 +246,7 @@ const columns = computed(() => [
|
|||
},
|
||||
]);
|
||||
const { dialogRef, onDialogHide } = useDialogPluginComponent();
|
||||
const { filter } = toRefs($props);
|
||||
// const { filter } = toRefs($props);
|
||||
const emit = defineEmits([...useDialogPluginComponent.emits, 'selection', 'close']);
|
||||
function rowsHasSelected(selection) {
|
||||
emit(
|
||||
|
@ -330,25 +335,31 @@ const split = async () => {
|
|||
@on-fetch="(data) => (editableStates = data)"
|
||||
auto-load
|
||||
/>
|
||||
<Teleport to="#st-actions" v-if="stateStore?.isSubToolbarShown()">
|
||||
<FetchData
|
||||
:url="`Items/${entityId}/getCard`"
|
||||
:fields="['longName']"
|
||||
@on-fetch="(data) => (item = data)"
|
||||
auto-load
|
||||
/>
|
||||
<!-- <Teleport to="#st-actions" v-if="stateStore?.isSubToolbarShown()">
|
||||
<QBtnGroup push style="column-gap: 1px"
|
||||
><QBtn
|
||||
:label="t('globals.cancel')"
|
||||
:label="t('proposal.replace')"
|
||||
@click="emit('close')"
|
||||
color="primary"
|
||||
flat
|
||||
icon="close"
|
||||
icon="save"
|
||||
>
|
||||
<QTooltip>{{ t('globals.cancel') }}</QTooltip>
|
||||
</QBtn></QBtnGroup
|
||||
>
|
||||
</Teleport>
|
||||
</Teleport> -->
|
||||
<Teleport to="#st-data" v-if="stateStore?.isSubToolbarShown()">
|
||||
<QSpace />
|
||||
<QBtnGroup push style="column-gap: 1px">
|
||||
<QBtn
|
||||
icon="refresh"
|
||||
color="primary"
|
||||
:label="t('negative.detail.modal.changeState.title')"
|
||||
:label="t('negative.buttonsUpdate.state')"
|
||||
:disable="selectedRows.length < 2"
|
||||
@click="showChangeStateDialog = true"
|
||||
>
|
||||
|
@ -357,8 +368,9 @@ const split = async () => {
|
|||
</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
icon="refresh"
|
||||
color="primary"
|
||||
:label="t('negative.detail.modal.changeQuantity.title')"
|
||||
:label="t('negative.buttonsUpdate.quantity')"
|
||||
@click="showChangeQuantityDialog = true"
|
||||
:disable="selectedRows.length < 2"
|
||||
>
|
||||
|
@ -366,6 +378,17 @@ const split = async () => {
|
|||
{{ t('negative.detail.modal.changeQuantity.title') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
icon="refresh"
|
||||
color="primary"
|
||||
:label="t('negative.buttonsUpdate.itemProposal')"
|
||||
@click="showChangeQuantityDialog = true"
|
||||
:disable="selectedRows.length < 2"
|
||||
>
|
||||
<QTooltip bottom anchor="bottom right">
|
||||
{{ t('negative.itemProposal') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
color="primary"
|
||||
@click="
|
||||
|
@ -384,7 +407,7 @@ const split = async () => {
|
|||
</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
icon="vn:splitline"
|
||||
icon="vn:item"
|
||||
color="primary"
|
||||
:disable="selectedRows.length < 1"
|
||||
@click="showProposalDialog = true"
|
||||
|
@ -396,42 +419,50 @@ const split = async () => {
|
|||
</QBtnGroup>
|
||||
<QCheckbox v-model="showFree" :label="t('negative.detail.showFree')" />
|
||||
</Teleport>
|
||||
<VnPaginate
|
||||
:data-key="URL_KEY"
|
||||
:url="`${URL_KEY}/${entityId}/detail`"
|
||||
ref="itemLackForm"
|
||||
@on-fetch="copyOriginalRowsData($event)"
|
||||
auto-load
|
||||
>
|
||||
<!-- :rows="rows" -->
|
||||
<template #body="{ rows }">
|
||||
<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>
|
||||
|
||||
<QTable
|
||||
ref="tableRef"
|
||||
:columns="columns"
|
||||
:rows="handleRows(rows)"
|
||||
row-key="ticketFk"
|
||||
selection="multiple"
|
||||
v-model:selected="selectedRows"
|
||||
@update:selected="rowsHasSelected"
|
||||
:grid="$q.screen.lt.md"
|
||||
hide-bottom
|
||||
<QPage>
|
||||
<VnSubToolbar />
|
||||
<div class="full-width q-pa-md">
|
||||
<VnPaginate
|
||||
:data-key="URL_KEY"
|
||||
:url="`${URL_KEY}/${entityId}/detail`"
|
||||
ref="itemLackForm"
|
||||
@on-fetch="copyOriginalRowsData($event)"
|
||||
auto-load
|
||||
>
|
||||
<template #body="props">
|
||||
<QTr>
|
||||
<QTd>
|
||||
<!-- <QIcon
|
||||
<!-- :rows="rows" -->
|
||||
<template #body="{ rows }">
|
||||
<!-- <VnRow style="align-items: center">
|
||||
<div>
|
||||
<QImg
|
||||
:src="`/api/Images/catalog/50x50/${entityId}/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>
|
||||
</div>
|
||||
<QIcon name="arrow_right" size="lg" />
|
||||
<VnSelectDialog action-icon="call_split"></VnSelectDialog
|
||||
></VnRow> -->
|
||||
<QTable
|
||||
ref="tableRef"
|
||||
:columns="columns"
|
||||
:rows="handleRows(rows)"
|
||||
row-key="ticketFk"
|
||||
selection="multiple"
|
||||
v-model:selected="selectedRows"
|
||||
@update:selected="rowsHasSelected"
|
||||
:grid="$q.screen.lt.md"
|
||||
hide-bottom
|
||||
>
|
||||
<template #body="props">
|
||||
<QTr>
|
||||
<QTd>
|
||||
<!-- <QIcon
|
||||
v-if="resultSplit.length > 0"
|
||||
:name="getIcon(props.key, 'name')"
|
||||
:color="getIcon(props.key, 'color')"
|
||||
|
@ -439,77 +470,86 @@ const split = async () => {
|
|||
size="xs"
|
||||
style="font-weight: bold"
|
||||
/> -->
|
||||
<QCheckbox v-model="props.selected" />
|
||||
</QTd>
|
||||
<QTd v-for="col in props.cols" :key="col.name">
|
||||
<template v-if="tableColumnComponents[col.name]?.component">
|
||||
<component
|
||||
:is="tableColumnComponents[col.name].component"
|
||||
v-bind="tableColumnComponents[col.name].props"
|
||||
v-model="props.row[col.field]"
|
||||
v-on="
|
||||
tableColumnComponents[col.name].event(
|
||||
col.field,
|
||||
props
|
||||
)
|
||||
"
|
||||
:style="tableColumnComponents[col.name].style"
|
||||
>
|
||||
<template v-if="isComponentVn(col)">{{
|
||||
col.value
|
||||
}}</template>
|
||||
<template v-if="col.name === 'status'">
|
||||
<QIcon
|
||||
v-if="props.row.isRookie"
|
||||
name="vn:person"
|
||||
size="xs"
|
||||
color="primary"
|
||||
class="cursor-pointer"
|
||||
<QCheckbox v-model="props.selected" />
|
||||
</QTd>
|
||||
<QTd v-for="col in props.cols" :key="col.name">
|
||||
<template
|
||||
v-if="tableColumnComponents[col.name]?.component"
|
||||
>
|
||||
<component
|
||||
:is="
|
||||
tableColumnComponents[col.name].component
|
||||
"
|
||||
v-bind="tableColumnComponents[col.name].props"
|
||||
v-model="props.row[col.field]"
|
||||
v-on="
|
||||
tableColumnComponents[col.name].event(
|
||||
col.field,
|
||||
props
|
||||
)
|
||||
"
|
||||
:style="tableColumnComponents[col.name].style"
|
||||
>
|
||||
<QTooltip>{{
|
||||
t('negative.detail.isRookie')
|
||||
}}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="props.row.peticionCompra"
|
||||
name="vn:buyrequest"
|
||||
size="xs"
|
||||
color="primary"
|
||||
class="cursor-pointer"
|
||||
>
|
||||
<QTooltip>{{
|
||||
t('negative.detail.peticionCompra')
|
||||
}}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="props.row.turno"
|
||||
name="vn:calendar"
|
||||
size="xs"
|
||||
color="primary"
|
||||
class="cursor-pointer"
|
||||
>
|
||||
<QTooltip>{{
|
||||
t('negative.detail.turno')
|
||||
}}</QTooltip>
|
||||
</QIcon>
|
||||
<template v-if="isComponentVn(col)">{{
|
||||
col.value
|
||||
}}</template>
|
||||
<template v-if="col.name === 'status'">
|
||||
<QIcon
|
||||
v-if="props.row.isRookie"
|
||||
name="vn:person"
|
||||
size="xs"
|
||||
color="primary"
|
||||
class="cursor-pointer"
|
||||
>
|
||||
<QTooltip>{{
|
||||
t('negative.detail.isRookie')
|
||||
}}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="props.row.peticionCompra"
|
||||
name="vn:buyrequest"
|
||||
size="xs"
|
||||
color="primary"
|
||||
class="cursor-pointer"
|
||||
>
|
||||
<QTooltip>{{
|
||||
t(
|
||||
'negative.detail.peticionCompra'
|
||||
)
|
||||
}}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="props.row.turno"
|
||||
name="vn:calendar"
|
||||
size="xs"
|
||||
color="primary"
|
||||
class="cursor-pointer"
|
||||
>
|
||||
<QTooltip>{{
|
||||
t('negative.detail.turno')
|
||||
}}</QTooltip>
|
||||
</QIcon>
|
||||
</template>
|
||||
<template v-if="col.name === 'ticketFk'"
|
||||
>{{ col.value }}
|
||||
<ItemDescriptorProxy
|
||||
:id="$props.entityId"
|
||||
/></template>
|
||||
<template v-if="col.name === 'zoneName'">
|
||||
{{ col.value }}
|
||||
<ZoneDescriptorProxy
|
||||
:id="props.row.zoneFk"
|
||||
/>
|
||||
</template>
|
||||
</component>
|
||||
</template>
|
||||
<template v-if="col.name === 'ticketFk'"
|
||||
>{{ col.value }}
|
||||
<ItemDescriptorProxy :id="$props.entityId"
|
||||
/></template>
|
||||
<template v-if="col.name === 'zoneName'">
|
||||
{{ col.value }}
|
||||
<ZoneDescriptorProxy :id="props.row.zoneFk" />
|
||||
</template>
|
||||
</component>
|
||||
</template>
|
||||
</QTd>
|
||||
</QTr>
|
||||
</QTd>
|
||||
</QTr>
|
||||
</template>
|
||||
</QTable>
|
||||
</template>
|
||||
</QTable>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
|
||||
</VnPaginate></div
|
||||
></QPage>
|
||||
<ChangeStateDialog
|
||||
ref="changeStateDialogRef"
|
||||
@hide="onDetailDialogHide"
|
||||
|
|
|
@ -16,11 +16,11 @@ const props = defineProps({
|
|||
required: true,
|
||||
},
|
||||
});
|
||||
const arrayData = useArrayData(props.dataKey);
|
||||
const warehouse = ref(null);
|
||||
onMounted(async () => {
|
||||
warehouse.value = arrayData.store?.userParams?.warehouse;
|
||||
});
|
||||
// const arrayData = useArrayData(props.dataKey);
|
||||
// const warehouse = ref(null);
|
||||
// onMounted(async () => {
|
||||
// warehouse.value = arrayData.store?.userParams?.warehouse;
|
||||
// });
|
||||
|
||||
const to = Date.vnNew();
|
||||
to.setDate(to.getDate() + 1);
|
||||
|
@ -49,19 +49,12 @@ const onCategoryChange = async (categoryFk, search) => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData url="Warehouses" @on-fetch="(data) => (warehouses = data)" auto-load />
|
||||
<FetchData
|
||||
url="ItemCategories"
|
||||
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
|
||||
@on-fetch="(data) => (categoriesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
|
||||
<FetchData
|
||||
ref="itemTypesRef"
|
||||
url="ItemTypes"
|
||||
:filter="itemTypesFilter"
|
||||
@on-fetch="(data) => (itemTypesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||
|
@ -114,97 +107,32 @@ const onCategoryChange = async (categoryFk, search) => {
|
|||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QCard bordered>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
:label="t('negative.date')"
|
||||
v-model="params.date"
|
||||
></VnInputDate
|
||||
></QItemSection>
|
||||
</QItem>
|
||||
|
||||
<QItem>
|
||||
<QItemSection
|
||||
><VnInputTime
|
||||
:label="t('negative.timed')"
|
||||
v-model="params.time"
|
||||
></VnInputTime>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QCard>
|
||||
<QCard bordered>
|
||||
<QItem>
|
||||
<QItemSection v-if="categoriesOptions">
|
||||
<VnSelect
|
||||
:label="t('negative.category')"
|
||||
v-model="params.categoryFk"
|
||||
@update:model-value="
|
||||
($event) => onCategoryChange($event, searchFn)
|
||||
"
|
||||
:options="categoriesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/> </QItemSection
|
||||
><QItemSection v-else>
|
||||
<QSkeleton class="full-width" type="QSelect" />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
||||
<QItem>
|
||||
<QItemSection v-if="itemTypesOptions">
|
||||
<VnSelect
|
||||
:label="t('negative.type')"
|
||||
v-model="params.typeFk"
|
||||
@update:model-value="searchFn()"
|
||||
:options="itemTypesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel caption>{{
|
||||
scope.opt?.category?.name
|
||||
}}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect> </QItemSection
|
||||
><QItemSection v-else>
|
||||
<QSkeleton class="full-width" type="QSelect" />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QCard>
|
||||
<QItem>
|
||||
<QItemSection v-if="warehouses">
|
||||
<QItemSection v-if="itemTypesOptions">
|
||||
<VnSelect
|
||||
:label="t('negative.warehouse')"
|
||||
v-model="params.warehouse"
|
||||
:label="t('negative.type')"
|
||||
v-model="params.typeFk"
|
||||
@update:model-value="searchFn()"
|
||||
:options="warehouses"
|
||||
:options="itemTypesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
emit-value
|
||||
map-options
|
||||
use-input
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
:input-debounce="0"
|
||||
/>
|
||||
</QItemSection>
|
||||
<QItemSection v-else>
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel caption>{{
|
||||
scope.opt?.category?.name
|
||||
}}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect> </QItemSection
|
||||
><QItemSection v-else>
|
||||
<QSkeleton class="full-width" type="QSelect" />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
|
|
@ -5,7 +5,7 @@ import { useStateStore } from 'stores/useStateStore';
|
|||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||
import TicketLackFilter from 'pages/Ticket/Negative/TicketLackFilter.vue';
|
||||
import TicketLackDetail from 'pages/Ticket/Negative/TicketLackDetail.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
// import FetchData from 'components/FetchData.vue';
|
||||
|
||||
import NegativeOriginDialog from 'pages/Ticket/Negative/components/NegativeOriginDialog.vue';
|
||||
import TotalNegativeOriginDialog from 'pages/Ticket/Negative/components/TotalNegativeOriginDialog.vue';
|
||||
|
@ -13,24 +13,35 @@ import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
|||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import { onBeforeMount } from 'vue';
|
||||
import { dashIfEmpty, toDate, toHour } from 'src/filters';
|
||||
const DEFAULT_WAREHOUSE = 'Algemesi';
|
||||
import { useRouter } from 'vue-router';
|
||||
// import { useUserConfig } from 'src/composables/useUserConfig';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { useRole } from 'src/composables/useRole';
|
||||
|
||||
// const DEFAULT_WAREHOUSE = 'Algemesi';
|
||||
const router = useRouter();
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const selectedRows = ref([]);
|
||||
const showNegativeOriginDialog = ref(false);
|
||||
const showTotalNegativeOriginDialog = ref(false);
|
||||
const showFilterPanel = ref(false);
|
||||
// const showFilterPanel = ref(false);
|
||||
const currentRow = ref(null);
|
||||
// const state = useState();
|
||||
|
||||
const negativeParams = reactive({
|
||||
days: 2,
|
||||
days: useRole().likeAny('buyer') ? 2 : 0,
|
||||
warehouseFk: useState().getUser().value.warehouseFk,
|
||||
});
|
||||
const viewSummary = (row) => {
|
||||
stateStore.rightDrawer = false;
|
||||
currentRow.value = row;
|
||||
const id = row.itemFk;
|
||||
// stateStore.rightDrawer = false;
|
||||
// currentRow.value = row;
|
||||
router.push({ name: 'NegativeDetail', params: { id } });
|
||||
};
|
||||
const originDialogRef = ref();
|
||||
const totalNegativeDialogRef = ref();
|
||||
// const totalNegativeDialogRef = ref();
|
||||
const columns = computed(() => [
|
||||
{
|
||||
name: 'date',
|
||||
|
@ -100,17 +111,17 @@ const columns = computed(() => [
|
|||
},
|
||||
]);
|
||||
const vnPaginateRef = ref();
|
||||
const ticketDetailRef = ref();
|
||||
// const ticketDetailRef = ref();
|
||||
|
||||
onBeforeMount(() => {
|
||||
stateStore.$state.rightDrawer = true;
|
||||
});
|
||||
|
||||
const handleWarehouses = async (data) => {
|
||||
negativeParams.warehouse = data.find((w) => w.name === DEFAULT_WAREHOUSE).id;
|
||||
await vnPaginateRef.value.fetch();
|
||||
showFilterPanel.value = true;
|
||||
};
|
||||
// const handleWarehouses = async (data) => {
|
||||
// negativeParams.warehouse = data.find((w) => w.name === DEFAULT_WAREHOUSE).id;
|
||||
// await vnPaginateRef.value.fetch();
|
||||
// showFilterPanel.value = true;
|
||||
// };
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -133,7 +144,7 @@ const handleWarehouses = async (data) => {
|
|||
</template>
|
||||
|
||||
<QPage class="column items-center">
|
||||
<FetchData url="Warehouses" @on-fetch="handleWarehouses" auto-load />
|
||||
<!-- <FetchData url="Warehouses" @on-fetch="handleWarehouses" auto-load /> -->
|
||||
<VnSubToolbar class="bg-vn-dark justify-end">
|
||||
<template #st-actions>
|
||||
<QBtnGroup push style="column-gap: 1px" v-if="!currentRow">
|
||||
|
@ -145,23 +156,24 @@ const handleWarehouses = async (data) => {
|
|||
>
|
||||
<QTooltip>{{ t('negative.negativeAction') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
<!-- <QBtn
|
||||
color="primary"
|
||||
@click="showTotalNegativeOriginDialog = true"
|
||||
:label="t('negative.totalNegative')"
|
||||
>
|
||||
<QTooltip>{{ t('negative.totalNegative') }}</QTooltip>
|
||||
</QBtn>
|
||||
</QBtn> -->
|
||||
</QBtnGroup>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
<div v-show="!currentRow" class="list">
|
||||
<div class="list">
|
||||
<VnPaginate
|
||||
ref="vnPaginateRef"
|
||||
data-key="NegativeList"
|
||||
:url="`Tickets/itemLack`"
|
||||
:order="['itemFk DESC, date DESC, timed DESC']"
|
||||
:user-params="negativeParams"
|
||||
auto-load
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QTable
|
||||
|
@ -222,10 +234,10 @@ const handleWarehouses = async (data) => {
|
|||
<template #body-cell-icons="{ value }">
|
||||
<QTd align="center">
|
||||
<QIcon
|
||||
@click.stop="viewSummary(value)"
|
||||
@click="viewSummary(value)"
|
||||
class="q-ml-md"
|
||||
color="primary"
|
||||
name="preview"
|
||||
name="search"
|
||||
size="sm"
|
||||
>
|
||||
<QTooltip>
|
||||
|
@ -238,19 +250,19 @@ const handleWarehouses = async (data) => {
|
|||
</template>
|
||||
</VnPaginate>
|
||||
</div>
|
||||
<div v-if="currentRow" class="list">
|
||||
<!-- <div v-if="currentRow" class="list">
|
||||
<TicketLackDetail
|
||||
ref="ticketDetailRef"
|
||||
:item="currentRow"
|
||||
@close="(evt) => (currentRow = null)"
|
||||
></TicketLackDetail>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<TotalNegativeOriginDialog
|
||||
<!-- <TotalNegativeOriginDialog
|
||||
ref="totalNegativeDialogRef"
|
||||
v-model="showTotalNegativeOriginDialog"
|
||||
@hide="onDialogHide"
|
||||
></TotalNegativeOriginDialog>
|
||||
></TotalNegativeOriginDialog> -->
|
||||
<NegativeOriginDialog
|
||||
ref="originDialogRef"
|
||||
@hide="onDialogHide"
|
||||
|
@ -260,7 +272,7 @@ const handleWarehouses = async (data) => {
|
|||
</NegativeOriginDialog>
|
||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||
<QScrollArea class="fit text-grey-8">
|
||||
<TicketLackFilter v-if="showFilterPanel" data-key="NegativeList" />
|
||||
<TicketLackFilter data-key="NegativeList" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
</QPage>
|
||||
|
|
|
@ -24,10 +24,14 @@ negative:
|
|||
negativeAction: 'Negativo'
|
||||
totalNegative: 'Total negativos'
|
||||
days: Rango de dias
|
||||
buttonsUpdate:
|
||||
itemProposal: artículo
|
||||
state: Estado
|
||||
quantity: Cantidad
|
||||
|
||||
modalOrigin:
|
||||
title: 'Actualizar negativos'
|
||||
question: 'Seleccione un estado para guardar'
|
||||
|
||||
modalSplit:
|
||||
title: Confirmar acción de split
|
||||
question: 'Selecciona un estado'
|
||||
|
|
|
@ -12,7 +12,7 @@ export default {
|
|||
redirect: { name: 'TicketMain' },
|
||||
menus: {
|
||||
main: ['TicketList', 'TicketNegative'],
|
||||
card: ['TicketBoxing', 'TicketSms', 'TicketSale'],
|
||||
card: ['TicketBoxing', 'TicketSms', 'TicketSale', 'NegativeDetail'],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
@ -31,14 +31,32 @@ export default {
|
|||
component: () => import('src/pages/Ticket/TicketList.vue'),
|
||||
},
|
||||
{
|
||||
name: 'TicketNegative',
|
||||
path: 'negative',
|
||||
meta: {
|
||||
title: 'negative',
|
||||
icon: 'view_list',
|
||||
},
|
||||
component: () =>
|
||||
import('src/pages/Ticket/Negative/TicketLackList.vue'),
|
||||
redirect: { name: 'TicketNegative' },
|
||||
|
||||
children: [
|
||||
{
|
||||
name: 'TicketNegative',
|
||||
path: '',
|
||||
meta: {
|
||||
title: 'negative',
|
||||
icon: 'view_list',
|
||||
},
|
||||
// redirect: { name: 'TicketNegative' },
|
||||
component: () =>
|
||||
import('src/pages/Ticket/Negative/TicketLackList.vue'),
|
||||
},
|
||||
{
|
||||
name: 'NegativeDetail',
|
||||
path: ':id',
|
||||
meta: {
|
||||
title: 'summary',
|
||||
icon: 'launch',
|
||||
},
|
||||
component: () =>
|
||||
import('src/pages/Ticket/Negative/TicketLackDetail.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'TicketCreate',
|
||||
|
|
Loading…
Reference in New Issue