Giter VIP home page Giter VIP logo

tours-projet2-nous's Introduction

ToursProjet2Nous

This project was generated with Angular CLI version 7.0.4.

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.

tours-projet2-nous's People

Contributors

cyprienderoef avatar gordian05 avatar martialblot avatar maxdhn avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

cyprienderoef

tours-projet2-nous's Issues

ListEstablishmentComponent

  • Supprimer public listEstablishment;
  • Renommer listEstablishment en establishments et typé correctement
  • Supprimer public categorie = this.service.result; et récupérer la catégorie a partir de la route (voir issue #32, #34 )
  • Supprimer la méthode etaDetail non utilisé
  • Factoriser les deux <div class=".container"> en un, en utilisant une fonction .filter en TS ce qui permet de ne plus avoir besoin de estaDefault et estaCategorie
  • Utiliser CardComponent voir issue #50

AuthenticationService

  • Créer une méthode isLogin qui renvoie true (si le token existe) ou false (si le token n'existe pas).
  • Utiliser la methode isLogin dans HeaderComponent (voir issue #35) et dans AuthGuard (voir issue #45)

ProfileComponent

  • Supprimer public profil: Profile; et utiliser .patchValue directement avec la réponse de l'API.
  • Renommer myForm en profile

CardComponent (duplication de code)

Template HTML de CategorieComponent :

      <div class="card m-4">
        <div class="hovereffect">
          <img class="img-responsive border border-dark col" src="assets/img/{{ categorie }}.jpg" alt="" />
          <div class="overlay">
            <h2 class="font-weight-bolder">{{ categorie }}</h2>
            <a class="info" (click)="categorieRest(categorie)" routerLink="profiles/establishments">Show restaurants</a>
          </div>
        </div>

Template HTML de ListEstablishmentComponent :

      <div class="card m-4">
        <div class="hovereffect">
          <img class="img-responsive border border-dark col" src="{{ establishment.medias[0]?.url }}" />

          <div class="overlay">
            <h2 class="font-weight-bolder">{{ establishment.name }}</h2>
            <a class="info btn btn-danger" [routerLink]="['/establishments/details', establishment._id]">See
              restaurant</a>
          </div>
        </div>
      </div>

Le code HMLT est très similaire donc création d'un component !!
Créer un component CardComponent qui mutualise les templates ci dessus.
Ajouter un @Input pour l'url de l'image, un @Input pour le nom, un @Input pour l'id de l’établissement. BONUS utiliser <ng-content> pour le contenu de <h2>.
Utiliser ce component dans ListEstablishmentComponent et CategorieComponent

ProfilemessageComponent

  • Supprimer public messageForm: Message; et utiliser .patchValue directement avec la réponse de l'API.
  • Renommer myForm en message
  • Supprimer les propriétés id: string; et messageService: Message;

console.log et code mort

Pensez a supprimer les console.log, le code mort (si il y en a), les variables, propriétés inutilisé ainsi que les imports et services injecté inutilisé

ListBooking

  • Un peu longue la ligne html de 370 caractères...
  • Supprimer public listBooking;
  • Renommer public tableLists = []; en bookings et typé correctement

LoginComponent

  • Supprimer la propriété loading = false
  • Supprimer la propriété returnUrl
    A la place de
this.submitted = true;
    if (this.loginForm.invalid) {
      return;
    }

Vous devriez utilisé la variable de template de ngForm https://angular.io/api/forms/NgForm#template-variable-references ce qui vous permet d'accéder à l'état de votre formulaire directement depuis le html :

<form #f="ngForm" (ngSubmit)="f.valid && onSubmit()" [formGroup]='loginForm'>
  • Utiliser 'this.router.navigate(['']);' au lieu de 'this.router.navigate(['#']);'

EstablishmentService

  • Supprimer public id; et public result;
  • Supprimer la méthode getEstablishmentBySort(), les valeurs doivent être passé en paramètre des routes.

DetailListEstablischmentComponent

  • Supprimer config: NgbCarouselConfig si vous ne l'utilisez pas
  • Si un restaurant n'a pas d'horaire renseigné l'erreur _co.time.open is undefined est affichée dans la console. Vous devez tester si le restaurant possède bien des horaires avant de les afficher (ngIf ou le safe navigation operator)

BookingFormComponent

  • Supprimer la propriété bookingForm
  • Renommer la propriété userForm en booking
  • Supprimer la propriété title
  • Supprimer la propriété cacheId
  • NgOnInit : stocker params.get('id') dans la propriété this.id
  • Submit : supprimer le subscribe this.activetedroute.paramMap et utilser this.id dans la condition
  • Il y a une erreur dans la console a l'affichage du formulaire "Cannot find control with name: 'address'". Le FormGroup adress a comme FormGroup parent owner et non userForm vérifié le code HTML.

NavBarComponent

Utiliser la directive routerLink sur <a class="navbar-brand"> au lieu de href pour évité de recharger toute la page

EstablishmentInscriptionComponent

  • ngOnInit : ajouter une propriete this.id et l'utiliser pour stocker l'id récupérer avec params.get('id');
  • onSubmit : supprimer l'appel this.activatedRoute.paramMap.subscribe et utiliser directement la propriete this.id dans la condition
  • Il y a une erreur a l'initialisation du formulaire dans la console "Cannot find control with name: 'message'".
<textarea
          class="form-control"
          formControlName="message"
          placeholder="Describe your establishment"
></textarea>

Il n'y a pas de FormControl message dans le FormGroup this.establishmentForm.

ListMessageComponent

  • Un peu longue la ligne html de 320 caractères...
  • Supprimer public listMessage;
  • Renommer public tableLists = []; en message et type correctement

AuthGuard

Appeler la méthode isLogin au lieu de faire appel au localStorage (voir issue #46)

DetailsProfileComponent

  • Supprimer public listEstablishment; utiliser a la place public establishments: []; et typé la correctement.
  • Supprimer public listMessage; utiliser a la place public messages: []; et typé la correctement.
  • NgOnInit paramètre etam comme le magasin ?

CategorieComponent

  • Supprimer la méthode CategorieRest(), pourquoi Rest ? (voir issue #33 )
  • Passer l'id de la categorie en parametre a la directive routerLink (voir issue #32 )
  • Utiliser CardComponent voir issue #50

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.