Item requests #297

Merged
jsegarra merged 24 commits from :feature/ItemRequests into dev 2024-04-26 06:22:11 +00:00
1 changed files with 114 additions and 122 deletions
Showing only changes of commit 8e6538b369 - Show all commits

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, computed, onMounted, onBeforeMount } from 'vue';
import { ref, computed, onMounted, onBeforeMount, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
@ -8,10 +8,10 @@ import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import VnInput from 'src/components/common/VnInput.vue';
import ItemRequestDenyForm from './ItemRequestDenyForm.vue';
import ItemRequestFilter from './ItemRequestFilter.vue';
import VnPaginate from 'components/ui/VnPaginate.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import { useStateStore } from 'stores/useStateStore';
import { useArrayData } from 'composables/useArrayData';
import { toDateFormat } from 'src/filters/date';
import { toCurrency } from 'filters/index';
import useNotify from 'src/composables/useNotify.js';
@ -27,6 +27,17 @@ const denyFormRef = ref(null);
const denyRequestId = ref(null);
const denyRequestIndex = ref(null);
const itemRequestsOptions = ref([]);
const arrayData = useArrayData('ItemRequests', {
url: 'TicketRequests/filter',
userParams: filterParams,
order: ['shippedDate ASC', 'isOk ASC'],
});
const store = arrayData.store;
watch(
() => store.data,
(value) => (itemRequestsOptions.value = value)
);
const columns = computed(() => [
{
@ -122,7 +133,7 @@ const changeQuantity = async (request) => {
};
await axios.patch(`Sales/${request.saleFk}`, params);
notify(t('globals.dataSaved', 'positive'));
notify(t('globals.dataSaved'), 'positive');
confirmRequest(request);
} else confirmRequest(request);
} catch (error) {
@ -145,7 +156,7 @@ const confirmRequest = async (request) => {
request.itemDescription = data.concept;
request.isOk = true;
notify(t('globals.dataSaved', 'positive'));
notify(t('globals.dataSaved'), 'positive');
}
} catch (error) {
console.error('Error confirming request:: ', error);
@ -174,6 +185,7 @@ const onDenyAccept = (_, responseData) => {
};
onMounted(async () => {
await arrayData.fetch({ append: false });
stateStore.rightDrawer = true;
});
@ -228,127 +240,107 @@ onBeforeMount(() => {
</QScrollArea>
</QDrawer>
<QPage class="column items-center q-pa-md">
<VnPaginate
ref="paginateRef"
data-key="ItemRequests"
url="TicketRequests/filter"
:order="['shippedDate ASC', 'isOk ASC']"
:user-params="filterParams"
:limit="12"
:offset="50"
auto-load
<QTable
:rows="itemRequestsOptions"
:columns="columns"
row-key="id"
:pagination="{ rowsPerPage: 0 }"
class="full-width q-mt-md"
:no-data-label="t('globals.noResults')"
>
<template #body="{ rows }">
<QTable
:rows="rows"
:columns="columns"
row-key="id"
:pagination="{ rowsPerPage: 0 }"
class="full-width q-mt-md"
:no-data-label="t('globals.noResults')"
>
<template #body-cell-id="{ row }">
<QTd>
<QBtn flat color="primary"> {{ row.ticketFk }}</QBtn>
<TicketDescriptorProxy :id="row.ticketFk" />
</QTd>
</template>
<template #body-cell-shipped="{ row }">
<QTd>
<QBadge
v-if="getDateQBadgeColor(row.shipped)"
:color="getDateQBadgeColor(row.shipped)"
text-color="black"
class="q-ma-none"
dense
style="font-size: 14px"
>
{{ toDateFormat(row.shipped) }}
</QBadge>
<span v-else>{{ toDateFormat(row.shipped) }}</span>
</QTd>
</template>
<template #body-cell-requester="{ row }">
<QTd>
<QBtn flat dense color="primary">
{{ row.requesterName }}</QBtn
>
<WorkerDescriptorProxy :id="row.requesterFk" />
</QTd>
</template>
<template #body-cell-attender="{ row }">
<QTd>
<QBtn flat dense color="primary">
{{ row.attenderName }}</QBtn
>
<WorkerDescriptorProxy :id="row.attenderFk" />
</QTd>
</template>
<template #body-cell-item="{ row }">
<QTd>
<VnInput
class="dense"
v-model.number="row.itemFk"
type="number"
:disable="row.isOk != null"
/>
</QTd>
</template>
<template #body-cell-achieved="{ row }">
<QTd>
<VnInput
class="dense"
v-model.number="row.saleQuantity"
@change="changeQuantity(row)"
type="number"
:disable="!row.itemFk || row.isOk != null"
/>
</QTd>
</template>
<template #body-cell-concept="{ row }">
<QTd>
<QBtn flat dense color="primary">
{{ row.itemDescription }}</QBtn
>
<ItemDescriptorProxy :id="row.itemFk" />
</QTd>
</template>
<template #body-cell-state="{ row }">
<QTd>
<span>{{ getState(row.isOk) }}</span>
</QTd>
</template>
<template #body-cell-action="{ row, rowIndex }">
<QTd>
<QIcon
v-if="row.response?.length"
name="insert_drive_file"
color="primary"
size="sm"
>
<QTooltip>
{{ row.response }}
</QTooltip>
</QIcon>
<QIcon
v-if="row.isOk == null"
name="thumb_down"
color="primary"
size="sm"
class="cursor-pointer"
@click="showDenyRequestForm(row.id, rowIndex)"
>
<QTooltip>
{{ t('Discard') }}
</QTooltip>
</QIcon>
</QTd>
</template>
</QTable>
<template #body-cell-id="{ row }">
<QTd>
<QBtn flat color="primary"> {{ row.ticketFk }}</QBtn>
<TicketDescriptorProxy :id="row.ticketFk" />
</QTd>
</template>
</VnPaginate>
<template #body-cell-shipped="{ row }">
<QTd>
<QBadge
v-if="getDateQBadgeColor(row.shipped)"
:color="getDateQBadgeColor(row.shipped)"
text-color="black"
class="q-ma-none"
dense
style="font-size: 14px"
>
{{ toDateFormat(row.shipped) }}
</QBadge>
<span v-else>{{ toDateFormat(row.shipped) }}</span>
</QTd>
</template>
<template #body-cell-requester="{ row }">
<QTd>
<QBtn flat dense color="primary"> {{ row.requesterName }}</QBtn>
<WorkerDescriptorProxy :id="row.requesterFk" />
</QTd>
</template>
<template #body-cell-attender="{ row }">
<QTd>
<QBtn flat dense color="primary"> {{ row.attenderName }}</QBtn>
<WorkerDescriptorProxy :id="row.attenderFk" />
</QTd>
</template>
<template #body-cell-item="{ row }">
<QTd>
<VnInput
class="dense"
v-model.number="row.itemFk"
type="number"
:disable="row.isOk != null"
/>
</QTd>
</template>
<template #body-cell-achieved="{ row }">
<QTd>
<VnInput
class="dense"
v-model.number="row.saleQuantity"
@change="changeQuantity(row)"
type="number"
:disable="!row.itemFk || row.isOk != null"
/>
</QTd>
</template>
<template #body-cell-concept="{ row }">
jsegarra marked this conversation as resolved
Review

A mi tampoco me lo abre.
Y es correcto porque es body-cell-description, y no concept

He conseguido que me aparezca el concepto como si fuese un descriptor y no me lo abre.

A mi tampoco me lo abre. Y es correcto porque es body-cell-description, y no concept He conseguido que me aparezca el concepto como si fuese un descriptor y no me lo abre.
<QTd>
<QBtn flat dense color="primary"> {{ row.itemDescription }}</QBtn>
<ItemDescriptorProxy :id="row.itemFk" />
jsegarra marked this conversation as resolved
Review

No me lo abre

No me lo abre
Review

Mmm.. que raro, yo si puedo abrirlo

Mmm.. que raro, yo si puedo abrirlo
Review

No me lo abre

@alexm en salix no se abre. Resulta que itemFk es null

> No me lo abre @alexm en salix no se abre. Resulta que itemFk es null
Review

En lilium está bien hecho, el fallo se corrige desde Salix en la verdnatura/salix#2355

En lilium está bien hecho, el fallo se corrige desde Salix en la https://gitea.verdnatura.es/verdnatura/salix/pulls/2355
</QTd>
</template>
<template #body-cell-state="{ row }">
<QTd>
<span>{{ getState(row.isOk) }}</span>
</QTd>
</template>
<template #body-cell-action="{ row, rowIndex }">
<QTd>
<QIcon
v-if="row.response?.length"
name="insert_drive_file"
color="primary"
size="sm"
>
<QTooltip>
{{ row.response }}
</QTooltip>
</QIcon>
<QIcon
v-if="row.isOk == null"
name="thumb_down"
color="primary"
size="sm"
class="cursor-pointer"
jsegarra marked this conversation as resolved Outdated

falta la clase fill para la mano y para el icono de archivo

falta la clase fill para la mano y para el icono de archivo

Fill agregado al icon de la mano.
El icon de archivo no cambia con hover state en salix y lo veo bien ya que no tiene ninguna accion mas que mostrar un tooltip.

Commit: 4396f7d6ba

Fill agregado al icon de la mano. El icon de archivo no cambia con hover state en salix y lo veo bien ya que no tiene ninguna accion mas que mostrar un tooltip. Commit: https://gitea.verdnatura.es/verdnatura/salix-front/commit/4396f7d6ba7ff40d3f819daab34f5cf017c40458

sorry :(, aparece FILL por defecto, sin hacer hover

sorry :(, aparece FILL por defecto, sin hacer hover
@click="showDenyRequestForm(row.id, rowIndex)"
>
<QTooltip>
{{ t('Discard') }}
</QTooltip>
</QIcon>
</QTd>
</template>
</QTable>
<QDialog ref="denyFormRef" transition-show="scale" transition-hide="scale">
<ItemRequestDenyForm
:request-id="denyRequestId"