From 9bb298bbebf6dfe3c099a284e2866f0d8d8c82cb Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 6 Sep 2024 13:14:46 +0200 Subject: [PATCH] feat: handle create row --- src/components/CrudModel.vue | 4 +- src/components/VnTable/VnTable.vue | 6 ++ src/i18n/locale/en.yml | 2 + src/i18n/locale/es.yml | 2 + src/pages/Item/ItemFixedPrice.vue | 107 +++++++++++-------- src/pages/Item/ItemFixedPriceFilter.vue | 10 +- src/pages/Order/Card/OrderDescriptorMenu.vue | 4 +- 7 files changed, 84 insertions(+), 51 deletions(-) diff --git a/src/components/CrudModel.vue b/src/components/CrudModel.vue index 33c831e3f..0386e037b 100644 --- a/src/components/CrudModel.vue +++ b/src/components/CrudModel.vue @@ -189,11 +189,11 @@ async function saveChanges(data) { }); } -async function insert() { +async function insert(pushData = $props.dataRequired) { const $index = formData.value.length ? formData.value[formData.value.length - 1].$index + 1 : 0; - formData.value.push(Object.assign({ $index }, $props.dataRequired)); + formData.value.push(Object.assign({ $index }, pushData)); hasChanges.value = true; } diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 2f173cd85..20482c494 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -89,6 +89,10 @@ const $props = defineProps({ type: Object, default: () => ({}), }, + crudModel: { + type: Object, + default: () => ({}), + }, tableHeight: { type: String, default: '90vh', @@ -369,6 +373,7 @@ function handleOnDataSaved(_, res) {