diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 6745a2f49..899e4d000 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -296,6 +296,7 @@ defineExpose({ reload, redirect: redirectFn, selected, + CrudModelRef, }); function handleOnDataSaved(_, res) { diff --git a/src/pages/Item/ItemFixedPrice.vue b/src/pages/Item/ItemFixedPrice.vue index 59a3e74db..d91b5189e 100644 --- a/src/pages/Item/ItemFixedPrice.vue +++ b/src/pages/Item/ItemFixedPrice.vue @@ -212,15 +212,6 @@ const editTableFieldsOptions = [ type: 'number', }, }, - { - field: 'hasMinPrice', - label: t('item.fixedPrice.hasMinPrice'), - component: 'checkbox', - attrs: { - 'false-value': 0, - 'true-value': 1, - }, - }, { field: 'started', label: t('item.fixedPrice.started'), @@ -262,10 +253,13 @@ const updateMinPrice = async (value, props) => { }); }; -const upsertPrice = async ({ row }, resetMinPrice = false) => { +const upsertPrice = async (props, resetMinPrice = false) => { try { - if (resetMinPrice) row.hasMinPrice = 0; - row = await upsertFixedPrice(row); + const { row } = props; + if (tableRef.value.CrudModelRef.getChanges().updates.length > 0) { + if (resetMinPrice) row.hasMinPrice = 0; + await upsertFixedPrice(row); + } } catch (err) { console.error('Error editing price', err); } @@ -283,8 +277,7 @@ async function upsertFixedPrice(row) { async function saveOnRowChange(row) { if (rowsSelected.value.length > 1) return; if (rowsSelected.value[0]?.id === row.id) return; - else if (rowsSelected.value.length === 1) - await upsertFixedPrice(rowsSelected.value[0]); + else if (rowsSelected.value.length === 1) await upsertPrice(rowsSelected.value[0]); rowsSelected.value = [row]; } @@ -454,12 +447,18 @@ function handleOnDataSave({ CrudModelRef }) { @@ -679,6 +659,12 @@ tbody tr.highlight .q-td { background-color: transparent; } } +.subName { + margin-left: 5%; + font-size: 0.75rem; + text-transform: uppercase; + color: var(--vn-label-color); +} es: