allow to remove page area

pull/349/head
Pete Matsyburka 1 year ago
parent 173658138c
commit de14330449

@ -130,6 +130,7 @@
@click-description="isShowDescriptionModal = true" @click-description="isShowDescriptionModal = true"
@click-condition="isShowConditionsModal = true" @click-condition="isShowConditionsModal = true"
@set-draw="$emit('set-draw', $event)" @set-draw="$emit('set-draw', $event)"
@remove-area="removeArea"
@scroll-to="$emit('scroll-to', $event)" @scroll-to="$emit('scroll-to', $event)"
/> />
</ul> </ul>
@ -345,6 +346,11 @@ export default {
} }
}, },
methods: { methods: {
removeArea (area) {
this.field.areas.splice(this.field.areas.indexOf(area), 1)
this.save()
},
buildDefaultName (field, fields) { buildDefaultName (field, fields) {
if (field.type === 'payment' && field.preferences?.price && !field.preferences?.formula) { if (field.type === 'payment' && field.preferences?.price && !field.preferences?.formula) {
const { price, currency } = field.preferences || {} const { price, currency } = field.preferences || {}

@ -358,7 +358,7 @@
> >
<a <a
href="#" href="#"
class="text-sm py-1 px-2" class="text-sm py-1 px-2 group/1"
@click.prevent="$emit('scroll-to', area)" @click.prevent="$emit('scroll-to', area)"
> >
<IconShape <IconShape
@ -367,6 +367,11 @@
/> />
{{ t('page') }} {{ t('page') }}
<template v-if="template.schema.length > 1">{{ template.schema.findIndex((item) => item.attachment_uuid === area.attachment_uuid) + 1 }}-</template>{{ area.page + 1 }} <template v-if="template.schema.length > 1">{{ template.schema.findIndex((item) => item.attachment_uuid === area.attachment_uuid) + 1 }}-</template>{{ area.page + 1 }}
<IconX
:width="12"
class="group-hover/1:inline hidden"
@click.prevent.stop="[$emit('remove-area', area), $event.target.closest('.dropdown').querySelector('label').focus()]"
/>
</a> </a>
</li> </li>
<li v-if="!field.areas?.length || !['radio', 'multiple'].includes(field.type)"> <li v-if="!field.areas?.length || !['radio', 'multiple'].includes(field.type)">
@ -399,7 +404,7 @@
</template> </template>
<script> <script>
import { IconRouteAltLeft, IconShape, IconMathFunction, IconNewSection, IconInfoCircle, IconCopy } from '@tabler/icons-vue' import { IconRouteAltLeft, IconShape, IconX, IconMathFunction, IconNewSection, IconInfoCircle, IconCopy } from '@tabler/icons-vue'
export default { export default {
name: 'FieldSettings', name: 'FieldSettings',
@ -409,7 +414,8 @@ export default {
IconMathFunction, IconMathFunction,
IconRouteAltLeft, IconRouteAltLeft,
IconCopy, IconCopy,
IconNewSection IconNewSection,
IconX
}, },
inject: ['template', 'save', 't'], inject: ['template', 'save', 't'],
props: { props: {
@ -443,7 +449,7 @@ export default {
default: true default: true
} }
}, },
emits: ['set-draw', 'scroll-to', 'click-formula', 'click-description', 'click-condition'], emits: ['set-draw', 'scroll-to', 'click-formula', 'click-description', 'click-condition', 'remove-area'],
data () { data () {
return { return {
} }

Loading…
Cancel
Save