You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
willaengine/resources/js/Global/components/Modals/Dialog.vue

98 lines
3.4 KiB

5 years ago
<template>
<basic-modal width="40%" transition="slide-x-transition">
5 years ago
<v-card class="RTL">
<v-card-title class="red lighten-5" primary-title>
<WM-PartTitle
class="WM-Margin-T-20"
:TitleFa="getDialogProperties.title || defaultMessage[type].title"
:TitleEn="getDialogProperties.titleEn || defaultMessage[type].titleEn"
5 years ago
:color="getDialogProperties.color || defaultMessage[type].color"
5 years ago
></WM-PartTitle>
</v-card-title>
<v-card-text>
5 years ago
<div
class="WM-Align-R WM-Margin-T-10"
>{{ getDialogProperties.message || defaultMessage[type].message }}</div>
5 years ago
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
5 years ago
<v-btn
:color="getDialogProperties.cancelButtonColor || defaultMessage[type].cancelButtonColor"
@click="cancel"
depressed
dark
>
<v-icon dark right>WMi-cancel</v-icon>
{{getDialogProperties.cancelButtonText || defaultMessage[type].cancelButtonText}}
5 years ago
</v-btn>
5 years ago
<v-btn
:color="getDialogProperties.confirmButtonColor || defaultMessage[type].confirmButtonColor"
depressed
dark
@click="confirm"
>
<v-icon dark right>WMi-trash</v-icon>
{{getDialogProperties.confirmButtonText || defaultMessage[type].confirmButtonText}}
5 years ago
</v-btn>
</v-card-actions>
</v-card>
</basic-modal>
5 years ago
</template>
<script>
import { mapGetters } from "vuex";
5 years ago
export default {
name: "modal_modal_dialog",
5 years ago
data: () => ({
defaultMessage: {
delete: {
success: function() {
5 years ago
return "";
},
close: function() {
5 years ago
return "";
},
message:
"آیا از حذف آیتم مطمئن هستید؟ امکان بازگشت وجود نخواهد داشت.",
title: " تایید حذف ",
titleEn: " Remove Confirmation ",
color: "red",
cancelButtonText: "انصراف",
confirmButtonText: "حذف",
cancelButtonColor: "cyan",
confirmButtonColor: "red"
5 years ago
}
5 years ago
},
5 years ago
type: "delete"
5 years ago
}),
watch: {
getDialogType(type) {
5 years ago
if (["delete"].includes(type)) {
this.type = type;
} else {
this.type = "delete";
}
}
},
5 years ago
computed: {
...mapGetters("modal", ["getDialogType", "getDialogProperties"]),
5 years ago
},
methods: {
async confirm() {
5 years ago
if (typeof this.getDialogProperties.success == "function") {
await this.getDialogProperties.success();
5 years ago
}
this.$_closeModal();
5 years ago
},
async cancel() {
5 years ago
if (typeof this.getDialogProperties.close == "function") {
await this.getDialogProperties.close();
5 years ago
}
this.$_closeModal();
5 years ago
}
}
};
</script>