Code Monkey home page Code Monkey logo

mogrady-professional / client-panel-angular Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 483 KB

Client Panel application is a built on Boostrap 4 using Angular 13 with a firebase backend. It is used as a client management application and allows users to register, login and log client details and project information to help keep track of project billing. Once logged in, a registered user can add, edit, and delete clients. The application also allows a to update client profile information and balance owed.

JavaScript 3.17% TypeScript 60.43% HTML 36.23% CSS 0.18%
angular typescript

client-panel-angular's Introduction

Client Panel Angular 13

Table of Contents

Introduction

Client Panel application is a built on Boostrap 4 using Angular 13 with a firebase backend. It is used as a client management application and allows users to register, login and log client details and project information to help keep track of project billing.

Once logged in, a registered user can add, edit, and delete clients. The application also allows a to update client profile information and balance owed.

Functionality

  • Enable/Disable Register functionality
  • Log Client and Project Details
  • Register and Login
  • Edit Client Details and Balance
  • Firebase storage
  • Firebase authentication with username & password

Features

  • Custom Auth Guard used
  • Services
    • Settings Service
    • Auth Service
    • Client Service
  • Models
    • Clients
    • Settings
  • Firebase Deployment

Project Images

Dashboard

Details

Edit Details

Login

New

Register

Settings

Tech

Firebase Firestore

Project Setup

Google Firebase

  • Created Firestore Database
  • Created collection with two entries. Collection clients
  • Firebase credentials are stored in environment.ts file (not included in repo)
{
  "balance": 50,
  "email": "[email protected]",
  "firstName": "Karen",
  "lastName": "Williams",
  "phone": 0872224444
},
{
    "balance": 100,
    "email": "[email protected]",
    "firstName": "John",
    "lastName": "Doe",
    "phone": 0872223334
}
  • Authentication
    • Email and Password
    • Create initial user
{
  "email": "[email protected]",
  "password": "password_goes_here"
}

Fireebase/firestore now set up

Getting Started - Setting up the Angular Application

  • Generate new project ng new clientpanel
  • Install Dependencies
  • Open package.json
    • Remove Caret symbol ^ from the following dependencies, that way we are using the exact version of the package
      • bootstrap
  • Add the following to angular.json under styles and scripts
"styles": [
  "node_modules/bootstrap/dist/css/bootstrap.min.css",
  "node_modules/font-awesome/css/font-awesome.min.css",
  "src/styles.css"
],
"scripts": [
  "node_modules/jquery/dist/jquery.min.js",
  "node_modules/popper.js/dist/umd/popper.min.js",
  "node_modules/bootstrap/dist/js/bootstrap.min.js"
]

Building the Components

  • ng g c components/navbar --skipTests=true --module=app.module.ts
  • ng g c components/clients --skipTests=true --module=app.module.ts
  • ng g c components/sidebar --skipTests=true --module=app.module.ts
  • ng g c components/add-client --skipTests=true --module=app.module.ts
  • ng g c components/edit-client --skipTests=true --module=app.module.ts
  • ng g c components/client-details --skipTests=true --module=app.module.ts
  • ng g c components/login --skipTests=true --module=app.module.ts
  • ng g c components/register --skipTests=true --module=app.module.ts
  • ng g c components/dashboard --skipTests=true --module=app.module.ts
  • ng g c components/settings --skipTests=true --module=app.module.ts
  • ng g c components/not-found --skipTests=true --module=app.module.ts

Include the Components in the App

  • In app.component.html add the following
<app-navbar></app-navbar>
  • In navbar.component.html add the navbar from bootstrap.

Create a new Module of Router

ng g m app-routing --flat --module=app.module.ts

Bring in all modules you want to add to the route app-routing.module.ts

import { NgModule } from "@angular/core";
import { RouterModule, Routes } from "@angular/router";
import { DashboardComponent } from "./components/dashboard/dashboard.component";
import { LoginComponent } from "./components/login/login.component";
import { RegisterComponent } from "./components/register/register.component";
import { AddClientComponent } from "./components/add-client/add-client.component";
import { EditClientComponent } from "./components/edit-client/edit-client.component";
import { ClientDetailsComponent } from "./components/client-details/client-details.component";
import { SettingsComponent } from "./components/settings/settings.component";
import { NotFoundComponent } from "./components/not-found/not-found.component";

// Create Routes
const routes: Routes = [
  { path: "", component: DashboardComponent },
  { path: "login", component: LoginComponent },
  { path: "register", component: RegisterComponent },
  { path: "client/add", component: AddClientComponent },
  { path: "client/edit/:id", component: EditClientComponent },
  { path: "client/:id", component: ClientDetailsComponent },
  { path: "settings", component: SettingsComponent },
  { path: "**", component: NotFoundComponent },
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule],
})
export class AppRoutingModule {}
  • Bring in the links in the navbar
<nav class="navbar navbar-expand-md navbar-dark bg-primary mb-4">
  <div class="container">
    <a routerLink="/" class="navbar-brand">Client Panel</a>
    <button
      class="navbar-toggler"
      type="button"
      data-toggle="collapse"
      data-target="#navbarMain"
    >
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarMain">
      <ul class="navbar-nav mr-auto">
        <li class="nav-item">
          <a routerLink="/" class="nav-link">Dashboard</a>
        </li>
      </ul>

      <ul class="navbar-nav ml-auto">
        <li class="nav-item">
          <a routerLink="/register" class="nav-link">Register</a>
        </li>
        <li class="nav-item">
          <a routerLink="/login" class="nav-link">Login</a>
        </li>
      </ul>
    </div>
  </div>
</nav>
  • Bring in router-outlet in the app.component.html
<app-navbar></app-navbar>
<div class="container">
  <router-outlet></router-outlet>
</div>

Routing Module Setup Complete

Installing Firebase

  • npm i firebase angularfire2
  • From within google console, create a new project and get the config object and add it to the environment.ts file
  • Also add the code to the environment.prod.ts file

Normally you have a seperate project for development and production.

export const environment = {
  production: false,
  firebase: {
    apiKey: " ",
    authDomain: " ",
    projectId: " ",
    storageBucket: " ",
    messagingSenderId: " ",
    appId: "",
  },
};
  • Import the environment object from src/environments/environment into the app.module.ts file and the following below to get started
import { AngularFireModule } from "@angular/fire/compat";
import { AngularFireAuth } from "@angular/fire/compat/auth";
  • Running into issues with packages for firebase

Create model

  • Create file called Clients.ts inside folder called models in the src/app folder
export interface Client {
  id?: string;
  firstName?: string;
  lastName?: string;
  email?: string;
  phone?: string;
  balance?: number;
}

client-panel-angular's People

Contributors

mogrady-professional avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.