Hotfix: fixed filter when searching by id #1063
|
@ -162,7 +162,9 @@ onMounted(() => {
|
|||
: $props.defaultMode;
|
||||
stateStore.rightDrawer = quasar.screen.gt.xs;
|
||||
columnsVisibilitySkipped.value = [
|
||||
...splittedColumns.value.columns.filter((c) => !c.visible).map((c) => c.name),
|
||||
...splittedColumns.value.columns
|
||||
.filter((c) => c.visible === false)
|
||||
.map((c) => c.name),
|
||||
...['tableActions'],
|
||||
];
|
||||
createForm.value = $props.create;
|
||||
|
|
|
@ -152,7 +152,7 @@ onMounted(async () => {
|
|||
<QCheckbox
|
||||
v-for="col in localColumns"
|
||||
:key="col.name"
|
||||
:label="col.label"
|
||||
:label="col.label ?? col.name"
|
||||
v-model="col.visible"
|
||||
/>
|
||||
</div>
|
||||
|
|
|
@ -264,6 +264,10 @@ input::-webkit-inner-spin-button {
|
|||
.shrink {
|
||||
max-width: 75px;
|
||||
}
|
||||
.number {
|
||||
text-align: right;
|
||||
width: 96px;
|
||||
}
|
||||
.expand {
|
||||
max-width: 400px;
|
||||
}
|
||||
|
|
|
@ -78,29 +78,32 @@ async function setItemTypeData(data) {
|
|||
{{ t('globals.summary.basicData') }}
|
||||
<QIcon name="open_in_new" />
|
||||
</router-link>
|
||||
<VnLv :label="t('summary.id')" :value="itemType.id" />
|
||||
<VnLv :label="t('shared.code')" :value="itemType.code" />
|
||||
<VnLv :label="t('shared.name')" :value="itemType.name" />
|
||||
<VnLv :label="t('shared.worker')">
|
||||
<VnLv :label="t('itemType.summary.id')" :value="itemType.id" />
|
||||
<VnLv :label="t('itemType.shared.code')" :value="itemType.code" />
|
||||
<VnLv :label="t('itemType.shared.name')" :value="itemType.name" />
|
||||
<VnLv :label="t('itemType.shared.worker')">
|
||||
<template #value>
|
||||
<span class="link">{{ itemType.worker?.firstName }}</span>
|
||||
<WorkerDescriptorProxy :id="itemType.worker?.id" />
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :label="t('shared.category')" :value="itemType.category?.name" />
|
||||
<VnLv
|
||||
:label="t('shared.temperature')"
|
||||
:label="t('itemType.shared.category')"
|
||||
:value="itemType.category?.name"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('itemType.shared.temperature')"
|
||||
:value="itemType.temperature?.name"
|
||||
/>
|
||||
<VnLv :label="t('summary.life')" :value="itemType.life" />
|
||||
<VnLv :label="t('summary.promo')" :value="itemType.promo" />
|
||||
<VnLv :label="t('itemType.summary.life')" :value="itemType.life" />
|
||||
<VnLv :label="t('itemType.summary.promo')" :value="itemType.promo" />
|
||||
<VnLv
|
||||
:label="t('summary.itemPackingType')"
|
||||
:label="t('itemType.summary.itemPackingType')"
|
||||
:value="itemType.itemPackingType?.description"
|
||||
/>
|
||||
<VnLv
|
||||
class="large-label"
|
||||
:label="t('summary.isUnconventionalSize')"
|
||||
:label="t('itemType.summary.isUnconventionalSize')"
|
||||
:value="itemType.isUnconventionalSize"
|
||||
/>
|
||||
</QCard>
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
shared:
|
||||
code: Code
|
||||
name: Name
|
||||
worker: Worker
|
||||
category: Category
|
||||
temperature: Temperature
|
||||
life: Life
|
||||
itemPackingType: Item packing type
|
||||
maxRefs: Maximum references
|
||||
fragile: Fragile
|
||||
summary:
|
||||
id: id
|
||||
life: Life
|
||||
promo: Promo
|
||||
itemPackingType: Item packing type
|
||||
isUnconventionalSize: Is unconventional size
|
||||
itemType:
|
||||
shared:
|
||||
code: Code
|
||||
name: Name
|
||||
worker: Worker
|
||||
category: Category
|
||||
temperature: Temperature
|
||||
life: Life
|
||||
itemPackingType: Item packing type
|
||||
maxRefs: Maximum references
|
||||
fragile: Fragile
|
||||
summary:
|
||||
id: id
|
||||
life: Life
|
||||
promo: Promo
|
||||
itemPackingType: Item packing type
|
||||
isUnconventionalSize: Is unconventional size
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
shared:
|
||||
code: Código
|
||||
name: Nombre
|
||||
worker: Trabajador
|
||||
category: Reino
|
||||
temperature: Temperatura
|
||||
life: Vida
|
||||
itemPackingType: Tipo de embalaje
|
||||
maxRefs: Referencias máximas
|
||||
fragile: Frágil
|
||||
summary:
|
||||
id: id
|
||||
life: Vida
|
||||
promo: Promoción
|
||||
itemPackingType: Tipo de embalaje
|
||||
isUnconventionalSize: Es de tamaño poco convencional
|
||||
itemType:
|
||||
shared:
|
||||
code: Código
|
||||
name: Nombre
|
||||
worker: Trabajador
|
||||
category: Reino
|
||||
temperature: Temperatura
|
||||
life: Vida
|
||||
itemPackingType: Tipo de embalaje
|
||||
maxRefs: Referencias máximas
|
||||
fragile: Frágil
|
||||
summary:
|
||||
id: id
|
||||
life: Vida
|
||||
promo: Promoción
|
||||
itemPackingType: Tipo de embalaje
|
||||
isUnconventionalSize: Es de tamaño poco convencional
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { ref, computed, onMounted, onUnmounted, watch } from 'vue';
|
||||
import { ref, computed, onMounted, onUnmounted, nextTick } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
|
@ -10,37 +10,15 @@ import { useStateStore } from 'stores/useStateStore';
|
|||
import { toCurrency } from 'filters/index';
|
||||
import { useRole } from 'src/composables/useRole';
|
||||
|
||||
const $props = defineProps({
|
||||
formData: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
haveNegatives: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['updateForm', 'update:haveNegatives']);
|
||||
const haveNegatives = defineModel('haveNegatives', { type: Boolean, required: true });
|
||||
const formData = defineModel({ type: Object, required: true });
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const { hasAny } = useRole();
|
||||
|
||||
const _ticketData = ref($props.formData);
|
||||
const ticketUpdateActions = ref(null);
|
||||
const haveNegatives = computed({
|
||||
get: () => $props.haveNegatives,
|
||||
set: (val) => emit('update:haveNegatives', val),
|
||||
});
|
||||
const rows = computed(() => _ticketData.value?.sale?.items || []);
|
||||
|
||||
watch(
|
||||
() => _ticketData.value,
|
||||
(val) => emit('updateForm', val),
|
||||
{ deep: true }
|
||||
);
|
||||
const rows = computed(() => formData.value?.sale?.items || []);
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
|
@ -57,24 +35,28 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
name: 'subName',
|
||||
align: 'left',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('basicData.movable'),
|
||||
name: 'movable',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
label: t('basicData.quantity'),
|
||||
name: 'quantity',
|
||||
field: 'quantity',
|
||||
align: 'left',
|
||||
classes: 'number',
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
label: t('basicData.pricePPU'),
|
||||
name: 'price',
|
||||
field: 'price',
|
||||
align: 'left',
|
||||
classes: 'number',
|
||||
format: (val) => toCurrency(val),
|
||||
},
|
||||
{
|
||||
|
@ -82,7 +64,7 @@ const columns = computed(() => [
|
|||
label: t('basicData.newPricePPU'),
|
||||
name: 'newPrice',
|
||||
field: (row) => row.component.newPrice,
|
||||
align: 'left',
|
||||
classes: 'number',
|
||||
format: (val) => toCurrency(val),
|
||||
},
|
||||
{
|
||||
|
@ -90,14 +72,15 @@ const columns = computed(() => [
|
|||
label: t('basicData.difference'),
|
||||
name: 'difference',
|
||||
field: (row) => row.component.difference,
|
||||
align: 'left',
|
||||
classes: 'number',
|
||||
format: (val) => toCurrency(val),
|
||||
autoWidth: true,
|
||||
},
|
||||
]);
|
||||
|
||||
const loadDefaultTicketAction = () => {
|
||||
const isSalesAssistant = hasAny(['salesAssistant']);
|
||||
_ticketData.value.option = isSalesAssistant ? 'mana' : 'renewPrices';
|
||||
formData.value.option = isSalesAssistant ? 'mana' : 'renewPrices';
|
||||
};
|
||||
|
||||
const totalPrice = computed(() => {
|
||||
|
@ -115,24 +98,25 @@ const totalDifference = computed(() => {
|
|||
return rows.value.reduce((acc, item) => acc + item.component?.difference || 0, 0);
|
||||
});
|
||||
const showMovableColumn = computed(() => (haveDifferences.value > 0 ? ['movable'] : []));
|
||||
const haveDifferences = computed(() => _ticketData.value.sale?.haveDifferences);
|
||||
const ticketHaveNegatives = () => {
|
||||
const haveDifferences = computed(() => formData.value.sale?.haveDifferences);
|
||||
async function ticketHaveNegatives() {
|
||||
let _haveNegatives = false;
|
||||
let haveNotNegatives = false;
|
||||
_ticketData.value.withoutNegatives = false;
|
||||
_ticketData.value?.sale?.items.forEach((item) => {
|
||||
formData.value.withoutNegatives = false;
|
||||
formData.value?.sale?.items.forEach((item) => {
|
||||
if (item.quantity > item.movable) _haveNegatives = true;
|
||||
else haveNotNegatives = true;
|
||||
});
|
||||
|
||||
haveNegatives.value = _haveNegatives && haveNotNegatives && haveDifferences.value;
|
||||
if (haveNegatives.value) _ticketData.value.withoutNegatives = true;
|
||||
};
|
||||
await nextTick();
|
||||
if (haveNegatives.value) formData.value.withoutNegatives = true;
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
onMounted(async () => {
|
||||
stateStore.rightDrawer = true;
|
||||
loadDefaultTicketAction();
|
||||
ticketHaveNegatives();
|
||||
await ticketHaveNegatives();
|
||||
});
|
||||
|
||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||
|
@ -191,7 +175,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
horizontal
|
||||
>
|
||||
<QRadio
|
||||
v-model="_ticketData.option"
|
||||
v-model="formData.option"
|
||||
:val="action.code"
|
||||
:label="action.description"
|
||||
dense
|
||||
|
@ -208,7 +192,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
<QCardSection horizontal class="flex row items-center">
|
||||
<QCheckbox
|
||||
:label="t('basicData.withoutNegatives')"
|
||||
v-model="_ticketData.withoutNegatives"
|
||||
v-model="formData.withoutNegatives"
|
||||
:toggle-indeterminate="false"
|
||||
/>
|
||||
<QIcon name="info" size="xs" class="q-ml-sm">
|
||||
|
@ -225,7 +209,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
:columns="columns"
|
||||
row-key="id"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
class="full-width"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
flat
|
||||
>
|
||||
|
@ -238,21 +222,27 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-description="{ row }">
|
||||
<QTd style="display: contents">
|
||||
<div class="column">
|
||||
<QTd style="min-width: 120px; max-width: 120px">
|
||||
<div class="column q-pb-xs" style="min-width: 120px">
|
||||
<span>{{ row.item.name }}</span>
|
||||
<span class="color-vn-label">{{ row.item.subName }}</span>
|
||||
<FetchedTags :item="row.item" />
|
||||
<FetchedTags :item="row.item" class="full-width" />
|
||||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-movable="{ row }">
|
||||
<template #body-cell-subName="{ row }">
|
||||
<QTd>
|
||||
<QBadge
|
||||
v-if="_ticketData?.sale?.haveDifferences"
|
||||
<span class="color-vn-label">{{ row.item.subName }}</span>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-movable="{ row }">
|
||||
<QTd class="number">
|
||||
<QChip
|
||||
v-if="formData?.sale?.haveDifferences"
|
||||
:text-color="row.quantity > row.movable ? 'black' : 'white'"
|
||||
:color="row.quantity > row.movable ? 'negative' : 'transparent'"
|
||||
:label="row.movable"
|
||||
dense
|
||||
square
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
|
|
|
@ -21,7 +21,6 @@ const formData = defineModel({
|
|||
required: true,
|
||||
});
|
||||
|
||||
const emit = defineEmits(['updateForm']);
|
||||
const { validate } = useValidator();
|
||||
const { notify } = useNotify();
|
||||
const router = useRouter();
|
||||
|
@ -33,18 +32,11 @@ const canEditZone = useAcl().hasAny([
|
|||
const agencyFetchRef = ref();
|
||||
const warehousesOptions = ref([]);
|
||||
const companiesOptions = ref([]);
|
||||
const currenciesOptions = ref([]);
|
||||
const agenciesOptions = ref([]);
|
||||
const zonesOptions = ref([]);
|
||||
const addresses = ref([]);
|
||||
const zoneSelectRef = ref();
|
||||
|
||||
watch(
|
||||
() => formData.value,
|
||||
(val) => emit('updateForm', val),
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
onMounted(() => onFormModelInit());
|
||||
|
||||
const agencyByWarehouseFilter = computed(() => ({
|
||||
|
|
|
@ -155,18 +155,10 @@ onBeforeMount(async () => await getTicketData());
|
|||
}"
|
||||
>
|
||||
<QStep :name="1" :title="t('globals.pageTitles.basicData')" :done="step > 1">
|
||||
<TicketBasicDataForm
|
||||
v-if="initialDataLoaded"
|
||||
@update-form="($event) => (formData = $event)"
|
||||
v-model="formData"
|
||||
/>
|
||||
<TicketBasicDataForm v-if="initialDataLoaded" v-model="formData" />
|
||||
</QStep>
|
||||
<QStep :name="2" :title="t('basicData.priceDifference')">
|
||||
<TicketBasicData
|
||||
:form-data="formData"
|
||||
v-model:haveNegatives="haveNegatives"
|
||||
@update-form="($event) => (formData = $event)"
|
||||
/>
|
||||
<TicketBasicData v-model="formData" v-model:have-negatives="haveNegatives" />
|
||||
</QStep>
|
||||
<template #navigation>
|
||||
<QStepperNavigation class="flex justify-between">
|
||||
|
|
|
@ -52,6 +52,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
:last-day="lastDay"
|
||||
:events="events"
|
||||
v-model:formModeName="formModeName"
|
||||
@open-zone-form="openForm"
|
||||
/>
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
|
|
|
@ -11,10 +11,6 @@ import { dashIfEmpty } from 'src/filters';
|
|||
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
|
||||
const formModeName = defineModel('formModeName', {
|
||||
type: String,
|
||||
required: true,
|
||||
});
|
||||
const props = defineProps({
|
||||
firstDay: {
|
||||
type: Date,
|
||||
|
@ -31,8 +27,18 @@ const props = defineProps({
|
|||
required: true,
|
||||
default: () => [],
|
||||
},
|
||||
formModeName: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: 'include',
|
||||
},
|
||||
});
|
||||
|
||||
const formName = computed({
|
||||
get: () => props.formModeName,
|
||||
set: (value) => emit('update:formModeName', value),
|
||||
});
|
||||
const emit = defineEmits(['openZoneForm', 'update:formModeName']);
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const weekdayStore = useWeekdayStore();
|
||||
|
@ -80,6 +86,15 @@ const deleteEvent = async (id) => {
|
|||
await fetchData();
|
||||
};
|
||||
|
||||
const openInclusionForm = (event) => {
|
||||
formName.value = 'include';
|
||||
emit('openZoneForm', {
|
||||
date: event.dated,
|
||||
event,
|
||||
isNewMode: false,
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
weekdayStore.initStore();
|
||||
});
|
||||
|
@ -92,13 +107,13 @@ onMounted(async () => {
|
|||
t('eventsPanel.editMode')
|
||||
}}</span>
|
||||
<QRadio
|
||||
v-model="formModeName"
|
||||
v-model="formName"
|
||||
dense
|
||||
val="include"
|
||||
:label="t('eventsPanel.include')"
|
||||
/>
|
||||
<QRadio
|
||||
v-model="formModeName"
|
||||
v-model="formName"
|
||||
dense
|
||||
val="exclude"
|
||||
:label="t('eventsPanel.exclude')"
|
||||
|
|
Loading…
Reference in New Issue