image

Installation process

The following process will be used to install admin dashboard using package manager.

  • Install Node.js : Please install latest version of Node.js from https://nodejs.org
  • Extract main template : Extract the admin template site to your suitable directory or folder.
  • Access Command Prompt : Open node.js command prompt.
    • Note:- The process mentioned below can also be excuted with system command prompt.
  • In CMD, Navigate to the location where main folder is extracted.
  • Navigate to the root folder of project where package.json file exist.
  • Install node dependencies : Run npm install.
  • To run npm start.
    • Note:- when you run above command it will run project in browser automatically.
    • Note:- It will enable auto refresh function everytime you save a file.
  • Run command npm run build to build for production.

In case if you have any problems or query then please contact us

File Sturcture

The arrangement below describes our file structure.

  • Vristo
    • src
      • assets
        • css
        • images
        • i18n
      • app
        • layout
        • store
        • service
        • app.component.html - angularjs project startup file
        • app.component.ts
        • app.module.ts - angularjs entry point file
        • app.route.ts - angularjs router file
        • all the app pages
        • theme.config.ts
    • index.html
    • main.ts
    • package.json
    • tailwind.config.js
    • tsconfig.json
    • tsconfig.app.json
    • tsconfig.spec.json
    • angular.json
    • .editorconfig
    • .gitignore
    • .prettierrc

Code Structure

This section will give you a brief description of our code.

1. Header Section : This is the default navbar section. It contains :

  • Sidebar Toggle button.
  • Quick access button for calendar.
  • Quick access button for todolist.
  • Quick access button for chat.
  • Search Bar
  • Theme toggle button.
  • Language Dropdown
  • Message Dropdown
  • Notification Dropdown
  • User Profile with Dropdown
  • Horizontal Menu

Note:- These categories are defined by us and you can modify as per your needs :)

  <!--  Navbar Component  -->
  <header></header>
  ==========================================================

  <!--  BEGIN NAVBAR  -->
  <header class="shadow-sm" [ngClass]="{ 'dark text-white-dark': store.semidark && store.menu === 'horizontal'}">
        <div class="relative flex w-full items-center bg-white px-5 py-2.5 dark:bg-[#0e1726]">
            ..............................
        </div>

        <!-- horizontal menu -->
        <ul
            class="horizontal-menu hidden border-t border-[#ebedf2] bg-white py-1.5 px-6 font-semibold text-black rtl:space-x-reverse dark:border-[#191e3a] dark:bg-[#0e1726] dark:text-white-dark lg:space-x-1.5 xl:space-x-8"
        >
            ..............................
        </ul>
  </header>
  <!--  END NAVBAR  -->

2. Main Container Section : The main container section includes header, footer and main content section.

  • Sidebar Section
  • Header Section
  • Main Content Section
  • Footer Section
  <!--  BEGIN MAIN CONTAINER  -->
  <div
        class="main-section relative font-nunito text-sm font-normal antialiased"
        [ngClass]="[store.sidebar ? 'toggle-sidebar' : '', store.menu, store.layout, store.rtlClass]"
  >
      ..............................
  </div>
  <!-- END MAIN CONTAINER -->

3. Sidebar : This is the sidebar code.

  <!--  Sidebar Component  -->
  <sidebar></sidebar>
  ==========================================================

  <!--  BEGIN SIDEBAR  -->
  <div [ngClass]="{ 'dark text-white-dark': store.semidark }">
      <nav class="sidebar fixed top-0 bottom-0 z-50 h-full min-h-screen w-[260px] shadow-[5px_0_25px_0_rgba(94,92,154,0.1)] transition-all duration-300">
          ..............................
      </nav>
  </div>
  <!--  END SIDEBAR  -->

4. Main Content : This is the Main Content code section.

This is the root structure where you can create widgets, charts, tables etc.

  <!--  BEGIN CONTENT PART  -->
  <div class="main-content">
      ..............................
  </div>

  <!--  END CONTENT PART  -->

5. Footer : This is the Footer code.

  <!--  Footer Component  -->
  <footer></footer>
  ==========================================================

  <!--  BEGIN FOOTER  -->
  <p class="pt-6 text-center dark:text-white-dark ltr:sm:text-left rtl:sm:text-right">
      ..............................
  </p>
  <!--  END FOOTER  -->

The Combined Code

Now, after a brief description of our admin template. Below is the combined code of the snippets we have discuss above.

  <!--  BEGIN MAIN CONTAINER  -->
  <div
    class="main-section relative font-nunito text-sm font-normal antialiased"
    [ngClass]="[store.sidebar ? 'toggle-sidebar' : '', store.menu, store.layout, store.rtlClass]"
  >
      <!-- BEGIN SIDEBAR MENU OVERLAY -->
      <div class="fixed inset-0 z-50 bg-[black]/60 lg:hidden"  [ngClass]="{ hidden: !store.sidebar }"  (click)="storeData.dispatch({ type: 'toggleSidebar' })"></div>
      <!-- END SIDEBAR MENU OVERLAY -->

      <!-- BEGIN SCREEN LOADER -->
      <div
            *ngIf="store.isShowMainLoader"
            class="screen_loader fixed inset-0 bg-[#fafafa] dark:bg-[#060818] z-[60] grid place-content-center animate__animated"
      >
          <svg>...</svg>
      </div>
      <!-- END SCREEN LOADER -->

      <!-- BEGIN SCROLL TO TOP BUTTON -->
      <div *ngIf="showTopButton" class="fixed bottom-6 z-50 ltr:right-6 rtl:left-6">
            <button type="button" class="btn btn-outline-primary animate-pulse rounded-full bg-[#fafafa] p-2 dark:bg-[#060818] dark:hover:bg-primary" @click="goToTop">
                <svg>...</svg>
            </button>
      </div>
      <!-- END SCROLL TO TOP BUTTON -->

      <!-- BEGIN APP SETTING LAUNCHER -->
      <setting></setting>
      <!-- END APP SETTING LAUNCHER -->

      <div class="main-container text-black dark:text-white-dark min-h-screen" :class="[store.navbar]">
          <!--  BEGIN SIDEBAR  -->
          <sidebar></sidebar>
          <!--  END SIDEBAR  -->

          <!--  BEGIN CONTENT AREA  -->
          <div class="main-content">
              <!--  BEGIN NAVBAR  -->
              <header></header>
              <!--  END NAVBAR  -->

              <div class="p-6 animation">
                  <!--  BEGIN PAGE CONTENT  -->
                  <router-outlet></router-outlet>
                  <!--  END PAGE CONTENT  -->

                  <!-- BEGIN FOOTER -->
                  <footer></footer>
                  <!-- END FOOTER -->
              </div>
          </div>
          <!--  END CONTENT AREA  -->
      </div>
  </div>
  <!--  END MAIN CONTAINER  -->

Admin JS Code Structure

This section will give you a brief description of our admin template JS code.

1. app.service.ts : This is primary js file. It is necessary for the layout to work. It contains the code as follows :-

  • Set default layout
  • Set Navigation Position
  • Set Navbar Type
  • Set Router Animation
  • Theme change funtionality
  • Direction change funtionality
  import { Injectable } from '@angular/core';
  import { Store } from '@ngrx/store';
  import { $themeConfig } from '../theme.config';
  import { TranslateService } from '@ngx-translate/core';

  @Injectable()
  export class AppService {
      storeData: any;
      constructor(public translate: TranslateService, public store: Store<any>) {
          this.initStoreData();
      }

      initStoreData() {
          this.store
              .select((d: any) => d.index)
              .subscribe((d: any) => {
                  this.storeData = d;
              });

          // set default styles
          let val: any = localStorage.getItem('theme'); // light, dark, system
          val = val || $themeConfig.theme;
          this.store.dispatch({ type: 'toggleTheme', payload: val });

          val = localStorage.getItem('menu'); // vertical, collapsible-vertical, horizontal
          val = val || $themeConfig.menu;
          this.store.dispatch({ type: 'toggleMenu', payload: val });

          val = localStorage.getItem('layout'); // full, boxed-layout
          val = val || $themeConfig.layout;
          this.store.dispatch({ type: 'toggleLayout', payload: val });

          val = localStorage.getItem('i18n_locale'); // en, da, de, el, es, fr, hu, it, ja, pl, pt, ru, sv, tr, zh
          val = val || $themeConfig.locale;

          const list = this.storeData.languageList;
          const item = list.find((item: any) => item.code === val);
          if (item) {
              this.toggleLanguage(item);
          }

          val = localStorage.getItem('rtlClass'); // rtl, ltr
          val = val || $themeConfig.rtlClass;
          this.store.dispatch({ type: 'toggleRTL', payload: val });

          val = localStorage.getItem('animation'); // animate__fadeIn, animate__fadeInDown, animate__fadeInUp, animate__fadeInLeft, animate__fadeInRight, animate__slideInDown, animate__slideInLeft, animate__slideInRight, animate__zoomIn
          val = val || $themeConfig.animation;
          this.store.dispatch({ type: 'toggleAnimation', payload: val });

          val = localStorage.getItem('navbar'); // navbar-sticky, navbar-floating, navbar-static
          val = val || $themeConfig.navbar;
          this.store.dispatch({ type: 'toggleNavbar', payload: val });

          val = localStorage.getItem('semidark');
          val = val === 'true' ? true : $themeConfig.semidark;
          this.store.dispatch({ type: 'toggleSemidark', payload: val });
      }

      toggleLanguage(item: any) {
          let lang: any = null;
          lang = 'en';
          if (item) {
              lang = item;
          } else {
              let code = this.translate.currentLang || null;
              if (!code) {
                  code = localStorage.getItem('i18n_locale');
              }

              item = this.storeData.languageList.find((d: any) => d.code === code);
              if (item) {
                  lang = item;
              }
          }

          if (!lang) {
              lang = this.storeData.languageList.find((d: any) => d.code === 'en');
          }

          this.translate.use(lang.code); // set language
          this.store.dispatch({ type: 'toggleLocale', payload: lang.code });
          return lang;
      }

      changeAnimation(type = 'add') {
          if (this.storeData.animation) {
              const ele: any = document.querySelector('.animation');
              if (type === 'add') {
                  ele?.classList.add('animate__animated');
                  ele?.classList.add(this.storeData.animation);
              } else {
                  ele?.classList.remove('animate__animated');
                  ele?.classList.remove(this.storeData.animation);
              }
          }
      }
  }

2. theme.config.ts : This is theme configuration js file. This file contains optional setting for set defaut layout, theme and language functionality. It contains the code as follows :-

  • Language
  • Theme
  • Navigation
  • Layout
  • Direction
  • Animation
  • Navbar
  • Semidark
  // APP CONFIG
  export const $themeConfig = {
      locale: 'en', // en, da, de, el, es, fr, hu, it, ja, pl, pt, ru, sv, tr, zh
      theme: 'light', // light, dark, system
      menu: 'vertical', // vertical, collapsible-vertical, horizontal
      layout: 'full', // full, boxed-layout
      rtlClass: 'ltr', // rtl, ltr
      animation: '', // animate__fadeIn, animate__fadeInDown, animate__fadeInUp, animate__fadeInLeft, animate__fadeInRight, animate__slideInDown, animate__slideInLeft, animate__slideInRight, animate__zoomIn
      navbar: 'navbar-sticky', // navbar-sticky, navbar-floating, navbar-static
      semidark: false,
  };