Skip to content

Commit

Permalink
Reorganization and fixing syntax to fit Angular Standard
Browse files Browse the repository at this point in the history
  • Loading branch information
IhoFenixMFS committed Apr 14, 2020
1 parent 4e29867 commit 16ce71e
Show file tree
Hide file tree
Showing 81 changed files with 122 additions and 86 deletions.
20 changes: 10 additions & 10 deletions AngularAnimalShelter/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { HomeComponent } from './home/home.component';
import { AnimalsComponent } from './animals/animals.component';
import { StatisticsComponent } from './statistics/statistics.component';
import { RequestsComponent } from './requests/requests.component';
import { AnimalformComponent } from './animalform/animalform.component';
import { ContactComponent } from './contact/contact.component';
import { ProfileComponent } from './profile/profile.component';
import { UserformComponent } from './userform/userform.component';
import { ShelterformComponent } from './shelterform/shelterform.component';
import { AnimalviewComponent } from './animalview/animalview.component';
import { HomeComponent } from './components/home/home.component';
import { AnimalsComponent } from './components/animals/animals.component';
import { StatisticsComponent } from './components/statistics/statistics.component';
import { RequestsComponent } from './components/requests/requests.component';
import { AnimalformComponent } from './components/animalform/animalform.component';
import { ContactComponent } from './components/contact/contact.component';
import { ProfileComponent } from './components/profile/profile.component';
import { UserformComponent } from './components/userform/userform.component';
import { ShelterformComponent } from './components/shelterform/shelterform.component';
import { AnimalviewComponent } from './components/animalview/animalview.component';


const routes: Routes = [
Expand Down
45 changes: 28 additions & 17 deletions AngularAnimalShelter/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { FormsModule } from '@angular/forms';
import { ReactiveFormsModule } from '@angular/forms';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HeaderComponent } from './header/header.component';
import { FooterComponent } from './footer/footer.component';
import { HomeComponent } from './home/home.component';
import { AnimalsComponent } from './animals/animals.component';
import { StatisticsComponent } from './statistics/statistics.component';
import { RequestsComponent } from './requests/requests.component';
import { AnimalformComponent } from './animalform/animalform.component';
import { ProfileComponent } from './profile/profile.component';
import { ContactComponent } from './contact/contact.component';
import { UserformComponent } from './userform/userform.component';
import { ShelterformComponent } from './shelterform/shelterform.component';
import { ShelterFormService } from './shelterform/shelter-form.service';
import { AnimalviewComponent } from './animalview/animalview.component';
import { UserformService } from './userform/userform.service';
import { LoginService } from './auth/login.service';
import { HeaderComponent } from './components/header/header.component';
import { FooterComponent } from './components/footer/footer.component';
import { HomeComponent } from './components/home/home.component';
import { AnimalsComponent } from './components/animals/animals.component';
import { StatisticsComponent } from './components/statistics/statistics.component';
import { RequestsComponent } from './components/requests/requests.component';
import { AnimalformComponent } from './components/animalform/animalform.component';
import { ProfileComponent } from './components/profile/profile.component';
import { ContactComponent } from './components/contact/contact.component';
import { UserformComponent } from './components/userform/userform.component';
import { ShelterformComponent } from './components/shelterform/shelterform.component';
import { AnimalviewComponent } from './components/animalview/animalview.component';

import { LocationStrategy, HashLocationStrategy } from '@angular/common';
import { BasicAuthInterceptor } from './auth/auth.interceptor';
import { ErrorInterceptor } from './auth/error.interceptor';
import { ChartsModule } from 'ng2-charts';

import { LoginService } from './auth/login.service';
import { UserformService } from './services/userform/userform.service';
import { AnimalformService } from './services/animalform/animalform.service';
import { ShelterformService } from './services/shelterform/shelterform.service';
import { AnimalsService } from './services/animals/animals.service';
import { ProfileService } from './services/profile/profile.service';
import { StatisticsService } from './services/statistics/statistics.service';

@NgModule({
declarations: [
AppComponent,
Expand All @@ -52,9 +59,13 @@ import { ChartsModule } from 'ng2-charts';
ChartsModule
],
providers: [
ShelterFormService,
ShelterformService,
UserformService,
LoginService,
AnimalformService,
AnimalsService,
ProfileService,
StatisticsService,
{ provide: HTTP_INTERCEPTORS, useClass: BasicAuthInterceptor, multi: true },
{ provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true },
{ provide: LocationStrategy, useClass: HashLocationStrategy }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { Animal } from '../models/Animal/animal.model';
import { AnimalformService} from './animalform.service';
import { Animal } from '../../models/Animal/animal.model';
import { AnimalformService} from '../../services/animalform/animalform.service';
import { Router } from '@angular/router';


Expand All @@ -12,12 +12,13 @@ import { Router } from '@angular/router';
export class AnimalformComponent {
data: FormData;
animal: Animal;
alert:boolean;
file:any;
alert:boolean;
alertText:string;

constructor(private router: Router, private animalFormService: AnimalformService) {
this.data = new FormData;
this.animal={
this.animal = {
animalName:'',
animalAge:null,
animalType:'',
Expand All @@ -34,6 +35,7 @@ export class AnimalformComponent {

createAnimal(){
if((this.animal.animalName=='') || (this.animal.animalAge == null) || (this.animal.animalType =='') || (this.animal.animalSize =='') || (this.animal.animalDescription =='')){
this.alertText='All fields must be Completed';
this.alert=true;
}else {
this.alert=false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { Animal } from '../models/Animal/animal.model';
import { ServiceService } from './service.service';
import { AnimalsService } from '../../services/animals/animals.service';
import { environment } from 'src/environments/environment';

@Component({
Expand All @@ -21,7 +20,7 @@ export class AnimalsComponent implements OnInit {
user: any
suitedbuttonVisible:boolean;

constructor(private dataService: ServiceService) {
constructor(private dataService: AnimalsService) {
this.animal = Array();
this.loading = false;
this.isbuttonvisible= false;
Expand All @@ -43,7 +42,6 @@ export class AnimalsComponent implements OnInit {
}

increment() {

this.page = this.page + 1;
console.log(this.page);
this.searchByType();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { LoginService } from '../auth/login.service';
import { WebUser } from '../models/WebUser/webUser.model';
import { Shelter } from '../models/Shelter/shelter.model';
import { LoginService } from '../../auth/login.service';
import { WebUser } from '../../models/WebUser/webUser.model';
import { Shelter } from '../../models/Shelter/shelter.model';
import { Router } from '@angular/router';

@Component({
Expand All @@ -20,7 +20,7 @@ export class HeaderComponent implements OnInit {
logIn(email: string, pass: string) {

if(email.length == 0 || pass.length == 0){
alert('Invalid user or password');
alert('Invalid username or password');
return
}

Expand All @@ -29,7 +29,7 @@ export class HeaderComponent implements OnInit {
console.log(user);
this.router.navigate(['/']);
},
error => alert('Invalid user or password')
error => alert('Invalid username or password')
);

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@

<!-- start banner Area -->



<section class="banner-area relative" id="home">
<div class="container">
<div class="overlay overlay-bg"></div>
<div
class="row fullscreen d-flex align-items-center justify-content-start">
<div class="banner-content col-lg-8 col-md-12">
<h1 class="text-uppercase">
Adopt animal ,earn Happiness. <br>
Adopt an animal, earn Happiness. <br>
</h1>
<p class="text-white sub-head">So Dont Wait ! Your next step can
change the life of an animal.</p>
Expand All @@ -24,20 +21,24 @@ <h1 class="text-uppercase">


<!-- Start image-carusel Area -->

<section class="image-carusel-area">
<div class="container">
<div class="row">
<div class="active-image-carusel">
<div class="single-image-carusel">
<img class="img-fluid" src="" alt="">
<img class="img-fluid" src="assets/img/c2.jpg" alt="">
</div>
</div>
</div>
</div>
</section>

<!-- End image-carusel Area -->


<!-- Start process Area -->

<section class="process-area section-gap">
<div class="container">
<div class="row d-flex justify-content-center">
Expand Down Expand Up @@ -79,9 +80,12 @@ <h4>Bring To New Home</h4>
</div>
</div>
</section>

<!-- End process Area -->


<!-- Start video Area -->

<section class="video-area section-gap">
<div class="container">
<div class="row justify-content-center align-items-center">
Expand All @@ -94,14 +98,10 @@ <h4>Bring To New Home</h4>
</div>
<div class="description">
<h4>Watch this video how they live here</h4>

</div>
</div>
</div>
</div>
</section>
<!-- End video Area -->




<!-- End video Area -->
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit, ElementRef, ViewChild } from '@angular/core';
import { ServiceService } from './service.service';
import { ProfileService } from '../../services/profile/profile.service';
import { Router } from '@angular/router';
import { NgForm } from '@angular/forms';
import { environment } from 'src/environments/environment';
Expand All @@ -25,7 +25,7 @@ export class ProfileComponent {
isbuttonvisible:boolean;


constructor(private service: ServiceService, private router: Router) {
constructor(private service: ProfileService, private router: Router) {
this.user = JSON.parse(localStorage.getItem('currentUser'));
this.data = new FormData;
this.gallery = Array();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ <h1 class="mb-20">Shelter data:</h1>
class="form-control" placeholder="Password" name="shelterPassword"
required>
</div>
<div *ngIf="alert" class="alert alert-danger">
{{alertText}}
<div *ngIf="alert" class="alert">

{{alertText}}

</div>
<button (click)="createShelter(); $event.stopPropagation(); $event.preventDefault()" type="submit" class="genric-btn primary circle">Create Shelter</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { ShelterFormService } from './shelter-form.service';
import { Component, OnInit } from '@angular/core';
import { Shelter } from '../../models/Shelter/shelter.model';
import { ShelterformService } from '../../services/shelterform/shelterform.service';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { Shelter } from '../models/Shelter/shelter.model';
import { Router } from '@angular/router';

@Component({
selector: 'app-shelterform',
Expand All @@ -11,11 +11,14 @@ import { Shelter } from '../models/Shelter/shelter.model';
})
export class ShelterformComponent {

data: FormData;
shelter: Shelter;
alert:boolean;
alertText:string;

constructor(private router: Router, private shelterFormService: ShelterFormService) {
constructor(private router: Router, private shelterformService: ShelterformService) {
this.data = new FormData;

this.shelter = {
shelterName: '',
shelterNif: '',
Expand All @@ -32,6 +35,7 @@ export class ShelterformComponent {
if(this.shelter.shelterName.length == 0 || this.shelter.shelterNif.length == 0
|| this.shelter.shelterEmail.length == 0 || this.shelter.shelterDescription.length == 0
|| this.shelter.shelterAdress.length == 0 || this.shelter.shelterPassword.length == 0){

this.alertText='All fields must be Completed';
this.alert=true;

Expand All @@ -42,7 +46,7 @@ export class ShelterformComponent {
formData.append('jsondata',JSON.stringify(this.shelter));
formData.append('password',this.shelter.shelterPassword);

this.shelterFormService.createShelter(formData).subscribe(
this.shelterformService.createShelter(this.data).subscribe(
shelter => {
if(shelter){
this.router.navigate(['/']);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';

import { StatisticsService } from './statistics.service';
import { StatisticsService } from '../../services/statistics/statistics.service';
import { ChartOptions, ChartType, ChartDataSets } from 'chart.js';

import { Label } from 'ng2-charts';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,11 @@ <h1 class="mb-20">User data:</h1>
required>
</div>
<div *ngIf="alert" class="alert alert-danger">
All fields must be Completed
</div>
{{alertText}}
</div>
<div *ngIf="correct" class="alert alert-success">
{{alertText}}
</div>
<button (click)="createWebUser()" type="submit" class="genric-btn primary circle">Create
User</button>
</form>
Expand Down
Loading

0 comments on commit 16ce71e

Please sign in to comment.