refactor: refs #8363 requested changes
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jon Elias 2025-04-07 13:20:00 +02:00
parent 0304010f62
commit 11994b80b0
3 changed files with 39 additions and 53 deletions

View File

@ -2,6 +2,7 @@
import { onMounted, ref, onUnmounted, computed, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { useStateStore } from 'stores/useStateStore';
import { useState } from 'src/composables/useState';
import { beforeSave } from 'src/composables/updateMinPriceBeforeSave';
@ -17,7 +18,7 @@ import { toDate } from 'src/filters';
import { isLower, isBigger } from 'src/filters/date.js';
import ItemFixedPriceFilter from './ItemFixedPriceFilter.vue';
import ItemDescriptorProxy from './Card/ItemDescriptorProxy.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import { toCurrency } from 'src/filters';
const stateStore = useStateStore();
const { t } = useI18n();
@ -27,6 +28,9 @@ const selectedRows = ref([]);
const hasSelectedRows = computed(() => selectedRows.value.length > 0);
const isToClone = ref(false);
const dateColor = 'var(--vn-label-text-color)';
const state = useState();
const user = state.getUser().fn();
const warehouse = computed(() => user.warehouseFk);
onMounted(async () => {
stateStore.rightDrawer = true;
});
@ -38,10 +42,10 @@ const columns = computed(() => [
label: t('item.fixedPrice.itemFk'),
labelAbbreviation: 'Id',
toolTip: t('item.fixedPrice.itemFk'),
component: 'number',
component: 'input',
columnFilter: {
component: 'select',
attrs: {
component: 'select',
url: 'Items',
fields: ['id', 'name', 'subName'],
optionLabel: 'name',
@ -50,12 +54,8 @@ const columns = computed(() => [
},
inWhere: true,
},
cellEvent: {
'update:modelValue': async (value, oldValue, row) => {
tableRef.value.CrudModelRef.saveChanges();
},
},
width: '55px',
isEditable: false,
},
{
labelAbbreviation: '',
@ -79,30 +79,38 @@ const columns = computed(() => [
},
{
label: t('item.fixedPrice.groupingPrice'),
labelAbbreviation: 'Group.',
labelAbbreviation: 'P. Group',
toolTip: t('item.fixedPrice.groupingPrice'),
name: 'rate2',
component: 'number',
create: true,
createOrder: 3,
width: '40px',
createAttrs: {
required: true,
},
width: '50px',
format: (row) => toCurrency(row.rate2),
},
{
label: t('item.fixedPrice.packingPrice'),
labelAbbreviation: 'Pack.',
labelAbbreviation: 'P. Pack',
toolTip: t('item.fixedPrice.packingPrice'),
name: 'rate3',
component: 'number',
create: true,
createOrder: 4,
width: '40px',
createAttrs: {
required: true,
},
width: '50px',
format: (row) => toCurrency(row.rate3),
},
{
name: 'hasMinPrice',
label: t('item.fixedPrice.hasMinPrice'),
labelAbbreviation: t('item.fixedPrice.MP'),
toolTip: t('item.fixedPrice.hasMinPrice'),
label: t('Has min price'),
label: t('item.fixedPrice.hasMinPrice'),
component: 'checkbox',
attrs: {
toggleIndeterminate: false,
@ -115,11 +123,11 @@ const columns = computed(() => [
toolTip: t('item.fixedPrice.minPrice'),
name: 'minPrice',
component: 'number',
width: '45px',
width: '50px',
style: (row) => {
if (!row?.hasMinPrice) return { color: 'var(--vn-label-color)' };
},
format: (row) => parseFloat(row['minPrice']).toFixed(2),
format: (row) => toCurrency(row.minPrice),
},
{
label: t('item.fixedPrice.started'),
@ -128,9 +136,12 @@ const columns = computed(() => [
columnFilter: {
component: 'date',
},
createAttrs: {
required: true,
},
create: true,
createOrder: 5,
width: '55px',
width: '65px',
},
{
label: t('item.fixedPrice.ended'),
@ -139,9 +150,12 @@ const columns = computed(() => [
columnFilter: {
component: 'date',
},
createAttrs: {
required: true,
},
create: true,
createOrder: 6,
width: '55px',
width: '65px',
},
{
align: 'center',
@ -216,7 +230,6 @@ watch(
if (newVal === false && tableRef.value) {
isToClone.value = false;
tableRef.value.create.title = t('Create fixed price');
tableRef.value.create.formInitialData = {};
}
},
);
@ -235,7 +248,7 @@ watch(
:disable="!hasSelectedRows"
@click="openEditFixedPriceForm()"
color="primary"
icon="vn:wand"
icon="edit"
flat
:label="t('globals.edit')"
data-cy="FixedPriceToolbarEditBtn"
@ -263,7 +276,7 @@ watch(
:create="{
urlCreate: 'FixedPrices',
title: t('Create fixed price'),
formInitialData: {},
formInitialData: { warehouseFk: warehouse },
onDataSaved: () => tableRef.reload(),
showSaveAndContinueBtn: true,
}"
@ -346,22 +359,7 @@ watch(
</template>
</VnSelect>
</template>
<template #column-create-started="{ data }">
<VnInputDate
:label="t('item.fixedPrice.started')"
v-model="data.started"
:required="true"
/>
</template>
<template #column-create-ended="{ data }">
<VnInputDate
:label="t('item.fixedPrice.ended')"
v-model="data.ended"
:required="true"
/>
</template>
</VnTable>
<QDialog ref="editFixedPriceForm">
<EditFixedPriceForm
edit-url="FixedPrices/editFixedPrice"

View File

@ -16,11 +16,7 @@ const props = defineProps({
</script>
<template>
<ItemsFilterPanel
:data-key="props.dataKey"
:search-button="true"
:custom-tags="['tags']"
>
<ItemsFilterPanel :data-key="props.dataKey" :custom-tags="['tags']">
<template #body="{ params, searchFn }">
<QItem class="q-my-md">
<QItemSection>

View File

@ -295,13 +295,11 @@ watch(
:user-filter="lineFilter"
>
<template #column-image="{ row }">
<div class="image-wrapper">
<VnImg
:id="parseInt(row?.item?.image)"
class="rounded"
zoom-resolution="1600x900"
/>
</div>
<VnImg
:id="parseInt(row?.item?.image)"
class="rounded"
zoom-resolution="1600x900"
/>
</template>
<template #column-id="{ row }">
<span class="link" @click.stop>
@ -361,12 +359,6 @@ watch(
}
}
.image-wrapper {
height: 50px;
width: 50px;
margin-left: 30%;
}
.header {
color: $primary;
font-weight: bold;