<template>
	<div class="event-type">
		<h3 class="top-breadcrumb"><strong>Event Type</strong><small> {{currentRoute}} </small> </h3>
		<br>
		<ul class="nav nav-pills border-0 bg-primary-pill">
			<li class="nav-item">
				<router-link class="nav-link" :to="{name: 'dashboard-event-type-search'}">Event Types</router-link>
			</li>
			<li class="nav-item">
				<router-link class="nav-link" :to="{name: 'event-type-add'}">Add New</router-link>
			</li>
			<li class="nav-item" v-if="eanableEdit">
				<router-link class="nav-link" :to="{name: 'event-type-edit'}">Edit</router-link>
			</li>
		</ul>
		<router-view />
	</div>
</template>
<script>
export default {
	data() {
		return {
			eanableEdit: false,
			currentRoute: 'Search',
		}
	},
	mounted: function() {
		if (this.$route.name == 'event-type-edit') {
			this.eanableEdit = true
			this.currentRoute = 'Edit'
		}
		if (this.$route.name == 'event-type-add') {
			this.currentRoute = 'Add'
		}
	},
	watch: {
		$route(to, from) {
			if (to.name == 'event-type-edit') {
				this.eanableEdit = true
				this.currentRoute = 'Edit'
			}
			if (to.name != 'event-type-edit') {
				this.eanableEdit = false
			}
			if (to.name == 'dashboard-event-type-search') {
				this.currentRoute = 'Search'
			}
			if (to.name == 'event-type-add') {
				this.currentRoute = 'Add'
			}
		}
	}
}
</script>
