AppToolbar.vue
3.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<template>
<v-toolbar class="fixcolors" fixed app>
<v-toolbar-title class="ml-0">
<v-toolbar-side-icon @click.stop="handleDrawerToggle" class="hide white--text"></v-toolbar-side-icon>
</v-toolbar-title>
<!-- ****** SEARCH ALL EXISTING STUDENTS ****** -->
<v-flex
xs7
sm3
class="userSearch"
v-if="$route.name != 'Dashboard' && $route.name != 'changepassword' && $route.name != 'generalSetting' && $route.name != 'resetPassword' && $route.name != 'bulkImport'"
>
<v-text-field
flat
append-icon="search"
label="Seacrh"
class="pl-3"
color="white"
@input.native="emitSearch"
type="text"
dark
></v-text-field>
</v-flex>
<v-spacer></v-spacer>
<v-menu offset-y origin="center center" :nudge-bottom="10" transition="scale-transition">
<v-btn icon large flat slot="activator">
<v-avatar>
<!-- <img src="/static/icon/user.png" /> -->
<v-icon dark size="40px" v-if="!userData.schoolLogoUrl && !userData.profilePicUrl">account_circle</v-icon>
<img :src="userData.schoolLogoUrl" v-else-if="userData.schoolLogoUrl" />
<img :src="userData.profilePicUrl" v-else-if="userData.profilePicUrl" />
</v-avatar>
</v-btn>
<v-list class="pa-0">
<v-list-tile
v-for="(item,index) in items"
:to="!item.href ? { name: item.name } : null"
:href="item.href"
@click="item.click"
ripple="ripple"
:disabled="item.disabled"
:target="item.target"
rel="noopener"
:key="index"
>
<v-list-tile-action v-if="item.icon">
<v-icon class="iconSize">{{ item.icon }}</v-icon>
</v-list-tile-action>
<v-list-tile-content>
<v-list-tile-title>{{ item.title }}</v-list-tile-title>
</v-list-tile-content>
</v-list-tile>
</v-list>
</v-menu>
</v-toolbar>
</template>
<script>
import http from "@/Services/http.js";
export default {
name: "app-toolbar",
data: () => ({
userName: "",
search: "",
userData: {},
items: [
{
icon: "account_circle",
href: "/resetPassword",
title: "Change Password",
click: e => {
console.log(e);
}
},
// {
// icon: 'settings',
// href: '#',
// title: 'Settings',
// click: (e) => {
// console.log(e);
// }
// },
{
icon: "lock",
href: "#",
title: "Logout",
click: e => {
window.getApp.$emit("APP_LOGOUT");
}
}
]
}),
computed: {
toolbarColor() {
return this.$vuetify.options.extra.mainNav;
}
},
mounted() {
this.getUserData();
},
methods: {
emitSearch(ev) {
this.$root.$emit("app:search", ev.target.value);
console.log("ev.target.value", ev.target.value);
},
handleDrawerToggle() {
window.getApp.$emit("APP_DRAWER_TOGGLED");
},
handleFullScreen() {
Util.toggleFullScreen();
},
getUserData() {
http()
.get("/getParticularUserDetail")
.then(response => {
this.userData = response.data.data;
})
.catch(error => {
if (error.response.status === 401) {
this.$router.replace({ path: "/" });
this.$store.dispatch("setToken", null);
this.$store.dispatch("Id", null);
}
});
}
}
};
</script>
<style>
.v-icon {
font-size: 30px;
}
.fixcolors {
background: #444b54 !important;
}
@media screen and (min-width: 1270px) {
.hide {
display: none;
}
/* }
@media screen and (max-width: 962px) {
.imglogo{
position: absolute;
top: 13px;
left: 13px !important;
width: 70px;
height: 24px;
} */
}
@media screen and (max-width: 420px) {
.v-list__tile {
font-size: 14px;
padding: 0 10px;
}
.name {
font-size: 15px;
}
}
</style>