diff --git a/src/app/modules/beteran/compose/compose.module.ts b/src/app/modules/beteran/compose/compose.module.ts index 81d05c1..b5b9b22 100644 --- a/src/app/modules/beteran/compose/compose.module.ts +++ b/src/app/modules/beteran/compose/compose.module.ts @@ -10,6 +10,7 @@ import { MatSelectModule } from '@angular/material/select'; import { MatButtonToggleModule } from '@angular/material/button-toggle'; import { MatExpansionModule } from '@angular/material/expansion'; import { MatTableModule } from '@angular/material/table'; +import { MatCheckboxModule } from '@angular/material/checkbox'; import { FuseCardModule } from '@fuse/components/card'; import { SharedModule } from 'app/shared/shared.module'; @@ -32,6 +33,7 @@ import { COMPOSE } from './compose'; MatButtonToggleModule, MatExpansionModule, MatTableModule, + MatCheckboxModule, FuseCardModule, SharedModule, diff --git a/src/app/modules/beteran/compose/compose/message-compose.component.html b/src/app/modules/beteran/compose/compose/message-compose.component.html index 0d93bc1..94221e0 100644 --- a/src/app/modules/beteran/compose/compose/message-compose.component.html +++ b/src/app/modules/beteran/compose/compose/message-compose.component.html @@ -11,16 +11,87 @@ > -
- - + + + + + + + + + + + {{ column }} + {{ element[column] }} + + + + + + +
+ + +
+ {{ element.description }} + +
+
+ +
+ + + + + - - - - + > --> + +
+
+ + + +
- +
diff --git a/src/app/modules/beteran/compose/compose/message-compose.component.scss b/src/app/modules/beteran/compose/compose/message-compose.component.scss new file mode 100644 index 0000000..3353872 --- /dev/null +++ b/src/app/modules/beteran/compose/compose/message-compose.component.scss @@ -0,0 +1,47 @@ +table { + width: 100%; +} + +tr.example-detail-row { + height: 0; +} + +tr.example-element-row:not(.example-expanded-row):hover { + background: #777; +} + +tr.example-element-row:not(.example-expanded-row):active { + background: #efefef; +} + +.example-element-row td { + border-bottom-width: 0; +} + +.example-element-detail { + overflow: hidden; + display: flex; +} + +.example-element-diagram { + min-width: 80px; + border: 2px solid black; + padding: 8px; + font-weight: lighter; + margin: 8px 0; + height: 104px; +} + +.example-element-symbol { + font-weight: bold; + font-size: 40px; + line-height: normal; +} + +.example-element-description { + padding: 16px; +} + +.example-element-description-attribution { + opacity: 0.5; +} diff --git a/src/app/modules/beteran/compose/compose/message-compose.component.ts b/src/app/modules/beteran/compose/compose/message-compose.component.ts index 9321cd9..eeab368 100644 --- a/src/app/modules/beteran/compose/compose/message-compose.component.ts +++ b/src/app/modules/beteran/compose/compose/message-compose.component.ts @@ -5,19 +5,22 @@ import { transition, animate, } from '@angular/animations'; +import { SelectionModel } from '@angular/cdk/collections'; import { Component, OnInit } from '@angular/core'; import { FormGroup, FormBuilder, Validators } from '@angular/forms'; import { MatDialogRef } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog'; +import { MatTableDataSource } from '@angular/material/table'; import { CustomerRegistrationComposeComponent } from './customer-registration-compose.component'; @Component({ selector: 'message-compose', + styleUrls: ['./message-compose.component.scss'], templateUrl: './message-compose.component.html', animations: [ trigger('detailExpand', [ state('collapsed', style({ height: '0px', minHeight: '0' })), - state('expanded', style({ height: '*', minHeight: '50px' })), + state('expanded', style({ height: '*' })), transition( 'expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)') @@ -26,11 +29,17 @@ import { CustomerRegistrationComposeComponent } from './customer-registration-co ], }) export class MessageComposeComponent implements OnInit { - composeForm!: FormGroup; - - dataSource = ELEMENT_DATA; - columnsToDisplay = ['state', 'content', 'delete', 'applicationDate']; - expandedElement: PeriodicElement | null | undefined; + selection = new SelectionModel(true, []); + selectColumnName: string = 'select'; + dataSource = new MatTableDataSource(ELEMENT_DATA); + columnsToDisplay = [ + this.selectColumnName, + 'state', + 'content', + 'delete', + 'applicationDate', + ]; + expandedElement!: PeriodicElement | null; /** * Constructor @@ -50,10 +59,6 @@ export class MessageComposeComponent implements OnInit { */ ngOnInit(): void { // Create the form - this.composeForm = this._formBuilder.group({ - accountHolder: ['', [Validators.required]], - amount: ['', [Validators.required]], - }); } // ----------------------------------------------------------------------------------------------------- @@ -85,6 +90,26 @@ export class MessageComposeComponent implements OnInit { * Send the message */ send(): void {} + + isAllSelected(): boolean { + const numSelected = this.selection.selected.length; + const numRows = this.dataSource.data.length; + return numSelected === numRows; + } + masterToggle(): void { + this.isAllSelected() + ? this.selection.clear() + : this.dataSource.data.forEach((row) => this.selection.select(row)); + } + /** The label for the checkbox on the passed row */ + checkboxLabel(row?: PeriodicElement, idx?: number): string { + if (!row) { + return `${this.isAllSelected() ? 'select' : 'deselect'} all`; + } + return `${ + this.selection.isSelected(row) ? 'deselect' : 'select' + } row ${idx}`; + } } export interface PeriodicElement {