src/app/manage-learn/shared/components/report-list/report-list.component.ts
OnInit
selector | app-report-list |
styleUrls | ./report-list.component.scss |
templateUrl | ./report-list.component.html |
Properties |
Methods |
Inputs |
constructor(dhiti: DhitiApiService, modalCtrl: ModalController)
|
|||||||||
Parameters :
|
config | |
Type : any
|
|
data | |
Type : any
|
|
element | |
Type : any
|
|
questionNumber | |
Type : any
|
|
close |
close()
|
Returns :
void
|
loadData |
loadData()
|
Returns :
void
|
loadMoreReports |
loadMoreReports()
|
Returns :
void
|
ngOnInit |
ngOnInit()
|
Returns :
void
|
completedDate |
page |
Type : number
|
Default value : 1
|
import { Component, Input, OnInit } from '@angular/core';
import { DhitiApiService } from '@app/app/manage-learn/core/services/dhiti-api.service';
import { ModalController } from '@ionic/angular';
@Component({
selector: 'app-report-list',
templateUrl: './report-list.component.html',
styleUrls: ['./report-list.component.scss'],
})
export class ReportListComponent implements OnInit {
@Input() data;
@Input() config;
@Input() element;
@Input() questionNumber;
page = 1;
completedDate;
constructor(
private dhiti: DhitiApiService,
private modalCtrl: ModalController,
) { }
ngOnInit() {
this.loadData();
}
loadData(){
this.dhiti.post(this.config).subscribe(resp =>{
this.completedDate = resp.completedDate;
this.element.answers = [...this.element.answers, ...resp.answers];
})
}
loadMoreReports(){
this.config.payload.completedDate = this.completedDate
this.loadData();
}
close() {
this.modalCtrl.dismiss();
}
}
<ion-toolbar>
<ion-buttons (click)="close()" slot="start" class="padding" color="primary">
<ion-icon role="button" name="close" aria-label="close" slot="icon-only" style="padding-left: 10px;"></ion-icon>
</ion-buttons>
</ion-toolbar>
<ion-content>
<ion-card>
<reports-text [data]="element" [questionNumber]="questionNumber"></reports-text>
</ion-card>
<ion-button class="view-more custom-btn-txt-transform-none" expand="block" (click)="loadMoreReports()" *ngIf="element?.answers?.length && element?.count > element?.answers?.length">
{{ "VIEW_MORE" | translate }}
</ion-button>
</ion-content>
./report-list.component.scss