Commit 9ef4ed16 authored by achinta's avatar achinta

feat: add view event in custom table

parent 09a93397
......@@ -17,7 +17,7 @@
</ng-container>
<ng-container *ngIf="item =='edit'">
<button class="view_button d_inline_block width_auto ml_1">
<button class="view_button d_inline_block width_auto ml_1" (click)="edit(element)">
<span class="material-symbols-outlined">edit</span>
</button>
</ng-container>
......
......@@ -25,6 +25,8 @@ export class CustomTableComponent {
@Input() pageSize: number = 0; // Table data
@Output() emitView: EventEmitter<string> = new EventEmitter<string>();
@Output() emitEdit: EventEmitter<string> = new EventEmitter<string>();
// totalRecords: number = 3400;
// pageSize: number = 50;
......@@ -44,6 +46,10 @@ export class CustomTableComponent {
this.emitView.emit(data);
}
public edit(data:any): void {
this.emitEdit.emit(data);
}
onPageChanged(event: any): void {
console.log("event");
console.log(event);
......
<app-custom-table [columns]="columns" [data]="data" />
<app-custom-table
[columns]="columns"
[data]="data"
(emitEdit)="emitEditFromTable($event)"
(emitView)="emitViewFromTable($event)"
/>
import { Component } from '@angular/core';
import { CustomTableComponent } from '../../../component-library/custom-table/custom-table.component';
import { MatDialog } from '@angular/material/dialog';
import { ManageComponent } from '../manage/manage.component';
@Component({
selector: 'app-assignment',
......@@ -9,7 +11,11 @@ import { CustomTableComponent } from '../../../component-library/custom-table/cu
templateUrl: './assignment.component.html',
styleUrl: './assignment.component.scss'
})
export class AssignmentComponent {
constructor(
private _dialog: MatDialog,
){}
public columns = [
{ key: 'class', label: 'Class' },
{ key: 'subject', label: 'Subject' },
......@@ -23,6 +29,37 @@ export class AssignmentComponent {
subject: "Math",
section: "5A",
action: ['view','edit']
},
{
class: "VI",
subject: "Math",
section: "5B",
action: ['view','edit']
}
];
public emitViewFromTable(clickedData: string){
alert("Have to view the doc in another page");
}
public emitEditFromTable(clickedData: string): void {
// rate ? rate.is_edit_enable = true : '';
console.log(clickedData);
let dialogRef = this._dialog.open(ManageComponent, {
data: clickedData,
width: '98vw',
height: 'auto',
maxWidth: '70vw',
maxHeight: '70vh',
});
// dialogRef.afterClosed().subscribe(data => {
// if (data)
// this._getScheduleOfRates();
// });
}
}
import { Component } from '@angular/core';
import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
@Component({
selector: 'app-manage',
......@@ -7,5 +8,7 @@ import { Component } from '@angular/core';
styleUrl: './manage.component.scss'
})
export class ManageComponent {
constructor(
@Inject(MAT_DIALOG_DATA) public data: any,
){}
}
......@@ -52,7 +52,7 @@ export class Menu {
public static readonly RoutineItems: Sidebar = {
id: 4,
title: 'Routine',
icon: 'assignment',
icon: 'routine',
route: RequestMapperService.ROUTINE_URL,
selected: false,
roles: [
......@@ -64,7 +64,7 @@ export class Menu {
public static readonly ExamItems: Sidebar = {
id: 5,
title: 'Exam',
icon: 'assignment',
icon: 'book_3',
route: RequestMapperService.EXAM_URL,
selected: false,
roles: [
......
......@@ -4,7 +4,7 @@
<app-colored-card
[cardTextOneHeading]="'Assignment'"
[cardTextOne]="''"
[cardLink]="''"
[cardLink]="assignmentUrl"
[cardTextTwoHeading]="'Assignment'"
[cardTextTwo]="''"
[CardImage]="
......@@ -15,7 +15,7 @@
<app-colored-card
[cardTextOneHeading]="'Routine'"
[cardTextOne]="''"
[cardLink]="''"
[cardLink]="routineUrl"
[cardTextTwoHeading]="'Routine'"
[cardTextTwo]="''"
[CardImage]="
......@@ -26,7 +26,7 @@
<app-colored-card
[cardTextOneHeading]="'Exam Schedule'"
[cardTextOne]="''"
[cardLink]="''"
[cardLink]="examUrl"
[cardTextTwoHeading]="'Exam Schedule'"
[cardTextTwo]="''"
[CardImage]="'./assets/image/Digital_receipts_for_online_payments.svg'"
......
import { Component, OnInit } from '@angular/core';
// import { DummyDataTransmissionService } from '../../raintree/transmission/dummy-data-transmission.service';
// import { Dummy } from '../interface/dummy';
import { ColoredCardComponent } from '../../component-library/colored-card/colored-card.component';
import { WhiteCardComponent } from '../../component-library/white-card/white-card.component';
import { LineChartComponent } from '../../component-library/line-cart-123/line-chart/line-chart.component';
import { RequestMapperService } from '../../mappers/request-mapper.service';
@Component({
selector: 'app-portal-dashboard',
imports: [ColoredCardComponent, WhiteCardComponent, LineChartComponent],
imports: [ColoredCardComponent],
templateUrl: './portal-dashboard.component.html',
styleUrl: './portal-dashboard.component.scss'
})
export class PortalDashboardComponent implements OnInit {
constructor() {}
public assignmentUrl = `/${RequestMapperService.PORTAL_URL}/${RequestMapperService.ASSIGNMENT_URL}`;
public routineUrl = `/${RequestMapperService.PORTAL_URL}/${RequestMapperService.ROUTINE_URL}`;
public examUrl = `/${RequestMapperService.PORTAL_URL}/${RequestMapperService.EXAM_URL}`;
public ngOnInit(): void {
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment