ajout couleur

This commit is contained in:
AlineRinquin 2022-02-15 15:37:22 +01:00
parent 98374d8a47
commit a881b6cee6
7 changed files with 98 additions and 36 deletions

View File

@ -1,5 +1,6 @@
export interface Contact { export interface Contact {
id: string; id: string;
couleur: string;
nom: string; nom: string;
prenom: string; prenom: string;
telephone: string; telephone: string;

View File

@ -3,10 +3,14 @@
<app-side-bar></app-side-bar> <app-side-bar></app-side-bar>
</div> </div>
<div class="ajoutContact-form text-center"> <div class="ajoutContact-form text-center">
<h1>Ajouter un contact</h1>
<main class="form-ajoutContact"> <main class="form-ajoutContact">
<form (ngSubmit)="onSubmit()" [formGroup]="ajoutContactForm"> <form (ngSubmit)="onSubmit()" [formGroup]="ajoutContactForm">
<h1>Ajouter un contact</h1>
<div class="form-floating">
<input type="color" class="form-control" id="floatingInputcouleur" placeholder="" name="couleur"
formControlName="couleurFc">
</div>
<div class="form-floating"> <div class="form-floating">
<input type="text" <input type="text"

View File

@ -1,14 +1,20 @@
.login-form { .login-form {
height: 100vh; height: 100vh;
padding-top: 40px; padding-top: 40px;
background-color: #f5f5f5; background-color: #e286d3;
} }
.form-ajoutContact { .form-ajoutContact {
width: 100%; width: 100%;
max-width: 330px; max-width: 330px;
padding: 15px; padding: 15px;
margin: auto; margin-top: 50px;
margin-left: auto;
margin-right: auto;
border: solid 1px;
border-radius: 10px;
background-color: #fcddec;
border-color: #81164d;
} }
.form-ajoutContact .checkbox { .form-ajoutContact .checkbox {
@ -20,12 +26,45 @@
} }
.form-ajoutContact input[type="email"] { .form-ajoutContact input[type="email"] {
margin-bottom: -1px; margin-bottom: 10px;
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
} }
.form-ajoutContact input[type="color"] {
border: none;
margin-bottom: 10px;
margin-top: -70px;
margin-left: 100px;
border-radius: 50%;
width: 100px;
height: 100px;
}
.form-ajoutContact input[type="color"]::-webkit-color-swatch {
border: none;
margin-top: -15px;
border-radius: 80%;
width: 80px;
height: 80px;
}
.form-ajoutContact input[type="text"] {
margin-bottom: 10px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-ajoutContact input[type="date"] {
margin-bottom: 10px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.btn-secondary { .btn-secondary {
color: #fff; margin-top: 10px;
background-color: #ffff;
color: rgb(255, 255, 255);
background-color: #5a1e63 !important; background-color: #5a1e63 !important;
} }

View File

@ -42,8 +42,7 @@ export class PageAjoutContactComponent implements OnInit {
} }
public onSubmit(): void { public onSubmit(): void {
console.log('value : ', this.ajoutContactForm.value); const couleurValue = this.ajoutContactForm.value['couleurFc'];
console.log('form : ', this.ajoutContactForm);
const firstNameValue = this.ajoutContactForm.value['firstNameFc']; const firstNameValue = this.ajoutContactForm.value['firstNameFc'];
const lastNameValue = this.ajoutContactForm.value['lastNameFc']; const lastNameValue = this.ajoutContactForm.value['lastNameFc'];
const telephoneValue = this.ajoutContactForm.value['telephoneFc']; const telephoneValue = this.ajoutContactForm.value['telephoneFc'];
@ -53,6 +52,7 @@ export class PageAjoutContactComponent implements OnInit {
const contact: Contact = { const contact: Contact = {
id: '', id: '',
couleur: couleurValue,
nom: lastNameValue, nom: lastNameValue,
prenom: firstNameValue, prenom: firstNameValue,
telephone: telephoneValue, telephone: telephoneValue,

View File

@ -71,8 +71,7 @@ export class PageModifierContactComponent implements OnInit {
//Méthode qui envoie les champs modifiés pour mise à jour //Méthode qui envoie les champs modifiés pour mise à jour
public onSubmit(): void { public onSubmit(): void {
console.log('value : ', this.modifContactForm.value); const couleurValue = this.modifContactForm.value['couleurFc'];
console.log('form : ', this.modifContactForm);
const firstNameValue = this.modifContactForm.value['firstNameFc']; const firstNameValue = this.modifContactForm.value['firstNameFc'];
const lastNameValue = this.modifContactForm.value['lastNameFc']; const lastNameValue = this.modifContactForm.value['lastNameFc'];
const telephoneValue = this.modifContactForm.value['telephoneFc']; const telephoneValue = this.modifContactForm.value['telephoneFc'];
@ -82,6 +81,7 @@ export class PageModifierContactComponent implements OnInit {
const contact: Contact = { const contact: Contact = {
id: this.personneid, id: this.personneid,
couleur: couleurValue,
nom: lastNameValue, nom: lastNameValue,
prenom: firstNameValue, prenom: firstNameValue,
telephone: telephoneValue, telephone: telephoneValue,

View File

@ -1,31 +1,42 @@
<app-header></app-header> <app-header></app-header>
<div class="row">
<div class="col-md-auto">
<app-side-bar></app-side-bar> <app-side-bar></app-side-bar>
</div>
<div class=" col compte text-center">
<div> <div>
<button class="w-100 btn btn-lg btn-secondary " <button class="w-100 btn btn-lg btn-secondary " type="submit">Tous les contacts
type="submit">Tous les contacts
</button> </button>
<button routerLink="/ajouter-contact" class="w-100 btn btn-lg btn-rounded btn-secondary"> <button routerLink="/ajouter-contact" class="w-100 btn btn-lg btn-rounded btn-secondary">
Ajouter un contact Ajouter un contact
</button> </button>
<div class="input-group mb-3"> <div class="input-group mb-3 d-flex justify-content-center">
<input type="text" class="form-control" <input type="text" class="form-control" placeholder="Rechercher un contact"
placeholder="Rechercher un contact" aria-label="Rechercher un contact" aria-describedby="basic-addon2" #word
aria-label="Rechercher un contact"
aria-describedby="basic-addon2"
#word
(keyup)="onSearchChange(word.value)"> (keyup)="onSearchChange(word.value)">
<div class="input-group-append"> <div class="input-group-append"></div>
</div> </div>
<div>
<h4>Liste des Contacts</h4>
</div> </div>
<div class="row justify-content-evenly">
<div class="col-4">
<div *ngFor="let personne of listContact" (click)="onClick(personne)"> <div *ngFor="let personne of listContact" (click)="onClick(personne)">
<img style="max-height: 12% ; max-width: 12%" src="../../../assets/images/contact-1.png" /> <img style="max-height: 12% ; max-width: 12%" src="../../../assets/images/contact-1.png" />
<p class="fiche-contact">{{ personne.prenom }} {{ personne.nom }}</p> <p class="fiche-contact">{{ personne.prenom }} {{ personne.nom }}</p>
</div> </div>
<div *ngIf="openDetails"><app-fiche-contact [personne]="openDetails" (clickDelete)="onClickDelete($event)"></app-fiche-contact></div> </div>
<div class="col-4" *ngIf="openDetails">
<app-fiche-contact [personne]="openDetails" (clickDelete)="onClickDelete($event)"></app-fiche-contact>
</div>
</div>
</div> </div>
</div>
</div>

View File

@ -7,9 +7,16 @@
margin: auto; margin: auto;
} }
.input-group mb-3 { .input-group.mb-3 {
width: 100%; width: 50%;
max-width: 330px; max-width: 330px;
padding: 15px; padding: 15px;
margin: auto; margin: auto;
display: flex;
flex-direction: row;
}
;h4 {
color: black;
font-weight: bold;
} }