added login form
This commit is contained in:
BIN
public/icon.png
BIN
public/icon.png
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB |
0
src/app/components/login/login.css
Normal file
0
src/app/components/login/login.css
Normal file
23
src/app/components/login/login.html
Normal file
23
src/app/components/login/login.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<form nz-form nzLayout="horizontal" [formGroup]="loginForm" (ngSubmit)="submitForm()">
|
||||
<nz-form-item>
|
||||
<nz-form-label nzSpan="8" nzRequired>
|
||||
Identifiant
|
||||
</nz-form-label>
|
||||
|
||||
<nz-form-control nzSpan="40" nzErrorTip="Ce champ est requis">
|
||||
<input nz-input placeholder="Saisir votre identifiant" formControlName="name">
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
|
||||
<nz-form-item>
|
||||
<nz-form-label nzSpan="8" nzRequired>
|
||||
Mot de passe
|
||||
</nz-form-label>
|
||||
|
||||
<nz-form-control nzSpan="40" nzErrorTip="Ce champ est requis">
|
||||
<input nz-input type="password" placeholder="Mot de passe" formControlName="password">
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
|
||||
<button class="ml-26 mt-4" nz-button [nzType]="'primary'" (click)="submitForm()">Connexion</button>
|
||||
</form>
|
||||
39
src/app/components/login/login.ts
Normal file
39
src/app/components/login/login.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { Component } from '@angular/core';
|
||||
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from "@angular/forms";
|
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid";
|
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
||||
import {NzInputDirective} from "ng-zorro-antd/input";
|
||||
import {NzButtonComponent} from "ng-zorro-antd/button";
|
||||
|
||||
@Component({
|
||||
selector: 'app-login',
|
||||
imports: [
|
||||
NzColDirective,
|
||||
NzFormControlComponent,
|
||||
NzFormDirective,
|
||||
NzFormItemComponent,
|
||||
NzFormLabelComponent,
|
||||
NzInputDirective,
|
||||
NzRowDirective,
|
||||
ReactiveFormsModule,
|
||||
NzButtonComponent
|
||||
],
|
||||
templateUrl: './login.html',
|
||||
styleUrl: './login.css',
|
||||
})
|
||||
export class Login {
|
||||
loginForm = new FormGroup({
|
||||
name: new FormControl<string>(null, [Validators.required]),
|
||||
password: new FormControl<string>(null, [Validators.required]),
|
||||
})
|
||||
|
||||
submitForm() {
|
||||
// Pour annuler si le formulaire est invalide
|
||||
if (this.loginForm.invalid) return;
|
||||
|
||||
// Pour obtenir la valeur du formulaire
|
||||
console.log(this.loginForm.getRawValue())
|
||||
|
||||
// Pour vider le formulaire
|
||||
this.loginForm.reset()
|
||||
}}
|
||||
@@ -4,9 +4,7 @@ import {Modal} from "../modal/modal";
|
||||
import {DatePipe} from "@angular/common";
|
||||
import {NzButtonComponent} from "ng-zorro-antd/button";
|
||||
import {UserInfo} from "../../interfaces/user.interfaces";
|
||||
import {LoanTable} from "../loan-table/loan-table";
|
||||
import {UpdateUser} from "../update-user/update-user";
|
||||
import {UpdateLoan} from "../update-loan/update-loan";
|
||||
|
||||
@Component({
|
||||
selector: 'app-user-table',
|
||||
@@ -15,9 +13,7 @@ import {UpdateLoan} from "../update-loan/update-loan";
|
||||
Modal,
|
||||
NzButtonComponent,
|
||||
NzTableComponent,
|
||||
LoanTable,
|
||||
UpdateUser,
|
||||
UpdateLoan
|
||||
],
|
||||
templateUrl: './user-table.html',
|
||||
styleUrl: './user-table.css',
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
<p>welcome works!</p>
|
||||
|
||||
<h1 class="text-3xl font-bold underline">
|
||||
Hello world!
|
||||
</h1>
|
||||
<div class="w-90 p-5 rounded-2xl shadow-lg shadow-gray-400 m-auto">
|
||||
<app-login></app-login>
|
||||
</div>
|
||||
@@ -1,9 +1,12 @@
|
||||
import { Component } from '@angular/core';
|
||||
import {CreateBook} from "../../components/create-book/create-book";
|
||||
import {Login} from "../../components/login/login";
|
||||
|
||||
@Component({
|
||||
selector: 'app-welcome',
|
||||
imports: [],
|
||||
imports: [
|
||||
Login
|
||||
],
|
||||
templateUrl: './welcome.html',
|
||||
styleUrl: './welcome.css'
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user