2018-03-17 18:26:18 +05:30
|
|
|
<script>
|
2018-05-09 12:01:36 +05:30
|
|
|
import $ from 'jquery';
|
|
|
|
import eventHub from '../../event_hub';
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
isLocked: {
|
|
|
|
required: true,
|
|
|
|
type: Boolean,
|
|
|
|
},
|
|
|
|
|
|
|
|
updateLockedAttribute: {
|
|
|
|
required: true,
|
|
|
|
type: Function,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
buttonText() {
|
|
|
|
return this.isLocked ? this.__('Unlock') : this.__('Lock');
|
|
|
|
},
|
|
|
|
|
|
|
|
toggleLock() {
|
|
|
|
return !this.isLocked;
|
|
|
|
},
|
|
|
|
},
|
2018-05-09 12:01:36 +05:30
|
|
|
|
|
|
|
methods: {
|
|
|
|
closeForm() {
|
|
|
|
eventHub.$emit('closeLockForm');
|
|
|
|
$(this.$el).trigger('hidden.gl.dropdown');
|
|
|
|
},
|
|
|
|
submitForm() {
|
|
|
|
this.closeForm();
|
|
|
|
this.updateLockedAttribute(this.toggleLock);
|
|
|
|
},
|
|
|
|
},
|
2018-03-17 18:26:18 +05:30
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div class="sidebar-item-warning-message-actions">
|
|
|
|
<button
|
|
|
|
type="button"
|
|
|
|
class="btn btn-default append-right-10"
|
2018-05-09 12:01:36 +05:30
|
|
|
@click="closeForm"
|
2018-03-17 18:26:18 +05:30
|
|
|
>
|
|
|
|
{{ __('Cancel') }}
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button
|
|
|
|
type="button"
|
|
|
|
class="btn btn-close"
|
2018-05-09 12:01:36 +05:30
|
|
|
@click.prevent="submitForm"
|
2018-03-17 18:26:18 +05:30
|
|
|
>
|
|
|
|
{{ buttonText }}
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</template>
|