updates
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javier Segarra 2024-06-14 13:44:33 +02:00
parent 679710eb4d
commit 7b047e1637
7 changed files with 364 additions and 317 deletions

View File

@ -27,10 +27,20 @@ export function useRole() {
return false; 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 { return {
fetch, fetch,
hasAny, hasAny,
likeAny,
state, state,
}; };
} }

View File

@ -3,11 +3,17 @@ import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnPaginate from 'components/ui/VnPaginate.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue'; import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import FetchedTags from 'components/ui/FetchedTags.vue';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
const { t } = useI18n(); const { t } = useI18n();
const session = useSession(); 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({ const $props = defineProps({
item: { item: {
type: Object, type: Object,
@ -30,36 +36,39 @@ const defaultColumnAttrs = {
align: 'left', align: 'left',
sortable: true, sortable: true,
}; };
const compatibility = ref(null);
// const compatibility = computed(() => `linear-gradient(to right,red 10%, white 10%);`);
const statusConditionalValue = (row) => { const statusConditionalValue = (row) => {
const total = [5, 6, 7, 8].reduce((acc, i) => acc + row[`match${i}`], 0); const values = [5, 6, 7, 8];
const STATUS_VALUES = { 2: '$secondary', 3: 'positive', 4: 'warning' }; const total = values.reduce((acc, i) => acc + row[`match${i}`], 0);
const status = STATUS_VALUES[total - 2]; const STATUS_VALUES = { 1: 'white', 2: '$secondary', 3: 'positive', 4: 'warning' };
if (!status) return 'white'; const status = STATUS_VALUES[total];
return status; 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) => const conditionalValuePrice = (price) =>
price > currentTicket.value.price * 1.3 ? 'match' : 'not-match'; price > currentTicket.value.price * 1.3 ? 'match' : 'not-match';
const changeTicket = (type, _index = 0) => { // const changeTicket = (type, _index = 0) => {
const value = type ? 1 : -1; // const value = type ? 1 : -1;
const nextIndex = index.value + value + _index; // const nextIndex = index.value + value + _index;
const ticket = $props.tickets[nextIndex]; // const ticket = $props.tickets[nextIndex];
if (ticket.ticketFk === currentTicket.value.ticketFk) // if (ticket.ticketFk === currentTicket.value.ticketFk)
return changeTicket(true, nextIndex - 1); // return changeTicket(true, nextIndex - 1);
index.value = nextIndex; // index.value = nextIndex;
}; // };
const columns = computed(() => [ const columns = computed(() => [
{ {
...defaultColumnAttrs, ...defaultColumnAttrs,
label: t('proposal.counter'), label: t('proposal.available'),
name: 'counter', name: 'available',
field: 'counter', field: 'available',
}, },
{ {
...defaultColumnAttrs, ...defaultColumnAttrs,
label: t('proposal.itemFk'), label: t('proposal.difference'),
name: 'id', name: 'difference',
field: 'id', field: (item) => 21,
}, },
{ {
...defaultColumnAttrs, ...defaultColumnAttrs,
@ -67,6 +76,13 @@ const columns = computed(() => [
name: 'status', name: 'status',
field: statusConditionalValue, field: statusConditionalValue,
}, },
{
...defaultColumnAttrs,
label: t('proposal.counter'),
name: 'counter',
field: 'counter',
},
{ {
align: 'center', align: 'center',
sortable: true, sortable: true,
@ -74,13 +90,13 @@ const columns = computed(() => [
name: 'longName', name: 'longName',
field: 'longName', field: 'longName',
}, },
{ // {
...defaultColumnAttrs, // ...defaultColumnAttrs,
label: t('proposal.subName'), // label: t('proposal.subName'),
name: 'subName', // name: 'subName',
field: 'subName', // field: 'subName',
}, // },
{ /*{
...defaultColumnAttrs, ...defaultColumnAttrs,
label: t('proposal.value5'), label: t('proposal.value5'),
name: 'value5', name: 'value5',
@ -107,12 +123,18 @@ const columns = computed(() => [
name: 'value8', name: 'value8',
field: 'value8', field: 'value8',
classes: ({ match8 }) => conditionalValue(match8), classes: ({ match8 }) => conditionalValue(match8),
}, },*/
{ {
...defaultColumnAttrs, ...defaultColumnAttrs,
label: t('proposal.available'), label: t('proposal.tags'),
name: 'available', name: 'tags',
field: 'available', },
{
...defaultColumnAttrs,
label: t('proposal.price2'),
name: 'price2',
field: 'price2',
}, },
{ {
...defaultColumnAttrs, ...defaultColumnAttrs,
@ -120,12 +142,6 @@ const columns = computed(() => [
name: 'minQuantity', name: 'minQuantity',
field: 'minQuantity', field: 'minQuantity',
}, },
{
...defaultColumnAttrs,
label: t('proposal.price2'),
name: 'price2',
field: 'price2',
},
{ {
...defaultColumnAttrs, ...defaultColumnAttrs,
label: t('proposal.located'), label: t('proposal.located'),
@ -156,7 +172,7 @@ async function confirm() {
<QCard class="q-pa-lg"> <QCard class="q-pa-lg">
<QCardSection class="row items-center q-pb-none"> <QCardSection class="row items-center q-pb-none">
<QImg <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" spinner-color="primary"
:ratio="1" :ratio="1"
height="50px" height="50px"
@ -166,6 +182,9 @@ async function confirm() {
/> />
<span class="text-h6">{{ item.longName }}</span> <span class="text-h6">{{ item.longName }}</span>
<span class="text"
><sub>{{ item.longName }}</sub></span
>
<QSpace /> <QSpace />
<QBtn icon="close" flat round dense v-close-popup /> <QBtn icon="close" flat round dense v-close-popup />
</QCardSection> </QCardSection>
@ -233,18 +252,41 @@ async function confirm() {
</template> </template>
<template #body-cell-longName="{ row, value }"> <template #body-cell-longName="{ row, value }">
<QTd align="right" class="text-primary"> <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> <QBtn flat color="blue" dense>{{ value }}</QBtn>
<ItemDescriptorProxy :id="row.id" /> <ItemDescriptorProxy :id="row.id" />
</QTd> </QTd>
</template> </template>
<template #body-cell-status="{ value }"> <template #body-cell-status="{ value }">
<QTd class="col" align="center"> <QTd class="col" align="center">
<div <div
:style="{ 'background-color': value }" :style="{ background: gradientStyle }"
style="height: 10px" class="compatibility"
></div> >
<QTooltip>
{{ value }}
</QTooltip>
</div>
</QTd> </QTd>
</template> </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 }"> <template #body-cell-price2="{ row, value }">
<QTd <QTd
class="col" class="col"
@ -271,25 +313,14 @@ async function confirm() {
@click="proposalSelected = []" @click="proposalSelected = []"
/> />
<QBtnDropdown <QBtn
top :label="t('globals.replace')"
split
:label="t('proposal.replace')"
color="primary" color="primary"
:loading="isLoading" :loading="isLoading"
@click="confirm" @click="confirm"
:disable="proposalSelected.length < 1 || quantity === 0" :disable="proposalSelected.length < 1 || quantity === 0"
unelevated unelevated
><QList> />
<QItem clickable @click="confirm">
<QItemSection>
<QItemLabel>
{{ t('proposal.replaceAndConfirm') }}
</QItemLabel>
</QItemSection>
</QItem>
</QList></QBtnDropdown
>
<QInput <QInput
v-model.number="quantity" v-model.number="quantity"
v-if="quantity > -1" v-if="quantity > -1"
@ -304,6 +335,10 @@ async function confirm() {
</QDialog> </QDialog>
</template> </template>
<style lang="scss"> <style lang="scss">
.compatibility {
height: 10px;
}
.match { .match {
color: $negative; color: $negative;
} }

View File

@ -20,7 +20,13 @@ import { useStateStore } from 'stores/useStateStore';
import { useDialogPluginComponent } from 'quasar'; import { useDialogPluginComponent } from 'quasar';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import ZoneDescriptorProxy from 'pages/Zone/Card/ZoneDescriptorProxy.vue'; 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 { openConfirmationModal } = useVnConfirm();
const { t } = useI18n(); const { t } = useI18n();
const URL_KEY = 'Tickets/ItemLack'; const URL_KEY = 'Tickets/ItemLack';
@ -40,29 +46,27 @@ const showFree = ref(true);
const resultSplit = ref([]); const resultSplit = ref([]);
const selectedRows = ref([]); const selectedRows = ref([]);
const session = useSession(); 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 token = session.getTokenMultimedia();
const originalRowDataCopy = ref(null); const originalRowDataCopy = ref(null);
const $props = defineProps({ // const $props = defineProps({
item: { // item: {
type: Number, // type: Number,
required: true, // required: true,
}, // },
filter: { // filter: {
type: Object, // type: Object,
required: false, // required: false,
default: () => { // default: () => {
true; // true;
}, // },
}, // },
}); // });
onMounted(() => {
stateStore.rightDrawer = false;
nextTick(() => {
componentIsRendered.value = true;
});
});
onUnmounted(() => (stateStore.rightDrawer = true)); onUnmounted(() => (stateStore.rightDrawer = true));
const copyOriginalRowsData = (rows) => { const copyOriginalRowsData = (rows) => {
@ -103,7 +107,8 @@ const saveChange = async (field, { rowIndex, row }) => {
console.error('Error saving changes', err); console.error('Error saving changes', err);
} }
}; };
const entityId = computed(() => $props.item.itemFk); const entityId = computed(() => route.params.id);
const item = ref({});
function isComponentVn(col) { function isComponentVn(col) {
return tableColumnComponents?.value[col.name]?.component === 'span' ?? false; return tableColumnComponents?.value[col.name]?.component === 'span' ?? false;
} }
@ -241,7 +246,7 @@ const columns = computed(() => [
}, },
]); ]);
const { dialogRef, onDialogHide } = useDialogPluginComponent(); const { dialogRef, onDialogHide } = useDialogPluginComponent();
const { filter } = toRefs($props); // const { filter } = toRefs($props);
const emit = defineEmits([...useDialogPluginComponent.emits, 'selection', 'close']); const emit = defineEmits([...useDialogPluginComponent.emits, 'selection', 'close']);
function rowsHasSelected(selection) { function rowsHasSelected(selection) {
emit( emit(
@ -330,25 +335,31 @@ const split = async () => {
@on-fetch="(data) => (editableStates = data)" @on-fetch="(data) => (editableStates = data)"
auto-load 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" <QBtnGroup push style="column-gap: 1px"
><QBtn ><QBtn
:label="t('globals.cancel')" :label="t('proposal.replace')"
@click="emit('close')" @click="emit('close')"
color="primary" color="primary"
flat icon="save"
icon="close"
> >
<QTooltip>{{ t('globals.cancel') }}</QTooltip> <QTooltip>{{ t('globals.cancel') }}</QTooltip>
</QBtn></QBtnGroup </QBtn></QBtnGroup
> >
</Teleport> </Teleport> -->
<Teleport to="#st-data" v-if="stateStore?.isSubToolbarShown()"> <Teleport to="#st-data" v-if="stateStore?.isSubToolbarShown()">
<QSpace /> <QSpace />
<QBtnGroup push style="column-gap: 1px"> <QBtnGroup push style="column-gap: 1px">
<QBtn <QBtn
icon="refresh"
color="primary" color="primary"
:label="t('negative.detail.modal.changeState.title')" :label="t('negative.buttonsUpdate.state')"
:disable="selectedRows.length < 2" :disable="selectedRows.length < 2"
@click="showChangeStateDialog = true" @click="showChangeStateDialog = true"
> >
@ -357,8 +368,9 @@ const split = async () => {
</QTooltip> </QTooltip>
</QBtn> </QBtn>
<QBtn <QBtn
icon="refresh"
color="primary" color="primary"
:label="t('negative.detail.modal.changeQuantity.title')" :label="t('negative.buttonsUpdate.quantity')"
@click="showChangeQuantityDialog = true" @click="showChangeQuantityDialog = true"
:disable="selectedRows.length < 2" :disable="selectedRows.length < 2"
> >
@ -366,6 +378,17 @@ const split = async () => {
{{ t('negative.detail.modal.changeQuantity.title') }} {{ t('negative.detail.modal.changeQuantity.title') }}
</QTooltip> </QTooltip>
</QBtn> </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 <QBtn
color="primary" color="primary"
@click=" @click="
@ -384,7 +407,7 @@ const split = async () => {
</QTooltip> </QTooltip>
</QBtn> </QBtn>
<QBtn <QBtn
icon="vn:splitline" icon="vn:item"
color="primary" color="primary"
:disable="selectedRows.length < 1" :disable="selectedRows.length < 1"
@click="showProposalDialog = true" @click="showProposalDialog = true"
@ -396,6 +419,9 @@ 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>
<QPage>
<VnSubToolbar />
<div class="full-width q-pa-md">
<VnPaginate <VnPaginate
:data-key="URL_KEY" :data-key="URL_KEY"
:url="`${URL_KEY}/${entityId}/detail`" :url="`${URL_KEY}/${entityId}/detail`"
@ -405,8 +431,10 @@ const split = async () => {
> >
<!-- :rows="rows" --> <!-- :rows="rows" -->
<template #body="{ rows }"> <template #body="{ rows }">
<!-- <VnRow style="align-items: center">
<div>
<QImg <QImg
:src="`/api/Images/catalog/50x50/${item.itemFk}/download?access_token=${token}`" :src="`/api/Images/catalog/50x50/${entityId}/download?access_token=${token}`"
spinner-color="primary" spinner-color="primary"
:ratio="1" :ratio="1"
height="50px" height="50px"
@ -416,7 +444,10 @@ const split = async () => {
/> />
<span class="text-h6">{{ item.longName }}</span> <span class="text-h6">{{ item.longName }}</span>
</div>
<QIcon name="arrow_right" size="lg" />
<VnSelectDialog action-icon="call_split"></VnSelectDialog
></VnRow> -->
<QTable <QTable
ref="tableRef" ref="tableRef"
:columns="columns" :columns="columns"
@ -442,9 +473,13 @@ const split = async () => {
<QCheckbox v-model="props.selected" /> <QCheckbox v-model="props.selected" />
</QTd> </QTd>
<QTd v-for="col in props.cols" :key="col.name"> <QTd v-for="col in props.cols" :key="col.name">
<template v-if="tableColumnComponents[col.name]?.component"> <template
v-if="tableColumnComponents[col.name]?.component"
>
<component <component
:is="tableColumnComponents[col.name].component" :is="
tableColumnComponents[col.name].component
"
v-bind="tableColumnComponents[col.name].props" v-bind="tableColumnComponents[col.name].props"
v-model="props.row[col.field]" v-model="props.row[col.field]"
v-on=" v-on="
@ -478,7 +513,9 @@ const split = async () => {
class="cursor-pointer" class="cursor-pointer"
> >
<QTooltip>{{ <QTooltip>{{
t('negative.detail.peticionCompra') t(
'negative.detail.peticionCompra'
)
}}</QTooltip> }}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
@ -495,11 +532,14 @@ const split = async () => {
</template> </template>
<template v-if="col.name === 'ticketFk'" <template v-if="col.name === 'ticketFk'"
>{{ col.value }} >{{ col.value }}
<ItemDescriptorProxy :id="$props.entityId" <ItemDescriptorProxy
:id="$props.entityId"
/></template> /></template>
<template v-if="col.name === 'zoneName'"> <template v-if="col.name === 'zoneName'">
{{ col.value }} {{ col.value }}
<ZoneDescriptorProxy :id="props.row.zoneFk" /> <ZoneDescriptorProxy
:id="props.row.zoneFk"
/>
</template> </template>
</component> </component>
</template> </template>
@ -508,8 +548,8 @@ const split = async () => {
</template> </template>
</QTable> </QTable>
</template> </template>
</VnPaginate> </VnPaginate></div
></QPage>
<ChangeStateDialog <ChangeStateDialog
ref="changeStateDialogRef" ref="changeStateDialogRef"
@hide="onDetailDialogHide" @hide="onDetailDialogHide"

View File

@ -16,11 +16,11 @@ const props = defineProps({
required: true, required: true,
}, },
}); });
const arrayData = useArrayData(props.dataKey); // const arrayData = useArrayData(props.dataKey);
const warehouse = ref(null); // const warehouse = ref(null);
onMounted(async () => { // onMounted(async () => {
warehouse.value = arrayData.store?.userParams?.warehouse; // warehouse.value = arrayData.store?.userParams?.warehouse;
}); // });
const to = Date.vnNew(); const to = Date.vnNew();
to.setDate(to.getDate() + 1); to.setDate(to.getDate() + 1);
@ -49,19 +49,12 @@ const onCategoryChange = async (categoryFk, search) => {
</script> </script>
<template> <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 <FetchData
ref="itemTypesRef" ref="itemTypesRef"
url="ItemTypes" url="ItemTypes"
:filter="itemTypesFilter" :filter="itemTypesFilter"
@on-fetch="(data) => (itemTypesOptions = data)" @on-fetch="(data) => (itemTypesOptions = data)"
auto-load
/> />
<VnFilterPanel :data-key="props.dataKey" :search-button="true"> <VnFilterPanel :data-key="props.dataKey" :search-button="true">
@ -114,47 +107,6 @@ const onCategoryChange = async (categoryFk, search) => {
/> />
</QItemSection> </QItemSection>
</QItem> </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> <QItem>
<QItemSection v-if="itemTypesOptions"> <QItemSection v-if="itemTypesOptions">
<VnSelect <VnSelect
@ -184,30 +136,6 @@ const onCategoryChange = async (categoryFk, search) => {
<QSkeleton class="full-width" type="QSelect" /> <QSkeleton class="full-width" type="QSelect" />
</QItemSection> </QItemSection>
</QItem> </QItem>
</QCard>
<QItem>
<QItemSection v-if="warehouses">
<VnSelect
:label="t('negative.warehouse')"
v-model="params.warehouse"
@update:model-value="searchFn()"
:options="warehouses"
option-value="id"
option-label="name"
emit-value
map-options
use-input
hide-selected
dense
outlined
rounded
:input-debounce="0"
/>
</QItemSection>
<QItemSection v-else>
<QSkeleton class="full-width" type="QSelect" />
</QItemSection>
</QItem>
</QList> </QList>
</template> </template>
</VnFilterPanel> </VnFilterPanel>

View File

@ -5,7 +5,7 @@ import { useStateStore } from 'stores/useStateStore';
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnPaginate from 'components/ui/VnPaginate.vue';
import TicketLackFilter from 'pages/Ticket/Negative/TicketLackFilter.vue'; import TicketLackFilter from 'pages/Ticket/Negative/TicketLackFilter.vue';
import TicketLackDetail from 'pages/Ticket/Negative/TicketLackDetail.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 NegativeOriginDialog from 'pages/Ticket/Negative/components/NegativeOriginDialog.vue';
import TotalNegativeOriginDialog from 'pages/Ticket/Negative/components/TotalNegativeOriginDialog.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 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';
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 stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
const selectedRows = ref([]); const selectedRows = ref([]);
const showNegativeOriginDialog = ref(false); const showNegativeOriginDialog = ref(false);
const showTotalNegativeOriginDialog = ref(false); const showTotalNegativeOriginDialog = ref(false);
const showFilterPanel = ref(false); // const showFilterPanel = ref(false);
const currentRow = ref(null); const currentRow = ref(null);
// const state = useState();
const negativeParams = reactive({ const negativeParams = reactive({
days: 2, days: useRole().likeAny('buyer') ? 2 : 0,
warehouseFk: useState().getUser().value.warehouseFk,
}); });
const viewSummary = (row) => { const viewSummary = (row) => {
stateStore.rightDrawer = false; const id = row.itemFk;
currentRow.value = row; // stateStore.rightDrawer = false;
// currentRow.value = row;
router.push({ name: 'NegativeDetail', params: { id } });
}; };
const originDialogRef = ref(); const originDialogRef = ref();
const totalNegativeDialogRef = ref(); // const totalNegativeDialogRef = ref();
const columns = computed(() => [ const columns = computed(() => [
{ {
name: 'date', name: 'date',
@ -100,17 +111,17 @@ const columns = computed(() => [
}, },
]); ]);
const vnPaginateRef = ref(); const vnPaginateRef = ref();
const ticketDetailRef = ref(); // const ticketDetailRef = ref();
onBeforeMount(() => { onBeforeMount(() => {
stateStore.$state.rightDrawer = true; stateStore.$state.rightDrawer = true;
}); });
const handleWarehouses = async (data) => { // const handleWarehouses = async (data) => {
negativeParams.warehouse = data.find((w) => w.name === DEFAULT_WAREHOUSE).id; // negativeParams.warehouse = data.find((w) => w.name === DEFAULT_WAREHOUSE).id;
await vnPaginateRef.value.fetch(); // await vnPaginateRef.value.fetch();
showFilterPanel.value = true; // showFilterPanel.value = true;
}; // };
</script> </script>
<template> <template>
@ -133,7 +144,7 @@ const handleWarehouses = async (data) => {
</template> </template>
<QPage class="column items-center"> <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"> <VnSubToolbar class="bg-vn-dark justify-end">
<template #st-actions> <template #st-actions>
<QBtnGroup push style="column-gap: 1px" v-if="!currentRow"> <QBtnGroup push style="column-gap: 1px" v-if="!currentRow">
@ -145,23 +156,24 @@ const handleWarehouses = async (data) => {
> >
<QTooltip>{{ t('negative.negativeAction') }}</QTooltip> <QTooltip>{{ t('negative.negativeAction') }}</QTooltip>
</QBtn> </QBtn>
<QBtn <!-- <QBtn
color="primary" color="primary"
@click="showTotalNegativeOriginDialog = true" @click="showTotalNegativeOriginDialog = true"
:label="t('negative.totalNegative')" :label="t('negative.totalNegative')"
> >
<QTooltip>{{ t('negative.totalNegative') }}</QTooltip> <QTooltip>{{ t('negative.totalNegative') }}</QTooltip>
</QBtn> </QBtn> -->
</QBtnGroup> </QBtnGroup>
</template> </template>
</VnSubToolbar> </VnSubToolbar>
<div v-show="!currentRow" class="list"> <div class="list">
<VnPaginate <VnPaginate
ref="vnPaginateRef" ref="vnPaginateRef"
data-key="NegativeList" data-key="NegativeList"
:url="`Tickets/itemLack`" :url="`Tickets/itemLack`"
:order="['itemFk DESC, date DESC, timed DESC']" :order="['itemFk DESC, date DESC, timed DESC']"
:user-params="negativeParams" :user-params="negativeParams"
auto-load
> >
<template #body="{ rows }"> <template #body="{ rows }">
<QTable <QTable
@ -222,10 +234,10 @@ const handleWarehouses = async (data) => {
<template #body-cell-icons="{ value }"> <template #body-cell-icons="{ value }">
<QTd align="center"> <QTd align="center">
<QIcon <QIcon
@click.stop="viewSummary(value)" @click="viewSummary(value)"
class="q-ml-md" class="q-ml-md"
color="primary" color="primary"
name="preview" name="search"
size="sm" size="sm"
> >
<QTooltip> <QTooltip>
@ -238,19 +250,19 @@ const handleWarehouses = async (data) => {
</template> </template>
</VnPaginate> </VnPaginate>
</div> </div>
<div v-if="currentRow" class="list"> <!-- <div v-if="currentRow" class="list">
<TicketLackDetail <TicketLackDetail
ref="ticketDetailRef" ref="ticketDetailRef"
:item="currentRow" :item="currentRow"
@close="(evt) => (currentRow = null)" @close="(evt) => (currentRow = null)"
></TicketLackDetail> ></TicketLackDetail>
</div> </div> -->
<TotalNegativeOriginDialog <!-- <TotalNegativeOriginDialog
ref="totalNegativeDialogRef" ref="totalNegativeDialogRef"
v-model="showTotalNegativeOriginDialog" v-model="showTotalNegativeOriginDialog"
@hide="onDialogHide" @hide="onDialogHide"
></TotalNegativeOriginDialog> ></TotalNegativeOriginDialog> -->
<NegativeOriginDialog <NegativeOriginDialog
ref="originDialogRef" ref="originDialogRef"
@hide="onDialogHide" @hide="onDialogHide"
@ -260,7 +272,7 @@ const handleWarehouses = async (data) => {
</NegativeOriginDialog> </NegativeOriginDialog>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above> <QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8"> <QScrollArea class="fit text-grey-8">
<TicketLackFilter v-if="showFilterPanel" data-key="NegativeList" /> <TicketLackFilter data-key="NegativeList" />
</QScrollArea> </QScrollArea>
</QDrawer> </QDrawer>
</QPage> </QPage>

View File

@ -24,10 +24,14 @@ negative:
negativeAction: 'Negativo' negativeAction: 'Negativo'
totalNegative: 'Total negativos' totalNegative: 'Total negativos'
days: Rango de dias days: Rango de dias
buttonsUpdate:
itemProposal: artículo
state: Estado
quantity: Cantidad
modalOrigin: modalOrigin:
title: 'Actualizar negativos' title: 'Actualizar negativos'
question: 'Seleccione un estado para guardar' question: 'Seleccione un estado para guardar'
modalSplit: modalSplit:
title: Confirmar acción de split title: Confirmar acción de split
question: 'Selecciona un estado' question: 'Selecciona un estado'

View File

@ -12,7 +12,7 @@ export default {
redirect: { name: 'TicketMain' }, redirect: { name: 'TicketMain' },
menus: { menus: {
main: ['TicketList', 'TicketNegative'], main: ['TicketList', 'TicketNegative'],
card: ['TicketBoxing', 'TicketSms', 'TicketSale'], card: ['TicketBoxing', 'TicketSms', 'TicketSale', 'NegativeDetail'],
}, },
children: [ children: [
{ {
@ -31,15 +31,33 @@ export default {
component: () => import('src/pages/Ticket/TicketList.vue'), component: () => import('src/pages/Ticket/TicketList.vue'),
}, },
{ {
name: 'TicketNegative',
path: 'negative', path: 'negative',
redirect: { name: 'TicketNegative' },
children: [
{
name: 'TicketNegative',
path: '',
meta: { meta: {
title: 'negative', title: 'negative',
icon: 'view_list', icon: 'view_list',
}, },
// redirect: { name: 'TicketNegative' },
component: () => component: () =>
import('src/pages/Ticket/Negative/TicketLackList.vue'), 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', name: 'TicketCreate',
path: 'create', path: 'create',