Blame view

src/components/pageHeader/AppDrawer.vue 7.21 KB
93a68cfa1   Jatinder Singh   first commit
1
2
3
4
5
6
7
8
9
  <template>
    <v-navigation-drawer
      id="appDrawer"
      :mini-variant.sync="mini"
      fixed
      :dark="$vuetify.dark"
      app
      v-model="drawer"
      width="260"
687e0b929   Neeraj Sharma   add user,attenden...
10
11
12
13
    >
      <v-toolbar class="fixcolors">
        <img v-bind:src="computeLogo" height="40" width="150" class="imgLogo" alt="ana" />
        <v-toolbar-title class="ml-0 pl-3"></v-toolbar-title>
93a68cfa1   Jatinder Singh   first commit
14
15
16
17
      </v-toolbar>
      <vue-perfect-scrollbar class="drawer-menu--scroll" :settings="scrollSettings">
        <v-list dense expand>
          <template v-for="(item, i) in menus">
687e0b929   Neeraj Sharma   add user,attenden...
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
            <!--group with subitems-->
            <v-list-group
              v-if="item.items"
              :key="item.name"
              :group="item.group"
              no-action="no-action"
            >
              <v-list-tile slot="activator" ripple="ripple">
                <v-list-tile-action v-if="item.icon" class="pr-3">
                  <img :src="item.icon" width="40" alt="icons" />
                </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>
              <template v-for="(subItem, i) in item.items">
                <!--sub group-->
                <v-list-group
                  v-if="subItem.items"
                  :key="subItem.name"
                  :group="subItem.group"
                  sub-group="sub-group"
                >
                  <v-list-tile slot="activator" ripple="ripple">
93a68cfa1   Jatinder Singh   first commit
42
                    <v-list-tile-content>
687e0b929   Neeraj Sharma   add user,attenden...
43
                      <v-list-tile-title>{{ subItem.title }}</v-list-tile-title>
93a68cfa1   Jatinder Singh   first commit
44
                    </v-list-tile-content>
93a68cfa1   Jatinder Singh   first commit
45
                  </v-list-tile>
687e0b929   Neeraj Sharma   add user,attenden...
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
                  <v-list-tile
                    v-for="(grand, i) in subItem.children"
                    :key="i"
                    :to="genChildTarget(item, grand)"
                    :href="grand.href"
                    ripple="ripple"
                  >
                    <v-list-tile-content>
                      <v-list-tile-title>{{ grand.title }}</v-list-tile-title>
                    </v-list-tile-content>
                  </v-list-tile>
                </v-list-group>
                <!--child item-->
                <v-list-tile
                  v-else
                  :key="i"
                  :to="genChildTarget(item, subItem)"
                  :href="subItem.href"
                  :disabled="subItem.disabled"
                  :target="subItem.target"
                  ripple="ripple"
                >
                  <v-list-tile-action v-if="subItem.action">
                    <img
                      width="30"
                      :src="subItem.action"
                      :class="[subItem.actionClass || 'success--text']"
                    />
                  </v-list-tile-action>
                  <v-list-tile-content>
                    <v-list-tile-title class="body-2">
                      <span>{{ subItem.title }}</span>
                    </v-list-tile-title>
                  </v-list-tile-content>
                  <!-- <v-circle class="white--text pa-0 circle-pill" v-if="subItem.badge" color="red" disabled="disabled">{{ subItem.badge }}</v-circle> -->
                </v-list-tile>
              </template>
            </v-list-group>
            <v-subheader v-else-if="item.header" :key="i">{{ item.header }}</v-subheader>
            <v-divider v-else-if="item.divider" :key="i"></v-divider>
            <!--top-level link-->
            <v-list-tile
              v-else
              ripple="ripple"
              :disabled="item.disabled"
              :target="item.target"
              rel="noopener"
              :key="item.path"
            >
              <a :href="item.path">
93a68cfa1   Jatinder Singh   first commit
96
                <v-list-tile-action v-if="item.icon">
687e0b929   Neeraj Sharma   add user,attenden...
97
                  <img :src="item.icon" width="40" alt="icons" />
93a68cfa1   Jatinder Singh   first commit
98
                </v-list-tile-action>
687e0b929   Neeraj Sharma   add user,attenden...
99
                <v-list-tile-content class="pl-3 mt-2">
93a68cfa1   Jatinder Singh   first commit
100
101
102
103
                  <v-list-tile-title>{{ item.title }}</v-list-tile-title>
                </v-list-tile-content>
                <!-- <v-circle class="white--text pa-0 chip--x-small" v-if="item.badge" :color="item.color || 'primary'" disabled="disabled">{{ item.badge }}</v-circle> -->
                <v-list-tile-action v-if="item.subAction">
687e0b929   Neeraj Sharma   add user,attenden...
104
105
                  <!-- <v-icon class="success--text">{{ item.subAction }}</v-icon> -->
                  <img :src="item.icon" width="40" alt="icons" />
93a68cfa1   Jatinder Singh   first commit
106
107
                </v-list-tile-action>
                <!-- <v-circle class="caption blue lighten-2 white--text mx-0" v-else-if="item.chip" label="label" small="small">{{ item.chip }}</v-circle> -->
687e0b929   Neeraj Sharma   add user,attenden...
108
109
              </a>
            </v-list-tile>
93a68cfa1   Jatinder Singh   first commit
110
          </template>
687e0b929   Neeraj Sharma   add user,attenden...
111
112
        </v-list>
      </vue-perfect-scrollbar>
93a68cfa1   Jatinder Singh   first commit
113
114
115
    </v-navigation-drawer>
  </template>
  <script>
687e0b929   Neeraj Sharma   add user,attenden...
116
117
  import menu from "@/api/menu";
  import VuePerfectScrollbar from "vue-perfect-scrollbar";
93a68cfa1   Jatinder Singh   first commit
118
  export default {
687e0b929   Neeraj Sharma   add user,attenden...
119
    name: "app-drawer",
93a68cfa1   Jatinder Singh   first commit
120
    components: {
687e0b929   Neeraj Sharma   add user,attenden...
121
      VuePerfectScrollbar
93a68cfa1   Jatinder Singh   first commit
122
123
124
125
126
    },
    props: {
      expanded: {
        type: Boolean,
        default: true
687e0b929   Neeraj Sharma   add user,attenden...
127
      }
93a68cfa1   Jatinder Singh   first commit
128
129
130
131
    },
    data: () => ({
      mini: false,
      drawer: true,
37150e7c1   Neeraj Sharma   implement school ...
132
      menus: [],
93a68cfa1   Jatinder Singh   first commit
133
134
      scrollSettings: {
        maxScrollbarLength: 160
687e0b929   Neeraj Sharma   add user,attenden...
135
      }
93a68cfa1   Jatinder Singh   first commit
136
137
    }),
    computed: {
687e0b929   Neeraj Sharma   add user,attenden...
138
      computeGroupActive() {
93a68cfa1   Jatinder Singh   first commit
139
140
        return true;
      },
687e0b929   Neeraj Sharma   add user,attenden...
141
142
      computeLogo() {
        return "/static/logoIntrack.png";
55f72b7d7   Neeraj Sharma   add new page are ...
143
      },
93a68cfa1   Jatinder Singh   first commit
144

687e0b929   Neeraj Sharma   add user,attenden...
145
      sideToolbarColor() {
93a68cfa1   Jatinder Singh   first commit
146
        return this.$vuetify.options.extra.sideNav;
687e0b929   Neeraj Sharma   add user,attenden...
147
      }
93a68cfa1   Jatinder Singh   first commit
148
    },
687e0b929   Neeraj Sharma   add user,attenden...
149
    created() {
37150e7c1   Neeraj Sharma   implement school ...
150
151
152
153
      if (this.$store.state.role === "ADMIN") {
        this.menus = menu.adminMenu;
      } else if (this.$store.state.role === "SUPERADMIN") {
        this.menus = menu.schoolMenu;
99cd79184   Neeraj Sharma   implement all tas...
154
155
156
157
      } else if (this.$store.state.role === "LIBRARIAN") {
        this.menus = menu.libraryMenu;
      } else if (this.$store.state.role === "ACCOUNTANT") {
        this.menus = menu.accountMenu;
37150e7c1   Neeraj Sharma   implement school ...
158
      }
687e0b929   Neeraj Sharma   add user,attenden...
159
160
      window.getApp.$on("APP_DRAWER_TOGGLED", () => {
        this.drawer = !this.drawer;
93a68cfa1   Jatinder Singh   first commit
161
162
      });
    },
93a68cfa1   Jatinder Singh   first commit
163
164
  
    methods: {
687e0b929   Neeraj Sharma   add user,attenden...
165
      genChildTarget(item, subItem) {
93a68cfa1   Jatinder Singh   first commit
166
167
168
        if (subItem.href) return;
        if (subItem.component) {
          return {
687e0b929   Neeraj Sharma   add user,attenden...
169
            name: subItem.component
93a68cfa1   Jatinder Singh   first commit
170
171
          };
        }
687e0b929   Neeraj Sharma   add user,attenden...
172
173
        return { name: `${item.group}/${subItem.name}` };
      }
93a68cfa1   Jatinder Singh   first commit
174
175
176
177
178
179
180
    }
  };
  </script>
  
  
  <style lang="stylus">
  // @import '../../node_modules/vuetify/src/stylus/settings/_elevations.styl';
687e0b929   Neeraj Sharma   add user,attenden...
181
182
  #appDrawer {
    overflow: hidden;
93a68cfa1   Jatinder Singh   first commit
183

687e0b929   Neeraj Sharma   add user,attenden...
184
185
186
187
188
    .drawer-menu--scroll {
      height: calc(100vh - 48px);
      overflow: auto;
    }
  }
37150e7c1   Neeraj Sharma   implement school ...
189

687e0b929   Neeraj Sharma   add user,attenden...
190
  .v-list__group__items--no-action .v-list__tile {
37150e7c1   Neeraj Sharma   implement school ...
191
    padding-left: 72px !important;
687e0b929   Neeraj Sharma   add user,attenden...
192
  }
37150e7c1   Neeraj Sharma   implement school ...
193

03dcbf0c1   Neeraj Sharma   fix all api and r...
194
  .v-list--dense .v-list__tile:not(.v-list__tile--avatar) {
687e0b929   Neeraj Sharma   add user,attenden...
195
196
    height: 60px;
    font-size: 17px;
03dcbf0c1   Neeraj Sharma   fix all api and r...
197
  }
687e0b929   Neeraj Sharma   add user,attenden...
198

03dcbf0c1   Neeraj Sharma   fix all api and r...
199
  .v-list__tile__action {
687e0b929   Neeraj Sharma   add user,attenden...
200
    min-width: 36px;
03dcbf0c1   Neeraj Sharma   fix all api and r...
201
  }
687e0b929   Neeraj Sharma   add user,attenden...
202
203
204
205
206
  
  .v-list__tile.primary--text a {
    color: black !important;
    border-left: 4px solid black;
    border-radius: 4px;
03dcbf0c1   Neeraj Sharma   fix all api and r...
207
  }
687e0b929   Neeraj Sharma   add user,attenden...
208
209
210
  
  @media screen and (max-width: 420px) {
    .v-list--dense .v-list__tile:not(.v-list__tile--avatar) {
03dcbf0c1   Neeraj Sharma   fix all api and r...
211
      font-size: 14px;
687e0b929   Neeraj Sharma   add user,attenden...
212
213
214
215
216
217
    }
  
    .imgLogo {
      height: 32px;
      width: 120px;
    }
03dcbf0c1   Neeraj Sharma   fix all api and r...
218
  }
93a68cfa1   Jatinder Singh   first commit
219
  </style>
d75967ec2   Neeraj Sharma   implemented chang...
220
221
222
  
  
  <style scoped>
687e0b929   Neeraj Sharma   add user,attenden...
223
224
225
  .theme--light .v-icon,
  .application .theme--light.v-icon {
    color: #39b982;
d75967ec2   Neeraj Sharma   implemented chang...
226
  }
687e0b929   Neeraj Sharma   add user,attenden...
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
  a {
    text-decoration: none;
    display: inherit;
    color: black;
  }
  a:hover {
    color: gray !important;
    /* border-left: 4px solid black; */
    /* border-radius: 4px; */
  }
  /* a:active {
    color: red !important;
  } */
  /* a:visited {
    border-left: 4px solid black;
    border-radius: 4px;
  } */
  /* visited link */
  /* a:visited {
    color: black !important;
    border-left: 4px solid black;
    border-radius: 4px;
  }
  a:active {
    color: black !important;
    border-left: 4px solid black;
    border-radius: 4px;
  }  */
d75967ec2   Neeraj Sharma   implemented chang...
255
  </style>