amelioration de la partie advertiser
This commit is contained in:
parent
2d66d182d8
commit
1643f3f336
22 changed files with 357 additions and 153 deletions
|
|
@ -21,7 +21,7 @@
|
|||
<input class="textFilter" (keyup)="applyFilter($event)" placeholder="filtre...">
|
||||
</div>
|
||||
|
||||
<!-- visible + tags + période -->
|
||||
<!-- visible + interests + période -->
|
||||
<div class="row myRow">
|
||||
|
||||
<!-- visible -->
|
||||
|
|
@ -30,18 +30,18 @@
|
|||
<mat-checkbox [(ngModel)]="noVisible" (change)="onFilter()">non visible</mat-checkbox>
|
||||
</div>
|
||||
|
||||
<!-- tags -->
|
||||
<!-- subjects -->
|
||||
<div class="col-4">
|
||||
<mat-form-field appearance="fill">
|
||||
<mat-label>Tags</mat-label>
|
||||
<mat-select [formControl]="formControlTags" multiple>
|
||||
<mat-label>Sujets</mat-label>
|
||||
<mat-select [formControl]="formControlInterests" multiple>
|
||||
<mat-select-trigger>
|
||||
{{formControlTags.value ? formControlTags.value[0] : ''}}
|
||||
<span *ngIf="formControlTags.value?.length > 1">
|
||||
(+{{formControlTags.value.length - 1}} {{formControlTags.value?.length === 2 ? 'autre' : 'autres'}})
|
||||
{{formControlInterests.value ? formControlInterests.value[0] : ''}}
|
||||
<span *ngIf="formControlInterests.value?.length > 1">
|
||||
(+{{formControlInterests.value.length - 1}} {{formControlInterests.value?.length === 2 ? 'autre' : 'autres'}})
|
||||
</span>
|
||||
</mat-select-trigger>
|
||||
<mat-option *ngFor="let topping of allTags" [value]="topping">{{topping}}</mat-option>
|
||||
<mat-option *ngFor="let topping of allInterests" [value]="topping">{{topping}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<button mat-icon-button (click)="onFilter()">
|
||||
|
|
@ -94,12 +94,12 @@
|
|||
</ng-container>
|
||||
|
||||
<!-- Tags Column -->
|
||||
<ng-container matColumnDef="tags">
|
||||
<th mat-header-cell *matHeaderCellDef> Tags </th>
|
||||
<ng-container matColumnDef="interests">
|
||||
<th mat-header-cell *matHeaderCellDef> Sujets </th>
|
||||
<td mat-cell *matCellDef="let advert">
|
||||
<span *ngFor="let tag of advert.tags; let isLast = last;">
|
||||
<span *ngIf="!isLast"> {{tag}}, </span>
|
||||
<span *ngIf="isLast"> {{tag}} </span>
|
||||
<span *ngFor="let interest of advert.interests; let isLast = last;">
|
||||
<span *ngIf="!isLast"> {{interest}}, </span>
|
||||
<span *ngIf="isLast"> {{interest}} </span>
|
||||
</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
|
||||
.filtersContainer {
|
||||
width: 70%;
|
||||
width: 80%;
|
||||
background-color: white;
|
||||
padding: 10px 10px 10px 10px;
|
||||
margin: 20px 3% 20px 3%
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import {FictitiousUtilsService} from "../../../utils/services/fictitiousDatas/fi
|
|||
export class PageAdListAdminComponent implements AfterViewInit
|
||||
{
|
||||
tabAdvert: Advert[];
|
||||
displayedColumns: string[] = [ 'title', 'advertiser', 'tags', 'createdAt', 'updatedAt', 'views', 'isVisible', 'actions' ];
|
||||
displayedColumns: string[] = [ 'title', 'advertiser', 'interests', 'createdAt', 'updatedAt', 'views', 'isVisible', 'actions' ];
|
||||
dataSource ;
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||
|
|
@ -32,8 +32,8 @@ export class PageAdListAdminComponent implements AfterViewInit
|
|||
noVisible: boolean = true;
|
||||
startDate: Date = null;
|
||||
endDate: Date = null;
|
||||
formControlTags = new FormControl();
|
||||
allTags: string[] = [];
|
||||
formControlInterests = new FormControl();
|
||||
allInterests: string[] = [];
|
||||
|
||||
|
||||
constructor( public themeService: ThemeService,
|
||||
|
|
@ -47,11 +47,10 @@ export class PageAdListAdminComponent implements AfterViewInit
|
|||
{
|
||||
// --- FAUX CODE ---
|
||||
this.tabAdvert = this.fictitiousAdvertsService.getTabAdvert(8);
|
||||
this.dataSource = new MatTableDataSource<Advert>(this.tabAdvert);
|
||||
this.dataSource.sort = this.sort;
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource = this.dataSource;
|
||||
this.allTags = this.fictitiousUtilsService.getTags();
|
||||
this.allInterests = this.fictitiousUtilsService.getTags();
|
||||
|
||||
this.dataSource = new MatTableDataSource<Advert>();
|
||||
this.onFilter();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -122,7 +121,7 @@ export class PageAdListAdminComponent implements AfterViewInit
|
|||
|
||||
onFilter(): void
|
||||
{
|
||||
console.log("b:" + this.formControlTags.value);
|
||||
console.log("b:" + this.formControlInterests.value);
|
||||
this.dataSource.data = [];
|
||||
for(let advert of this.tabAdvert)
|
||||
{
|
||||
|
|
@ -147,9 +146,9 @@ export class PageAdListAdminComponent implements AfterViewInit
|
|||
}
|
||||
|
||||
if(valide) {
|
||||
if(this.formControlTags.value !== null) {
|
||||
for (let tag of this.formControlTags.value) {
|
||||
if (advert.tags.indexOf(tag) === -1) {
|
||||
if(this.formControlInterests.value !== null) {
|
||||
for (let interest of this.formControlInterests.value) {
|
||||
if (advert.interests.indexOf(interest) === -1) {
|
||||
valide = false;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
<div class="row myRow">
|
||||
<div class="col-6 myLabel"> Tags: </div>
|
||||
<div class="col-6 myValue" style="border-left: solid 1px #e6e6e6">
|
||||
<div *ngFor="let tag of advert.tags"> {{tag}} </div>
|
||||
<div *ngFor="let interest of advert.interests"> {{interest}} </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Reference in a new issue