feat: itemProposalProxy
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Javier Segarra 2024-09-16 10:47:41 +02:00
parent 8be1a42c53
commit 0a3703532e
3 changed files with 161 additions and 136 deletions

View File

@ -94,7 +94,7 @@ const columns = computed(() => [
...defaultColumnAttrs, ...defaultColumnAttrs,
label: t('proposal.difference'), label: t('proposal.difference'),
name: 'difference', name: 'difference',
format: (item) => (item.id % 2 === 0 ? 10 : -10), format: ({ id }) => (id % 2 === 0 ? 10 : -10),
columnFilter: { columnFilter: {
component: 'input', component: 'input',
type: 'number', type: 'number',
@ -226,14 +226,14 @@ function onDialogClose() {
onUnmounted(() => {}); onUnmounted(() => {});
</script> </script>
<template> <template>
<QPopupProxy ref="popupProxyRef"> <!-- <QPopupProxy ref="popupProxyRef"> -->
<QCard style="min-width: 500px"> <!-- <QCard style="min-width: 500px">
<QCardSection class="row items-center justify-center column items-stretch"> <QCardSection class="row items-center justify-center column items-stretch"> -->
<!-- <VnRow style="display: flex"> --> <!-- <VnRow style="display: flex"> -->
<div style="width: 62vw"> <div style="min-width: 65vw">
<!-- {{ proposalSelected }} --> <!-- {{ proposalSelected }} -->
{{ $props.itemLack.itemFk }} <!-- {{ $props.itemLack.itemFk }}
{{ $props.itemLack.warehouseFk }} {{ $props.itemLack.warehouseFk }} -->
<!-- {{ rows[1].available }} --> <!-- {{ rows[1].available }} -->
<VnTable <VnTable
data-key="ItemsGetSimilar" data-key="ItemsGetSimilar"
@ -262,22 +262,22 @@ onUnmounted(() => {});
<div v-if="$props.replaceAction" style="display: flex"> <div v-if="$props.replaceAction" 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"
:disable=" style="padding-block: 8px"
proposalSelected.length < 1 || quantity === 0 :disable="proposalSelected.length < 1 || quantity === 0"
"
unelevated
/> />
<VnInputNumber <VnInputNumber
v-model.number="quantity" v-model.number="quantity"
v-if="quantity > -1" v-if="proposalSelected.length > 0"
@update:model-value="(val) => (quantity = val)" @update:model-value="(val) => (quantity = val)"
type="number" type="number"
min="0" min="0"
:label="t('proposal.quantityToReplace')" :label="t('proposal.quantityToReplace')"
class="q-ml-lg" dense
class="q-ml-xs"
/></div /></div
></template> ></template>
<!-- <template #body="scope">{{ scope }}</template> --> <!-- <template #body="scope">{{ scope }}</template> -->
@ -285,15 +285,9 @@ onUnmounted(() => {});
<QTd align="center" v-if="$props.replaceAction" <QTd align="center" v-if="$props.replaceAction"
><QCheckbox ><QCheckbox
v-model="scope.selected" v-model="scope.selected"
:disable=" :disable="!(scope.row.available >= itemLack.lack * -1)"
!(scope.row.available >= itemLack.lack * -1)
"
>
<QTooltip
v-if="
!(scope.row.available >= itemLack.lack * -1)
"
> >
<QTooltip v-if="!(scope.row.available >= itemLack.lack * -1)">
Nop</QTooltip Nop</QTooltip
> >
</QCheckbox> </QCheckbox>
@ -343,14 +337,14 @@ onUnmounted(() => {});
</div> </div>
<!-- </QTd> --> <!-- </QTd> -->
</template> </template>
<template #column-status="{ value }"> <template #column-status="{ row }">
<!-- <QTd class="col" align="center"> --> <!-- <QTd class="col" align="center"> -->
<div <div
:style="{ background: gradientStyle(value) }" :style="{ background: gradientStyle(statusConditionalValue(row)) }"
class="compatibility" class="compatibility"
> >
<QTooltip> <QTooltip>
{{ compatibilityItem(value) }} {{ compatibilityItem(statusConditionalValue(row)) }}
</QTooltip> </QTooltip>
</div> </div>
<!-- </QTd> --> <!-- </QTd> -->
@ -360,28 +354,28 @@ onUnmounted(() => {});
</template> --> </template> -->
<template #column-price2="{ row }"> <template #column-price2="{ row }">
<!-- <QTd <QTd
class="col" class="col"
align="center" align="center"
:class="[conditionalValuePrice(value)]" :class="[conditionalValuePrice(row.price2)]"
> --> >
<QTooltip> <QTooltip>
{{ toCurrency(row.price2) }} {{ toCurrency(row.price2) }}
</QTooltip> </QTooltip>
{{ toCurrency(row.price2) }} {{ toCurrency(row.price2) }}
<!-- </QTd> --> </QTd>
</template> </template>
<template #column-difference="{ row }"> <template #column-difference="{ row }">
<pre>{{ row.difference }}</pre> <!-- <pre>asdad{{ row }}</pre> -->
<!-- <QTd class="col" align="left"> --> <!-- <QTd class="col" align="left"> -->
<!-- <VnStockValueDisplay :value="value" /> --> <VnStockValueDisplay :value="row.id % 2 === 0 ? 10 : -10" />
<!-- </QTd> --> <!-- </QTd> -->
</template> </template>
</VnTable> </VnTable>
</div> </div>
</QCardSection> <!-- </QCardSection>
</QCard> </QCard> -->
</QPopupProxy> <!-- </QPopupProxy> -->
</template> </template>
<style lang="scss"> <style lang="scss">
.compatibility { .compatibility {

View File

@ -0,0 +1,30 @@
<script setup>
import ItemProposal from './ItemProposal.vue';
const $props = defineProps({
item: {
type: Object,
required: true,
default: () => {},
},
itemLack: {
type: Object,
required: true,
default: () => {},
},
replaceAction: {
type: Boolean,
required: false,
default: false,
},
tickets: {
type: Array,
required: false,
default: () => [],
},
});
</script>
<template>
<QPopupProxy>
<ItemProposal v-bind="$props"></ItemProposal>
</QPopupProxy>
</template>

View File

@ -18,6 +18,7 @@ import { useRoute } from 'vue-router';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import VnImg from 'src/components/ui/VnImg.vue'; import VnImg from 'src/components/ui/VnImg.vue';
import TicketLackTable from './TicketLackTable.vue'; import TicketLackTable from './TicketLackTable.vue';
import ItemProposalProxy from 'src/pages/Item/components/ItemProposalProxy.vue';
const { t } = useI18n(); const { t } = useI18n();
const URL_KEY = 'Tickets/ItemLack'; const URL_KEY = 'Tickets/ItemLack';
const editableStates = ref([]); const editableStates = ref([]);
@ -199,14 +200,14 @@ const replaceItem = () => {
</QBtn> </QBtn>
<QBtn color="primary" @click="showProposalDialog = true"> <QBtn color="primary" @click="showProposalDialog = true">
<QIcon name="import_export" class="rotate-90"></QIcon> <QIcon name="import_export" class="rotate-90"></QIcon>
<ItemProposal <ItemProposalProxy
ref="proposalDialogRef" ref="proposalDialogRef"
:item="item" :item="item"
:item-lack="itemLack" :item-lack="itemLack"
:replace-action="true" :replace-action="true"
:tickets="selectedRows" :tickets="selectedRows"
@refresh-data="itemProposalEvt" @refresh-data="itemProposalEvt"
></ItemProposal> ></ItemProposalProxy>
<QTooltip bottom anchor="bottom right"> <QTooltip bottom anchor="bottom right">
{{ t('itemProposal') }} {{ t('itemProposal') }}
</QTooltip> </QTooltip>