gestion de l'affichage des annonces dans la partie user

This commit is contained in:
MiharyR 2021-12-15 00:49:33 +01:00
parent 7ea0a5eb97
commit b0b17c062d
14 changed files with 57 additions and 101 deletions

View file

@ -84,9 +84,12 @@ export class PageAdListAdvertiserComponent implements AfterViewInit
console.log(retour);
}
else {
for(let advert of retour.data) this.tabAdvertWithCountViews.push(this.advertToAdvertWithCountViews(advert));
this.dataSource = new MatTableDataSource<AdvertWithCountViews>();
this.onFilter();
if(retour.data.length !== 0)
{
for(let advert of retour.data) this.tabAdvertWithCountViews.push(this.advertToAdvertWithCountViews(advert));
this.dataSource = new MatTableDataSource<AdvertWithCountViews>();
this.onFilter();
}
}
}

View file

@ -27,7 +27,7 @@
<!-- chart -->
<div class="chartContainer">
<div *ngIf="isDisplayable" class="chartContainer">
<canvas baseChart
[datasets]="lineChartData"
[labels]="lineChartLabels"

View file

@ -25,7 +25,7 @@ interface CoupleNameViews {
})
export class PagesPopularityComponent implements OnInit
{
formControl: FormControl;
formControl: FormControl = new FormControl();
allCoupleNameViews: CoupleNameViews[] = [];
allInterests: string[] = [];
@ -48,6 +48,8 @@ export class PagesPopularityComponent implements OnInit
}
};
isDisplayable: boolean = false;
constructor( private router: Router,
public themeService: ThemeService,
@ -167,8 +169,8 @@ export class PagesPopularityComponent implements OnInit
this.lineChartLabels = [];
if(this.step <= 0) this.step = 0;
if(this.endDate === null) this.endDate = new Date();
if(this.startDate === null) this.startDate = new Date(this.endDate.getTime() - this.oneWeek); // date d'il y a une semaine
if((this.endDate === null) || (this.endDate === undefined)) this.endDate = new Date();
if((this.startDate === null) || (this.startDate === undefined)) this.startDate = new Date(this.endDate.getTime() - this.oneWeek); // date d'il y a une semaine
const startTime = this.startDate.getTime();
const endTime = this.endDate.getTime();
@ -211,6 +213,7 @@ export class PagesPopularityComponent implements OnInit
this.lineChartData.push({"data": data.slice(), "label": label});
}
this.isDisplayable = true;
}
@ -282,9 +285,9 @@ export class PagesPopularityComponent implements OnInit
{
let i = 0;
let n = tabDate.length;
let time0 = date0.getTime();
let time0 = (new Date(date0)).getTime();
while((i <n) && (time0 > tabDate[i].getTime())) i++;
while((i <n) && (time0 > (new Date(tabDate[i])).getTime())) i++;
if(i === n) tabDate.push(date0);
else tabDate.splice(i, 0, date0);

View file

@ -35,7 +35,7 @@ export class NavbarAdvertiserComponent
onDeconnexionCallback(retour: any): void
{
console.log(retour);
if(retour.status !== "success") console.log(retour);
}
}