Blame view

src/components/pageHeader/AppDrawer.vue 14.7 KB
93a68cfa1   Jatinder Singh   first commit
1
2
3
4
5
6
7
8
  <template>
    <v-navigation-drawer
      id="appDrawer"
      :mini-variant.sync="mini"
      fixed
      :dark="$vuetify.dark"
      app
      v-model="drawer"
68d742034   Neeraj Sharma   implement new des...
9
      hide-overlay
93a68cfa1   Jatinder Singh   first commit
10
      width="260"
687e0b929   Neeraj Sharma   add user,attenden...
11
    >
68d742034   Neeraj Sharma   implement new des...
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
      <img
        v-bind:src="computeLogo"
        height="40"
        width="130"
        class="imgLogo mb-3 mt-3"
        alt="logo"
        style="margin: auto;
        display: block;"
      />
      <!-- <v-toolbar class="white" flat>
      <img
        v-bind:src="computeLogo"
        height="40"
        width="140"
        class="imgLogo"
        alt="logo"
        style="15px 0px 0px 40px !important;"
      />
      </v-toolbar>-->
      <vue-perfect-scrollbar
        class="drawer-menu--scroll side-bar-color mt-3"
        :settings="scrollSettings"
      >
        <v-list dense expand class="white--text">
          <template v-for="(item, i) in menus" v-if="role === 'ADMIN'">
            <!-- {{menus}} -->
687e0b929   Neeraj Sharma   add user,attenden...
38
39
40
41
42
43
44
45
            <!--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">
68d742034   Neeraj Sharma   implement new des...
46
47
                <v-list-tile-action v-if="item.icon">
                  <img :src="item.icon" width="22" alt="icons" />
687e0b929   Neeraj Sharma   add user,attenden...
48
49
50
51
52
53
54
55
56
57
58
59
60
61
                </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
62
                    <v-list-tile-content>
687e0b929   Neeraj Sharma   add user,attenden...
63
                      <v-list-tile-title>{{ subItem.title }}</v-list-tile-title>
93a68cfa1   Jatinder Singh   first commit
64
                    </v-list-tile-content>
93a68cfa1   Jatinder Singh   first commit
65
                  </v-list-tile>
687e0b929   Neeraj Sharma   add user,attenden...
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
                  <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"
68d742034   Neeraj Sharma   implement new des...
113
114
115
              :key="item.name"
              :to="!item.href ? { name: item.name } : null"
              :href="item.href"
687e0b929   Neeraj Sharma   add user,attenden...
116
            >
68d742034   Neeraj Sharma   implement new des...
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
              <!-- <a :href="item.path"> -->
              <v-list-tile-action v-if="item.icon">
                <img :src="item.icon" width="22" alt="icons" />
              </v-list-tile-action>
              <v-list-tile-content class="pt-2">
                <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">
                <!-- <v-icon class="success--text">{{ item.subAction }}</v-icon> -->
                <!-- <img :src="item.icon" width="40" alt="icons" /> -->
              </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> -->
              <!-- </a> -->
            </v-list-tile>
          </template>
dfd943df6   Shikha Mishra   app drawer
133
          <template v-for="(item, i) in menuSchool" v-if="schoolRole === 'SUPERADMIN'">
68d742034   Neeraj Sharma   implement new des...
134
135
136
137
138
139
140
141
142
            <!-- {{menus}} -->
            <!--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">
93a68cfa1   Jatinder Singh   first commit
143
                <v-list-tile-action v-if="item.icon">
68d742034   Neeraj Sharma   implement new des...
144
                  <img :src="item.icon" width="22" alt="icons" />
93a68cfa1   Jatinder Singh   first commit
145
                </v-list-tile-action>
68d742034   Neeraj Sharma   implement new des...
146
                <v-list-tile-content>
93a68cfa1   Jatinder Singh   first commit
147
148
                  <v-list-tile-title>{{ item.title }}</v-list-tile-title>
                </v-list-tile-content>
68d742034   Neeraj Sharma   implement new des...
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
              </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">
                    <v-list-tile-content>
                      <v-list-tile-title>{{ subItem.title }}</v-list-tile-title>
                    </v-list-tile-content>
                  </v-list-tile>
                  <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.name"
              :to="!item.href ? { name: item.name } : null"
              :href="item.href"
            >
              <!-- <a :href="item.path"> -->
              <v-list-tile-action v-if="item.icon">
                <img :src="item.icon" width="22" alt="icons" />
              </v-list-tile-action>
              <v-list-tile-content class="pt-2">
                <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">
                <!-- <v-icon class="success--text">{{ item.subAction }}</v-icon> -->
                <!-- <img :src="item.icon" width="40" alt="icons" /> -->
              </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> -->
              <!-- </a> -->
687e0b929   Neeraj Sharma   add user,attenden...
228
            </v-list-tile>
93a68cfa1   Jatinder Singh   first commit
229
          </template>
687e0b929   Neeraj Sharma   add user,attenden...
230
231
        </v-list>
      </vue-perfect-scrollbar>
93a68cfa1   Jatinder Singh   first commit
232
233
234
    </v-navigation-drawer>
  </template>
  <script>
687e0b929   Neeraj Sharma   add user,attenden...
235
236
  import menu from "@/api/menu";
  import VuePerfectScrollbar from "vue-perfect-scrollbar";
93a68cfa1   Jatinder Singh   first commit
237
  export default {
687e0b929   Neeraj Sharma   add user,attenden...
238
    name: "app-drawer",
93a68cfa1   Jatinder Singh   first commit
239
    components: {
687e0b929   Neeraj Sharma   add user,attenden...
240
      VuePerfectScrollbar
93a68cfa1   Jatinder Singh   first commit
241
242
243
244
245
    },
    props: {
      expanded: {
        type: Boolean,
        default: true
687e0b929   Neeraj Sharma   add user,attenden...
246
      }
93a68cfa1   Jatinder Singh   first commit
247
248
249
250
    },
    data: () => ({
      mini: false,
      drawer: true,
37150e7c1   Neeraj Sharma   implement school ...
251
      menus: [],
68d742034   Neeraj Sharma   implement new des...
252
253
254
      menuSchool: [],
      schoolRole: "",
      role: "",
93a68cfa1   Jatinder Singh   first commit
255
256
      scrollSettings: {
        maxScrollbarLength: 160
687e0b929   Neeraj Sharma   add user,attenden...
257
      }
93a68cfa1   Jatinder Singh   first commit
258
259
    }),
    computed: {
687e0b929   Neeraj Sharma   add user,attenden...
260
      computeGroupActive() {
93a68cfa1   Jatinder Singh   first commit
261
262
        return true;
      },
687e0b929   Neeraj Sharma   add user,attenden...
263
      computeLogo() {
68d742034   Neeraj Sharma   implement new des...
264
        return "/static/icon.png";
55f72b7d7   Neeraj Sharma   add new page are ...
265
      },
93a68cfa1   Jatinder Singh   first commit
266

687e0b929   Neeraj Sharma   add user,attenden...
267
      sideToolbarColor() {
93a68cfa1   Jatinder Singh   first commit
268
        return this.$vuetify.options.extra.sideNav;
687e0b929   Neeraj Sharma   add user,attenden...
269
      }
93a68cfa1   Jatinder Singh   first commit
270
    },
687e0b929   Neeraj Sharma   add user,attenden...
271
    created() {
68d742034   Neeraj Sharma   implement new des...
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
      this.schoolRole = this.$store.state.schoolRole;
      this.role = this.$store.state.role;
      this.menus = menu.adminMenu;
      this.menuSchool = menu.schoolMenu;
      // console.log("this.$route.name", this.$route.name);
      // if (this.$route.name === "School") {
      //   localStorage.setItem("SchoolName", this.$route.name);
      // }
      // if (this.$route.name === "Dashboard") {
      //   localStorage.setItem("AdminName", this.$route.name);
      // }
      // console.log("SN", localStorage.getItem("SchoolName"));
      // if (localStorage.getItem("SchoolName") === "School") {
      // if (this.$store.state.schoolRole === "SUPERADMIN") {
      //   console.log("rolA", this.$store.state.schoolRole);
      // if (this.$store.state.schoolRole === "SUPERADMIN") {
      // }
      //   console.log("this.menus", this.menus);
      // }
      // // }
      // // console.log("AN", localStorage.getItem("AdminName"));
      // // if (localStorage.getItem("AdminName") === "Dashboard") {
      // if (this.$store.state.role === "ADMIN") {
      //   console.log("role", this.$store.state.role);
      // else if (this.$store.state.role === "ADMIN") {
      // }
      //   // }
      // }
  
      // else if (this.$store.state.role === "LIBRARIAN") {
      //   this.menus = menu.libraryMenu;
      // } else if (this.$store.state.role === "ACCOUNTANT") {
      //   this.menus = menu.accountMenu;
      // }
687e0b929   Neeraj Sharma   add user,attenden...
306
307
      window.getApp.$on("APP_DRAWER_TOGGLED", () => {
        this.drawer = !this.drawer;
93a68cfa1   Jatinder Singh   first commit
308
309
      });
    },
93a68cfa1   Jatinder Singh   first commit
310
    methods: {
687e0b929   Neeraj Sharma   add user,attenden...
311
      genChildTarget(item, subItem) {
93a68cfa1   Jatinder Singh   first commit
312
313
314
        if (subItem.href) return;
        if (subItem.component) {
          return {
687e0b929   Neeraj Sharma   add user,attenden...
315
            name: subItem.component
93a68cfa1   Jatinder Singh   first commit
316
317
          };
        }
687e0b929   Neeraj Sharma   add user,attenden...
318
319
        return { name: `${item.group}/${subItem.name}` };
      }
dfd943df6   Shikha Mishra   app drawer
320
321
322
323
324
325
326
    },
    mounted() {
     if (this.$store.state.role === "ADMIN") {
        this.token = this.$store.state.token;
     } if (this.$store.state.schoolRole === "SUPERADMIN") {
       this.token = this.$store.schoolToken;
     }
93a68cfa1   Jatinder Singh   first commit
327
328
329
330
331
332
333
    }
  };
  </script>
  
  
  <style lang="stylus">
  // @import '../../node_modules/vuetify/src/stylus/settings/_elevations.styl';
687e0b929   Neeraj Sharma   add user,attenden...
334
335
  #appDrawer {
    overflow: hidden;
93a68cfa1   Jatinder Singh   first commit
336

687e0b929   Neeraj Sharma   add user,attenden...
337
338
339
340
341
    .drawer-menu--scroll {
      height: calc(100vh - 48px);
      overflow: auto;
    }
  }
37150e7c1   Neeraj Sharma   implement school ...
342

687e0b929   Neeraj Sharma   add user,attenden...
343
  .v-list__group__items--no-action .v-list__tile {
37150e7c1   Neeraj Sharma   implement school ...
344
    padding-left: 72px !important;
687e0b929   Neeraj Sharma   add user,attenden...
345
  }
37150e7c1   Neeraj Sharma   implement school ...
346

03dcbf0c1   Neeraj Sharma   fix all api and r...
347
  .v-list--dense .v-list__tile:not(.v-list__tile--avatar) {
68d742034   Neeraj Sharma   implement new des...
348
    height: 54px;
687e0b929   Neeraj Sharma   add user,attenden...
349
    font-size: 17px;
03dcbf0c1   Neeraj Sharma   fix all api and r...
350
  }
687e0b929   Neeraj Sharma   add user,attenden...
351

03dcbf0c1   Neeraj Sharma   fix all api and r...
352
  .v-list__tile__action {
687e0b929   Neeraj Sharma   add user,attenden...
353
    min-width: 36px;
03dcbf0c1   Neeraj Sharma   fix all api and r...
354
  }
687e0b929   Neeraj Sharma   add user,attenden...
355

68d742034   Neeraj Sharma   implement new des...
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
  // .theme--light .v-icon, .application .theme--light.v-icon {
  // color: #f1f1f1;
  // }
  .ps>.ps__scrollbar-y-rail>.ps__scrollbar-y {
    background-color: #f5f5f5;
    background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.44, rgb(122, 153, 217)), color-stop(0.72, rgb(73, 125, 189)), color-stop(0.86, rgb(28, 58, 148)));
    width: 8px !important;
  }
  
  .ps>.ps__scrollbar-y-rail {
    width: 0px !important;
  }
  
  .ps:hover > .ps__scrollbar-y-rail:hover {
    background-color: #5f2171 !important;
    opacity: 0.9;
  }
  
  .ps > .ps__scrollbar-y-rail:hover > .ps__scrollbar-y {
    width: 8px !important;
    background-color: #f5f5f5;
    background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.44, rgb(122, 153, 217)), color-stop(0.72, rgb(73, 125, 189)), color-stop(0.86, rgb(28, 58, 148)));
  }
  
  .ps:hover > .ps__scrollbar-y-rail:hover > .ps__scrollbar-y {
    // background-color: #5f2171 !important;
    width: 8px !important;
    background-color: #f5f5f5;
    background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.44, rgb(122, 153, 217)), color-stop(0.72, rgb(73, 125, 189)), color-stop(0.86, rgb(28, 58, 148)));
  }
  
  .v-list__tile--active {
    color: #71d9ea !important;
  }
  
  .my-1 {
dfd943df6   Shikha Mishra   app drawer
392
    text-align: left !important;
68d742034   Neeraj Sharma   implement new des...
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
  }
  
  .title {
    line-height: 2 !important;
  }
  
  // .v-list__tile--hover {
  // color: white !important;
  // background: red !important;
  // }
  .v-list .v-list__tile--link:hover, .v-list .v-list__tile--highlighted, .v-list .v-list__group__header:hover, .v-list .v-list__group--active:before, .v-list .v-list__group--active:after {
    background: #7f62f8 !important;
    color: #71d9ea !important;
    box-shadow: 0 3px 3px -2px rgba(0, 0, 0, 0.2), 0 3px 4px 0 rgba(0, 0, 0, 0.14), 0 1px 8px 0 rgba(0, 0, 0, 0.12) !important;
    // border-radius: 12px !important;
03dcbf0c1   Neeraj Sharma   fix all api and r...
408
  }
687e0b929   Neeraj Sharma   add user,attenden...
409
410
411
  
  @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...
412
      font-size: 14px;
687e0b929   Neeraj Sharma   add user,attenden...
413
414
415
416
417
418
    }
  
    .imgLogo {
      height: 32px;
      width: 120px;
    }
03dcbf0c1   Neeraj Sharma   fix all api and r...
419
  }
93a68cfa1   Jatinder Singh   first commit
420
  </style>
d75967ec2   Neeraj Sharma   implemented chang...
421
422
423
  
  
  <style scoped>
687e0b929   Neeraj Sharma   add user,attenden...
424
425
426
  .theme--light .v-icon,
  .application .theme--light.v-icon {
    color: #39b982;
d75967ec2   Neeraj Sharma   implemented chang...
427
  }
68d742034   Neeraj Sharma   implement new des...
428
429
430
431
432
  .side-bar-color {
    background: #827bfa !important;
    border-top-right-radius: 74px !important;
  }
  /* a {
687e0b929   Neeraj Sharma   add user,attenden...
433
434
435
    text-decoration: none;
    display: inherit;
    color: black;
68d742034   Neeraj Sharma   implement new des...
436
437
438
439
  } */
  .hover:hover {
    color: red !important;
    background: red !important;
687e0b929   Neeraj Sharma   add user,attenden...
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
  }
  /* 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...
459
  </style>
68d742034   Neeraj Sharma   implement new des...
460