From 69a7fcac1b6663814a974e07de3f4593f16dde5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20M=C4=99dryga=C5=82?= Date: Fri, 29 Mar 2024 12:46:04 +0100 Subject: [PATCH 1/7] feat: improved attributes values validation --- .../attributes/configurator/Configurator.vue | 7 +++- .../configurator/DateAndNumberTypeInput.vue | 17 ++++++---- .../modules/attributes/configurator/Item.vue | 19 +++++++++-- .../configurator/SelectTypeInput.vue | 1 + src/views/products/View.vue | 33 +++++++++++++------ 5 files changed, 57 insertions(+), 20 deletions(-) diff --git a/src/components/modules/attributes/configurator/Configurator.vue b/src/components/modules/attributes/configurator/Configurator.vue index 3c8baa0c..c61a6048 100644 --- a/src/components/modules/attributes/configurator/Configurator.vue +++ b/src/components/modules/attributes/configurator/Configurator.vue @@ -141,7 +141,12 @@ export default defineComponent({ }, deleteAttribute(id: UUID) { - this.attributes = this.attributes.filter((a) => a.id !== id) + const removedAttribute = this.attributes.find((a) => a.id === id) + if (removedAttribute?.global) { + removedAttribute.selected_options = [undefined as any] + } else { + this.attributes = this.attributes.filter((a) => a.id !== id) + } }, }, }) diff --git a/src/components/modules/attributes/configurator/DateAndNumberTypeInput.vue b/src/components/modules/attributes/configurator/DateAndNumberTypeInput.vue index 5baaf699..ff138e66 100644 --- a/src/components/modules/attributes/configurator/DateAndNumberTypeInput.vue +++ b/src/components/modules/attributes/configurator/DateAndNumberTypeInput.vue @@ -5,24 +5,25 @@ v-model="selectedOption[0].value_date" class="date-input__input" type="date" - name="value_date" + :name="`${attribute.id}_value_date`" />
- @@ -96,6 +97,10 @@ export default defineComponent({ }, }, + isRequired(): boolean { + return !!this.getOptionName(this.selectedOption[0]) + }, + AttributeType(): typeof AttributeType { return AttributeType }, @@ -171,7 +176,7 @@ export default defineComponent({ @media ($viewport-6) { max-width: 185px; - margin-top: -20px; + // margin-top: -20px; } } } diff --git a/src/components/modules/attributes/configurator/Item.vue b/src/components/modules/attributes/configurator/Item.vue index 9902be81..c533e211 100644 --- a/src/components/modules/attributes/configurator/Item.vue +++ b/src/components/modules/attributes/configurator/Item.vue @@ -1,5 +1,5 @@ - + @@ -61,6 +62,7 @@