Chamilo is a learning management system focused on ease of use and accessibility
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.
chamilo-lms/assets/vue/components/Toolbar.vue

138 lines
2.5 KiB

<template>
<v-toolbar class="my-md-auto" elevation="0">
<slot name="left"></slot>
<v-spacer />
<div>
<v-btn
v-if="handleList"
:loading="isLoading"
color="primary"
@click="listItem"
>
{{ $t('List') }}
</v-btn>
<v-btn
v-if="handleEdit"
:loading="isLoading"
color="primary"
@click="editItem"
>
{{ $t('Edit') }}
</v-btn>
<v-btn
v-if="handleSubmit"
:loading="isLoading"
color="primary"
@click="submitItem"
>
<v-icon left>mdi-content-save</v-icon>
{{ $t('Submit') }}
</v-btn>
<v-btn
v-if="handleReset"
color="primary"
class="ml-sm-2"
@click="resetItem"
>
{{ $t('Reset') }}
</v-btn>
<v-btn
v-if="handleDelete"
color="error"
class="ml-sm-2"
@click="confirmDelete = true"
>
{{ $t('Delete') }}
</v-btn>
<v-btn v-if="handleAdd" color="primary" rounded @click="addItem">
<v-icon>mdi-plus-circle</v-icon>
</v-btn>
</div>
<ConfirmDelete
v-if="handleDelete"
:visible="confirmDelete"
:handle-delete="handleDelete"
@close="confirmDelete = false"
/>
</v-toolbar>
</template>
<script>
import ConfirmDelete from './ConfirmDelete';
export default {
name: 'Toolbar',
components: {
ConfirmDelete
},
data() {
return {
confirmDelete: false
};
},
props: {
handleList: {
type: Function,
required: false
},
handleEdit: {
type: Function,
required: false
},
handleSubmit: {
type: Function,
required: false
},
handleReset: {
type: Function,
required: false
},
handleDelete: {
type: Function,
required: false
},
handleAdd: {
type: Function,
required: false
},
title: {
type: String,
required: false
},
isLoading: {
type: Boolean,
required: false,
default: () => false
}
},
methods: {
listItem() {
if (this.handleList) {
this.handleList();
}
},
addItem() {
if (this.handleAdd) {
this.handleAdd();
}
},
editItem() {
if (this.handleEdit) {
this.handleEdit();
}
},
submitItem() {
if (this.handleSubmit) {
this.handleSubmit();
}
},
resetItem() {
if (this.handleReset) {
this.handleReset();
}
}
}
};
</script>