2021-03-03 08:59:56 +13:00
|
|
|
<template>
|
|
|
|
<q-dialog
|
|
|
|
v-model="dialogModel"
|
|
|
|
@hide="triggerDialogClose"
|
|
|
|
>
|
|
|
|
<q-card dark class="documentCloseDialog">
|
|
|
|
<q-card-section class="row justify-center">
|
|
|
|
<h6 class="text-center q-my-sm">Discard changes to {{retrieveFieldValue(dialogDocument,'name')}}?</h6>
|
|
|
|
</q-card-section>
|
|
|
|
|
|
|
|
<q-card-actions align="around" class="q-mx-xl q-mt-lg q-mb-md">
|
|
|
|
<q-btn
|
|
|
|
flat
|
|
|
|
label="Cancel"
|
2021-03-04 13:27:07 +13:00
|
|
|
color="accent"
|
2021-03-03 08:59:56 +13:00
|
|
|
v-close-popup />
|
|
|
|
<q-btn
|
2021-03-04 13:27:07 +13:00
|
|
|
outline
|
2021-03-03 08:59:56 +13:00
|
|
|
label="Discard changes"
|
2021-03-04 13:27:07 +13:00
|
|
|
color="secondary"
|
2021-03-03 08:59:56 +13:00
|
|
|
v-close-popup
|
|
|
|
@click="closeDocument(dialogDocument)" />
|
|
|
|
</q-card-actions>
|
|
|
|
</q-card>
|
|
|
|
</q-dialog>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
|
|
|
|
import { Component, Watch, Prop } from "vue-property-decorator"
|
|
|
|
|
|
|
|
import DialogBase from "src/components/dialogs/_DialogBase"
|
|
|
|
import { I_OpenedDocument } from "src/interfaces/I_OpenedDocument"
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
components: { }
|
|
|
|
})
|
|
|
|
export default class CloseDocumentCheckDialog extends DialogBase {
|
|
|
|
@Watch("dialogTrigger")
|
|
|
|
openDialog (val: string|false) {
|
|
|
|
if (val) {
|
|
|
|
this.checkForCloseOpenedDocument()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Prop() readonly dialogDocument!: I_OpenedDocument
|
|
|
|
|
|
|
|
checkForCloseOpenedDocument () {
|
|
|
|
const input = this.dialogDocument
|
|
|
|
if (input?.hasEdits) {
|
|
|
|
if (this.SGET_getDialogsState) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this.SSET_setDialogState(true)
|
|
|
|
this.dialogModel = true
|
|
|
|
}
|
|
|
|
else {
|
2021-03-04 13:27:07 +13:00
|
|
|
this.closeDocument(input).catch(e => console.log(e))
|
2021-03-03 08:59:56 +13:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-04 13:27:07 +13:00
|
|
|
async closeDocument (input: I_OpenedDocument) {
|
2021-03-03 08:59:56 +13:00
|
|
|
const dataPass = { doc: input, treeAction: false }
|
|
|
|
this.SSET_removeOpenedDocument(dataPass)
|
2021-03-04 13:27:07 +13:00
|
|
|
await this.$nextTick()
|
|
|
|
this.refreshRoute()
|
2021-03-03 08:59:56 +13:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
|
|
.documentCloseDialog {
|
|
|
|
min-width: 600px;
|
|
|
|
}
|
|
|
|
</style>
|