2021-09-28 09:10:01 +02:00
|
|
|
<template>
|
|
|
|
<div id="modal">
|
|
|
|
<div class="custom-modal">
|
2021-10-02 16:16:58 +02:00
|
|
|
<Card>
|
2021-09-28 09:10:01 +02:00
|
|
|
<template #title>
|
|
|
|
{{ title }}
|
|
|
|
</template>
|
|
|
|
<template #content>
|
|
|
|
<div class="modal-message">{{ message }}</div>
|
|
|
|
<ErrorMessage :message="errorMessages" v-if="errorMessages" />
|
|
|
|
<div class="modal-buttons">
|
|
|
|
<button class="confirm" @click="emit('confirmAction')">
|
2021-10-20 17:38:25 +02:00
|
|
|
{{ $t('buttons.YES') }}
|
2021-09-28 09:10:01 +02:00
|
|
|
</button>
|
|
|
|
<button class="cancel" @click="emit('cancelAction')">
|
2021-10-20 17:38:25 +02:00
|
|
|
{{ $t('buttons.NO') }}
|
2021-09-28 09:10:01 +02:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</Card>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { ComputedRef, computed, defineComponent, onUnmounted } from 'vue'
|
|
|
|
|
|
|
|
import { ROOT_STORE } from '@/store/constants'
|
|
|
|
import { useStore } from '@/use/useStore'
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
name: 'Modal',
|
|
|
|
props: {
|
|
|
|
title: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
message: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
emits: ['cancelAction', 'confirmAction'],
|
|
|
|
setup(props, { emit }) {
|
|
|
|
const store = useStore()
|
|
|
|
const errorMessages: ComputedRef<string | string[] | null> = computed(
|
|
|
|
() => store.getters[ROOT_STORE.GETTERS.ERROR_MESSAGES]
|
|
|
|
)
|
|
|
|
onUnmounted(() => store.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES))
|
2021-10-20 17:38:25 +02:00
|
|
|
return { errorMessages, emit }
|
2021-09-28 09:10:01 +02:00
|
|
|
},
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
@import '~@/scss/base';
|
|
|
|
#modal {
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
background-color: var(--modal-background-color);
|
|
|
|
padding: $default-padding;
|
|
|
|
z-index: 1240;
|
|
|
|
|
|
|
|
.custom-modal {
|
|
|
|
background-color: var(--app-background-color);
|
|
|
|
border-radius: $border-radius;
|
|
|
|
max-width: 500px;
|
|
|
|
margin: 25% auto;
|
|
|
|
z-index: 1250;
|
|
|
|
|
2021-10-02 16:16:58 +02:00
|
|
|
@media screen and (max-width: $medium-limit) {
|
|
|
|
margin: 15% auto;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
@media screen and (max-width: $small-limit) {
|
|
|
|
margin: 50% 0;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
2021-09-28 09:10:01 +02:00
|
|
|
::v-deep(.card) {
|
|
|
|
border: 0;
|
|
|
|
margin: 0;
|
|
|
|
|
|
|
|
.card-content {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
.modal-message {
|
|
|
|
padding: $default-padding;
|
|
|
|
}
|
|
|
|
|
|
|
|
.modal-buttons {
|
|
|
|
display: flex;
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
|
|
|
button {
|
|
|
|
margin: $default-padding * 0.5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|