Blacked and isorted the python files
Prettied and eslinted the typescript/html files
This commit is contained in:
@ -1,18 +1,20 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { TableListDataSource } from './table-list-datasource';
|
||||
import { Table } from '../../core/table';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { MatTable } from '@angular/material/table';
|
||||
import { MenuCategory } from '../../core/menu-category';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatTable } from '@angular/material/table';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
||||
import { MenuCategory } from '../../core/menu-category';
|
||||
import { Table } from '../../core/table';
|
||||
import { ToasterService } from '../../core/toaster.service';
|
||||
import { TableService } from '../table.service';
|
||||
|
||||
import { TableListDataSource } from './table-list-datasource';
|
||||
|
||||
@Component({
|
||||
selector: 'app-table-list',
|
||||
templateUrl: './table-list.component.html',
|
||||
styleUrls: ['./table-list.component.css']
|
||||
styleUrls: ['./table-list.component.css'],
|
||||
})
|
||||
export class TableListComponent implements OnInit {
|
||||
@ViewChild('table', { static: true }) table: MatTable<MenuCategory>;
|
||||
@ -26,7 +28,7 @@ export class TableListComponent implements OnInit {
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private toaster: ToasterService,
|
||||
private ser: TableService
|
||||
private ser: TableService,
|
||||
) {
|
||||
this.data = new BehaviorSubject([]);
|
||||
this.data.subscribe((data: Table[]) => {
|
||||
@ -35,23 +37,21 @@ export class TableListComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data
|
||||
.subscribe((data: { list: Table[] }) => {
|
||||
this.data.next(data.list);
|
||||
});
|
||||
this.route.data.subscribe((data: { list: Table[] }) => {
|
||||
this.data.next(data.list);
|
||||
});
|
||||
this.dataSource = new TableListDataSource(this.data);
|
||||
}
|
||||
|
||||
updateSortOrder() {
|
||||
this.ser.updateSortOrder(this.list)
|
||||
.subscribe(
|
||||
(result) => {
|
||||
this.toaster.show('Success', '');
|
||||
},
|
||||
(error) => {
|
||||
this.toaster.show('Danger', error.error);
|
||||
}
|
||||
);
|
||||
this.ser.updateSortOrder(this.list).subscribe(
|
||||
() => {
|
||||
this.toaster.show('Success', '');
|
||||
},
|
||||
(error) => {
|
||||
this.toaster.show('Danger', error.error);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
dropTable(event: CdkDragDrop<TableListDataSource>) {
|
||||
|
||||
Reference in New Issue
Block a user