Blame view

src/components/pageHeader/AppDrawer.vue 14.5 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
133
134
135
136
137
138
139
140
141
142
143
144
145
              <!-- <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>
          <template
            v-for="(item, i) in menuSchool"
            v-if="schoolRole === 'SUPERADMIN' && $route.name === 'School'"
          >
            <!-- {{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
146
                <v-list-tile-action v-if="item.icon">
68d742034   Neeraj Sharma   implement new des...
147
                  <img :src="item.icon" width="22" alt="icons" />
93a68cfa1   Jatinder Singh   first commit
148
                </v-list-tile-action>
68d742034   Neeraj Sharma   implement new des...
149
                <v-list-tile-content>
93a68cfa1   Jatinder Singh   first commit
150
151
                  <v-list-tile-title>{{ item.title }}</v-list-tile-title>
                </v-list-tile-content>
68d742034   Neeraj Sharma   implement new des...
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
228
229
230
              </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...
231
            </v-list-tile>
93a68cfa1   Jatinder Singh   first commit
232
          </template>
687e0b929   Neeraj Sharma   add user,attenden...
233
234
        </v-list>
      </vue-perfect-scrollbar>
93a68cfa1   Jatinder Singh   first commit
235
236
237
    </v-navigation-drawer>
  </template>
  <script>
687e0b929   Neeraj Sharma   add user,attenden...
238
239
  import menu from "@/api/menu";
  import VuePerfectScrollbar from "vue-perfect-scrollbar";
93a68cfa1   Jatinder Singh   first commit
240
  export default {
687e0b929   Neeraj Sharma   add user,attenden...
241
    name: "app-drawer",
93a68cfa1   Jatinder Singh   first commit
242
    components: {
687e0b929   Neeraj Sharma   add user,attenden...
243
      VuePerfectScrollbar
93a68cfa1   Jatinder Singh   first commit
244
245
246
247
248
    },
    props: {
      expanded: {
        type: Boolean,
        default: true
687e0b929   Neeraj Sharma   add user,attenden...
249
      }
93a68cfa1   Jatinder Singh   first commit
250
251
252
253
    },
    data: () => ({
      mini: false,
      drawer: true,
37150e7c1   Neeraj Sharma   implement school ...
254
      menus: [],
68d742034   Neeraj Sharma   implement new des...
255
256
257
      menuSchool: [],
      schoolRole: "",
      role: "",
93a68cfa1   Jatinder Singh   first commit
258
259
      scrollSettings: {
        maxScrollbarLength: 160
687e0b929   Neeraj Sharma   add user,attenden...
260
      }
93a68cfa1   Jatinder Singh   first commit
261
262
    }),
    computed: {
687e0b929   Neeraj Sharma   add user,attenden...
263
      computeGroupActive() {
93a68cfa1   Jatinder Singh   first commit
264
265
        return true;
      },
687e0b929   Neeraj Sharma   add user,attenden...
266
      computeLogo() {
68d742034   Neeraj Sharma   implement new des...
267
        return "/static/icon.png";
55f72b7d7   Neeraj Sharma   add new page are ...
268
      },
93a68cfa1   Jatinder Singh   first commit
269

687e0b929   Neeraj Sharma   add user,attenden...
270
      sideToolbarColor() {
93a68cfa1   Jatinder Singh   first commit
271
        return this.$vuetify.options.extra.sideNav;
687e0b929   Neeraj Sharma   add user,attenden...
272
      }
93a68cfa1   Jatinder Singh   first commit
273
    },
687e0b929   Neeraj Sharma   add user,attenden...
274
    created() {
68d742034   Neeraj Sharma   implement new des...
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
306
307
308
      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...
309
310
      window.getApp.$on("APP_DRAWER_TOGGLED", () => {
        this.drawer = !this.drawer;
93a68cfa1   Jatinder Singh   first commit
311
312
      });
    },
93a68cfa1   Jatinder Singh   first commit
313
    methods: {
687e0b929   Neeraj Sharma   add user,attenden...
314
      genChildTarget(item, subItem) {
93a68cfa1   Jatinder Singh   first commit
315
316
317
        if (subItem.href) return;
        if (subItem.component) {
          return {
687e0b929   Neeraj Sharma   add user,attenden...
318
            name: subItem.component
93a68cfa1   Jatinder Singh   first commit
319
320
          };
        }
687e0b929   Neeraj Sharma   add user,attenden...
321
322
        return { name: `${item.group}/${subItem.name}` };
      }
93a68cfa1   Jatinder Singh   first commit
323
324
325
326
327
328
329
    }
  };
  </script>
  
  
  <style lang="stylus">
  // @import '../../node_modules/vuetify/src/stylus/settings/_elevations.styl';
687e0b929   Neeraj Sharma   add user,attenden...
330
331
  #appDrawer {
    overflow: hidden;
93a68cfa1   Jatinder Singh   first commit
332

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

687e0b929   Neeraj Sharma   add user,attenden...
339
  .v-list__group__items--no-action .v-list__tile {
37150e7c1   Neeraj Sharma   implement school ...
340
    padding-left: 72px !important;
687e0b929   Neeraj Sharma   add user,attenden...
341
  }
37150e7c1   Neeraj Sharma   implement school ...
342

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

03dcbf0c1   Neeraj Sharma   fix all api and r...
348
  .v-list__tile__action {
687e0b929   Neeraj Sharma   add user,attenden...
349
    min-width: 36px;
03dcbf0c1   Neeraj Sharma   fix all api and r...
350
  }
687e0b929   Neeraj Sharma   add user,attenden...
351

68d742034   Neeraj Sharma   implement new des...
352
353
354
355
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
392
393
394
395
396
397
398
399
400
401
402
403
  // .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 {
    text-align: left  !important;
  }
  
  .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...
404
  }
687e0b929   Neeraj Sharma   add user,attenden...
405
406
407
  
  @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...
408
      font-size: 14px;
687e0b929   Neeraj Sharma   add user,attenden...
409
410
411
412
413
414
    }
  
    .imgLogo {
      height: 32px;
      width: 120px;
    }
03dcbf0c1   Neeraj Sharma   fix all api and r...
415
  }
93a68cfa1   Jatinder Singh   first commit
416
  </style>
d75967ec2   Neeraj Sharma   implemented chang...
417
418
419
  
  
  <style scoped>
687e0b929   Neeraj Sharma   add user,attenden...
420
421
422
  .theme--light .v-icon,
  .application .theme--light.v-icon {
    color: #39b982;
d75967ec2   Neeraj Sharma   implemented chang...
423
  }
68d742034   Neeraj Sharma   implement new des...
424
425
426
427
428
  .side-bar-color {
    background: #827bfa !important;
    border-top-right-radius: 74px !important;
  }
  /* a {
687e0b929   Neeraj Sharma   add user,attenden...
429
430
431
    text-decoration: none;
    display: inherit;
    color: black;
68d742034   Neeraj Sharma   implement new des...
432
433
434
435
  } */
  .hover:hover {
    color: red !important;
    background: red !important;
687e0b929   Neeraj Sharma   add user,attenden...
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
  }
  /* 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...
455
  </style>
68d742034   Neeraj Sharma   implement new des...
456