Merge pull request #3551 from alfonso-salces/MOBILE-4077

Mobile 4077
main
Dani Palou 2023-02-17 13:43:44 +01:00 committed by GitHub
commit 3ca1094979
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 12 deletions

View File

@ -12,25 +12,31 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { Component, EventEmitter, Input, Output } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
@Component({ @Component({
selector: 'core-report-builder-report-column', selector: 'core-report-builder-report-column',
templateUrl: './report-column.html', templateUrl: './report-column.html',
styleUrls: ['./report-column.scss'], styleUrls: ['./report-column.scss'],
}) })
export class CoreReportBuilderReportColumnComponent { export class CoreReportBuilderReportColumnComponent implements OnInit {
@Input() isExpanded = false; @Input() isExpanded = false;
@Input() isExpandable = false; @Input() isExpandable = false;
@Input() showFirstTitle = false; @Input() showFirstTitle = false;
@Input() columnIndex!: number; @Input() columnIndex!: number;
@Input() rowIndex!: number; @Input() rowIndex!: number;
@Input() column!: string; @Input() column!: string | number;
@Input() contextId!: number; @Input() contextId!: number;
@Input() header!: string; @Input() header!: string;
@Output() onToggleRow: EventEmitter<number> = new EventEmitter(); @Output() onToggleRow: EventEmitter<number> = new EventEmitter();
ngOnInit(): void {
if (typeof this.column === 'number') {
this.column = this.column.toString();
}
}
/** /**
* Emits row click * Emits row click
*/ */

View File

@ -2,12 +2,12 @@
<core-loading [hideUntil]="state.loaded"> <core-loading [hideUntil]="state.loaded">
<ng-container *ngIf="state.report?.data?.rows && state.report?.data?.headers && state.report?.details; else empty">
<ion-refresher slot="fixed" [disabled]="!state.loaded" (ionRefresh)="refreshReport($event.target)"> <ion-refresher slot="fixed" [disabled]="!state.loaded" (ionRefresh)="refreshReport($event.target)">
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content> <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher> </ion-refresher>
<ng-container *ngIf="state.report?.data?.rows?.length && state.report?.data?.headers && state.report?.details; else empty">
<ng-container *ngIf="isCardLayout"> <ng-container *ngIf="isCardLayout">
<ion-card *ngFor="let row of state.report.data.rows; let rowIndex = index"> <ion-card *ngFor="let row of state.report.data.rows; let rowIndex = index">
<ion-list class="ion-text-wrap"> <ion-list class="ion-text-wrap">
@ -46,15 +46,15 @@
</ng-container> </ng-container>
<ng-template #empty> <ng-template #empty>
<core-empty-box *ngIf="!state.report?.data?.rows || !state.report?.data?.headers || !state.report?.details" icon="fa-list-alt" <core-empty-box icon="fa-list-alt">
[message]="'core.course.nocontentavailable' | translate"></core-empty-box> <p> {{ 'core.course.nocontentavailable' | translate }} </p>
</core-empty-box>
</ng-template> </ng-template>
<core-infinite-loading *ngIf="!isBlock && state.report?.data?.rows && state.report?.data?.headers && state.report?.details" <core-infinite-loading *ngIf="!isBlock && state.report?.data?.rows?.length && state.report?.data?.headers && state.report?.details"
[enabled]="state.canLoadMoreRows" (action)="fetchMoreInfo($event)" [error]="state.errorLoadingRows"> [enabled]="state.canLoadMoreRows" (action)="fetchMoreInfo($event)" [error]="state.errorLoadingRows">
</core-infinite-loading> </core-infinite-loading>
</core-loading> </core-loading>
</ng-container> </ng-container>

View File

@ -41,4 +41,12 @@
} }
} }
core-empty-box {
color: var(--gray-500);
p {
color: var(--gray-900);
}
}
} }

View File

@ -232,7 +232,7 @@ export interface CoreReportBuilderRetrieveReportMapped extends Omit<CoreReportBu
export type CoreReportBuilderReportDataWSResponse = { export type CoreReportBuilderReportDataWSResponse = {
headers: string[]; // Headers. headers: string[]; // Headers.
rows: { // Rows. rows: { // Rows.
columns: string[]; // Columns. columns: string | number[]; // Columns.
isExpanded: boolean; isExpanded: boolean;
}[]; }[];
totalrowcount: number; // Totalrowcount. totalrowcount: number; // Totalrowcount.