scinote-web/app/javascript/vue/protocol/modals/publish_protocol.vue

60 lines
2 KiB
Vue
Raw Normal View History

<template>
<div ref="modal" @keydown.esc="cancel" class="modal publish-modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
2023-08-17 19:55:17 +08:00
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="sn-icon sn-icon-close"></i></button>
<h4 class="modal-title">
{{ i18n.t('protocols.publish_modal.title', { nr: protocol.attributes.version })}}
</h4>
</div>
<div class="modal-body">
<div class="sci-input-container">
<label>{{ i18n.t('protocols.publish_modal.name')}}</label>
<div>{{ protocol.attributes.name }}</div>
</div>
<div class="sci-input-container">
<label>{{ i18n.t('protocols.publish_modal.comment')}}</label>
<textarea ref="textarea"
v-model="protocol.attributes.version_comment"
class="sci-input-field"
:placeholder="i18n.t('protocols.publish_modal.comment_placeholder')">
</textarea>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" @click="cancel">{{ i18n.t('general.cancel') }}</button>
<button class="btn btn-primary" @click="confirm">{{ i18n.t('protocols.publish_modal.publish')}}</button>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'publishProtocol',
props: {
protocol: {
type: Object,
required: true
}
},
mounted() {
$(this.$refs.modal).modal('show');
$(this.$refs.modal).on('hidden.bs.modal', () => {
this.$emit('cancel');
});
$(this.$refs.textarea).focus();
},
methods: {
confirm() {
$(this.$refs.modal).modal('hide');
this.$emit('publish', this.protocol.attributes.version_comment);
},
cancel() {
$(this.$refs.modal).modal('hide');
}
}
}
</script>