amelioration du style globale
This commit is contained in:
parent
cd1f323686
commit
d1ac1b77f0
36 changed files with 191 additions and 112 deletions
|
|
@ -86,10 +86,10 @@
|
|||
</ng-container>
|
||||
|
||||
<!-- Advertiser Column -->
|
||||
<ng-container matColumnDef="advertiser">
|
||||
<ng-container matColumnDef="company">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Annonceur </th>
|
||||
<td mat-cell *matCellDef="let advert">
|
||||
{{advert.advertiser}}
|
||||
{{advert.company}}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
|
|
|
|||
|
|
@ -68,3 +68,7 @@ input {
|
|||
border: solid 1px black !important;
|
||||
background-color: white !important;
|
||||
}
|
||||
|
||||
::ng-deep .mat-pseudo-checkbox-checked {
|
||||
background-color: black !important;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,36 @@ import {ThemeService} from "../../../utils/services/theme/theme.service";
|
|||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||
import {MatTableDataSource} from "@angular/material/table";
|
||||
import {Advert, AdvertWithCountViews} from "../../../utils/interfaces/advert";
|
||||
import {Advert} from "../../../utils/interfaces/advert";
|
||||
import {PopupDeleteAdAdminComponent} from "../popup-delete-ad-admin/popup-delete-ad-admin.component";
|
||||
import {PopupVisualizeImagesAdminComponent} from "../popup-visualize-images-admin/popup-visualize-images-admin.component";
|
||||
import {FictitiousAdvertsService} from "../../../utils/services/fictitiousDatas/fictitiousAdverts/fictitious-adverts.service";
|
||||
import {FormControl} from "@angular/forms";
|
||||
import {FictitiousUtilsService} from "../../../utils/services/fictitiousDatas/fictitiousUtils/fictitious-utils.service";
|
||||
import {User} from "../../../utils/interfaces/user";
|
||||
import {FictitiousUsersService} from "../../../utils/services/fictitiousDatas/fictitiousUsers/fictitious-users.service";
|
||||
|
||||
|
||||
|
||||
export interface AdvertWithCountViewsAndCompany {
|
||||
_id: string,
|
||||
userId: string,
|
||||
company: string,
|
||||
title: string,
|
||||
url: string,
|
||||
images: {
|
||||
url: string,
|
||||
description: string,
|
||||
}[],
|
||||
interests: string[],
|
||||
comment: string,
|
||||
views: Date[],
|
||||
countViews: number,
|
||||
isVisible: boolean,
|
||||
isActive: boolean,
|
||||
createdAt: Date,
|
||||
updatedAt: Date,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -21,8 +45,9 @@ import {FictitiousUtilsService} from "../../../utils/services/fictitiousDatas/fi
|
|||
})
|
||||
export class PageAdListAdminComponent implements AfterViewInit
|
||||
{
|
||||
tabAdvertWithCountViews: AdvertWithCountViews[] = [];
|
||||
displayedColumns: string[] = [ 'title', 'advertiser', 'interests', 'createdAt', 'updatedAt', 'countViews', 'isVisible', 'actions' ];
|
||||
tabAdvertWithCountViews: AdvertWithCountViewsAndCompany[] = [];
|
||||
tabAdvertiser: User[];
|
||||
displayedColumns: string[] = [ 'title', 'company', 'interests', 'createdAt', 'updatedAt', 'countViews', 'isVisible', 'actions' ];
|
||||
dataSource ;
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||
|
|
@ -38,6 +63,7 @@ export class PageAdListAdminComponent implements AfterViewInit
|
|||
constructor( public themeService: ThemeService,
|
||||
private fictitiousAdvertsService: FictitiousAdvertsService,
|
||||
private fictitiousUtilsService: FictitiousUtilsService,
|
||||
private fictitiousUsersService: FictitiousUsersService,
|
||||
public dialog: MatDialog,
|
||||
private snackBar: MatSnackBar ) { }
|
||||
|
||||
|
|
@ -47,8 +73,9 @@ export class PageAdListAdminComponent implements AfterViewInit
|
|||
// --- FAUX CODE ---
|
||||
const tabAdvert = this.fictitiousAdvertsService.getTabAdvert(8);
|
||||
this.allInterests = this.fictitiousUtilsService.getTags();
|
||||
this.tabAdvertiser = this.fictitiousUsersService.getTabAdvertiser(3);
|
||||
|
||||
for(let advert of tabAdvert) this.tabAdvertWithCountViews.push(this.advertToAdvertWithCountViews(advert));
|
||||
for(let advert of tabAdvert) this.tabAdvertWithCountViews.push(this.advertToAdvertWithCountViewsAndCompany(advert));
|
||||
this.dataSource = new MatTableDataSource<Advert>();
|
||||
this.onFilter();
|
||||
}
|
||||
|
|
@ -61,7 +88,7 @@ export class PageAdListAdminComponent implements AfterViewInit
|
|||
}
|
||||
|
||||
|
||||
onVisualizeImages(advert: AdvertWithCountViews)
|
||||
onVisualizeImages(advert: AdvertWithCountViewsAndCompany)
|
||||
{
|
||||
const config = {
|
||||
width: '30%',
|
||||
|
|
@ -79,7 +106,7 @@ export class PageAdListAdminComponent implements AfterViewInit
|
|||
}
|
||||
|
||||
|
||||
onDelete(advert: AdvertWithCountViews): void
|
||||
onDelete(advert: AdvertWithCountViewsAndCompany): void
|
||||
{
|
||||
const config = {
|
||||
data: { advert: advert }
|
||||
|
|
@ -160,13 +187,23 @@ export class PageAdListAdminComponent implements AfterViewInit
|
|||
}
|
||||
|
||||
|
||||
advertToAdvertWithCountViews(advert: Advert): AdvertWithCountViews
|
||||
advertToAdvertWithCountViewsAndCompany(advert: Advert): AdvertWithCountViewsAndCompany
|
||||
{
|
||||
let company0 = "company" ;
|
||||
for(let advertiser of this.tabAdvertiser)
|
||||
{
|
||||
if(advert.userId === advertiser._id) {
|
||||
company0 = advertiser.company;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
_id: advert._id,
|
||||
userId: advert.userId,
|
||||
title: advert.title,
|
||||
advertiser: advert.advertiser,
|
||||
company: company0,
|
||||
url: advert.url,
|
||||
images: advert.images,
|
||||
interests: advert.interests,
|
||||
comment: advert.comment,
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ export class PopupDeleteAdAdminComponent implements OnInit
|
|||
// --- VRAI CODE ---
|
||||
/*
|
||||
this.messageService
|
||||
.sendMessage("advertiser/delete/ad", {"advert": this.advert})
|
||||
.sendMessage("url/delete/ad", {"advert": this.advert})
|
||||
.subscribe( retour => {
|
||||
|
||||
if(retour.status === "error") {
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@
|
|||
<mat-divider></mat-divider>
|
||||
<mat-dialog-content>
|
||||
|
||||
<!-- Advertiser -->
|
||||
<!-- URL -->
|
||||
<div class="row myRow">
|
||||
<div class="col-6 myLabel"> Annonceur: </div>
|
||||
<div class="col-6 myValue"> {{advert.advertiser}} </div>
|
||||
<div class="col-6 myValue"> {{advert.url}} </div>
|
||||
</div>
|
||||
|
||||
<!-- Images -->
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ export class PopupUpdateAdminComponent implements OnInit
|
|||
dateOfBirth: admin0.dateOfBirth,
|
||||
gender: admin0.gender,
|
||||
interests: [],
|
||||
company: "",
|
||||
isActive: admin0.isActive,
|
||||
isAccepted: admin0.isisAccepted,
|
||||
createdAt: admin0.createdAt,
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
<mat-radio-button value="user" (click)="this.roleName = 'user'; onFilter()">
|
||||
Utilisateur
|
||||
</mat-radio-button><br>
|
||||
<mat-radio-button value="advertiser" (click)="this.roleName = 'advertiser'; onFilter()">
|
||||
<mat-radio-button value="url" (click)="this.roleName = 'url'; onFilter()">
|
||||
Annonceur
|
||||
</mat-radio-button><br>
|
||||
<mat-radio-button value="admin" (click)="this.roleName = 'admin'; onFilter()">
|
||||
|
|
|
|||
|
|
@ -133,6 +133,11 @@
|
|||
<mat-label>Login</mat-label>
|
||||
<input matInput type="text" [(ngModel)]="user.login">
|
||||
</mat-form-field><br>
|
||||
<!-- company -->
|
||||
<mat-form-field appearance="fill" *ngIf="user.role.name === 'advertiser'">
|
||||
<mat-label>Entreprise</mat-label>
|
||||
<input matInput type="text" [(ngModel)]="user.company">
|
||||
</mat-form-field><br *ngIf="user.role.name === 'advertiser'">
|
||||
</div>
|
||||
|
||||
<!-- mdp + confirmation -->
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ export class PopupCreateUserComponent implements OnInit
|
|||
dateOfBirth: null,
|
||||
gender: "man",
|
||||
interests: [],
|
||||
company: "",
|
||||
isActive: false,
|
||||
isAccepted: false,
|
||||
createdAt: new Date(),
|
||||
|
|
@ -72,12 +73,8 @@ export class PopupCreateUserComponent implements OnInit
|
|||
this.errorMessage = "Veuillez remplir le champ 'email'.";
|
||||
this.hasError = true;
|
||||
}
|
||||
if((this.user.role.name === 'user') && ((this.user.dateOfBirth === undefined) || (this.user.dateOfBirth === null))) {
|
||||
this.errorMessage = "Veuillez remplir le champ 'date de naissance'.";
|
||||
this.hasError = true;
|
||||
}
|
||||
else if(!this.isValidEmail(this.user.email)) {
|
||||
this.errorMessage = "Email invalide";
|
||||
this.errorMessage = "Email invalide.";
|
||||
this.hasError = true;
|
||||
}
|
||||
else if(this.password.length === 0) {
|
||||
|
|
@ -88,6 +85,14 @@ export class PopupCreateUserComponent implements OnInit
|
|||
this.errorMessage = "Le mot de passe est différent de sa confirmation.";
|
||||
this.hasError = true;
|
||||
}
|
||||
else if((this.user.role.name === 'user') && ((this.user.dateOfBirth === undefined) || (this.user.dateOfBirth === null))) {
|
||||
this.errorMessage = "Veuillez remplir le champ 'date de naissance'.";
|
||||
this.hasError = true;
|
||||
}
|
||||
else if((this.user.role.name === 'advertiser') && (this.user.company.length === 0)) {
|
||||
this.errorMessage = "Veuillez remplir le champ 'entreprise'.";
|
||||
this.hasError = true;
|
||||
}
|
||||
else {
|
||||
this.errorMessage = "" ;
|
||||
this.hasError = false;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@
|
|||
<div class="col-6 myLabel">Rôle:</div>
|
||||
<div class="col-6 myValue">
|
||||
<span *ngIf="user.role.name === 'user'">Utilisateur</span>
|
||||
<span *ngIf="user.role.name === 'advertiser'">Annonceur</span>
|
||||
<span *ngIf="user.role.name === 'url'">Annonceur</span>
|
||||
<span *ngIf="user.role.name === 'admin'">Admin</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Reference in a new issue