bank-info 추가
This commit is contained in:
parent
c4e7c23a5f
commit
fd294371e9
|
@ -27,6 +27,7 @@ import { AuthModule } from 'src/modules/auth/auth.module';
|
|||
import { DashboardModule } from 'src/modules/dashboard/dashboard.module';
|
||||
import { UserModule } from 'src/modules/user/user.module';
|
||||
import { GameModule } from 'src/modules/game/game.module';
|
||||
import { SitesModule } from 'src/modules/sites/sites.module';
|
||||
|
||||
import { from } from 'rxjs';
|
||||
@NgModule({
|
||||
|
@ -59,7 +60,8 @@ import { from } from 'rxjs';
|
|||
AuthModule.forRoot(),
|
||||
DashboardModule.forRoot(),
|
||||
UserModule.forRoot(),
|
||||
GameModule.forRoot()
|
||||
GameModule.forRoot(),
|
||||
SitesModule.forRoot()
|
||||
],
|
||||
declarations: [AppComponent],
|
||||
providers: [],
|
||||
|
|
|
@ -9,6 +9,10 @@ const routes: Routes = [
|
|||
{
|
||||
path: 'games',
|
||||
loadChildren: './games/games.module#GamesModule'
|
||||
},
|
||||
{
|
||||
path: 'sites',
|
||||
loadChildren: './sites/sites.module#SitesModule'
|
||||
}
|
||||
];
|
||||
|
||||
|
|
16
src/app/pages/sites/bank-info/bank-info-routing.module.ts
Normal file
16
src/app/pages/sites/bank-info/bank-info-routing.module.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
import { ListComponent } from './component/list.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: ListComponent
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class BankInfoRoutingModule {}
|
45
src/app/pages/sites/bank-info/bank-info.module.ts
Normal file
45
src/app/pages/sites/bank-info/bank-info.module.ts
Normal file
|
@ -0,0 +1,45 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatExpansionModule } from '@angular/material/expansion';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatSortModule } from '@angular/material/sort';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatPaginatorModule } from '@angular/material/paginator';
|
||||
|
||||
import { FuseSharedModule } from 'src/@fuse/shared.module';
|
||||
import { FuseWidgetModule } from 'src/@fuse/components/widget/widget.module';
|
||||
|
||||
import { BankInfoRoutingModule } from './bank-info-routing.module';
|
||||
import { ListComponent } from './component/list.component';
|
||||
|
||||
import { COMPONENTS } from './component';
|
||||
// import { RESOLVERS } from './resolver';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
MatButtonModule,
|
||||
MatExpansionModule,
|
||||
MatFormFieldModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
MatMenuModule,
|
||||
MatSelectModule,
|
||||
MatSortModule,
|
||||
MatTableModule,
|
||||
MatPaginatorModule,
|
||||
|
||||
FuseSharedModule,
|
||||
FuseWidgetModule,
|
||||
|
||||
BankInfoRoutingModule
|
||||
],
|
||||
|
||||
declarations: [...COMPONENTS]
|
||||
// providers: [...RESOLVERS]
|
||||
})
|
||||
export class BankInfoModule {}
|
3
src/app/pages/sites/bank-info/component/index.ts
Normal file
3
src/app/pages/sites/bank-info/component/index.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
import { ListComponent } from './list.component';
|
||||
|
||||
export const COMPONENTS = [ListComponent];
|
|
@ -0,0 +1 @@
|
|||
<p>list works!</p>
|
30
src/app/pages/sites/bank-info/component/list.component.ts
Normal file
30
src/app/pages/sites/bank-info/component/list.component.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
import {
|
||||
Component,
|
||||
ElementRef,
|
||||
OnDestroy,
|
||||
OnInit,
|
||||
ViewChild,
|
||||
ViewEncapsulation,
|
||||
AfterViewInit
|
||||
} from '@angular/core';
|
||||
import { fromEvent, Subject } from 'rxjs';
|
||||
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
|
||||
import { takeUntil } from 'rxjs/internal/operators';
|
||||
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
|
||||
import { fuseAnimations } from 'src/@fuse/animations';
|
||||
import { FuseUtils } from 'src/@fuse/utils';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-sites-bank-info-list',
|
||||
templateUrl: './list.component.html',
|
||||
styleUrls: ['./list.component.scss'],
|
||||
animations: fuseAnimations,
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class ListComponent implements OnInit {
|
||||
constructor() {}
|
||||
|
||||
ngOnInit() {}
|
||||
}
|
73
src/app/pages/sites/bank-info/component/list.data-source.ts
Normal file
73
src/app/pages/sites/bank-info/component/list.data-source.ts
Normal file
|
@ -0,0 +1,73 @@
|
|||
import { DataSource } from '@angular/cdk/table';
|
||||
|
||||
import { BehaviorSubject, Observable, merge } from 'rxjs';
|
||||
import { switchMap, map } from 'rxjs/operators';
|
||||
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { CollectionViewer } from '@angular/cdk/collections';
|
||||
|
||||
import { BankInfo } from 'src/modules/sites/bank-info/model/bank-info.model';
|
||||
import { BankInfoService } from 'src/modules/sites/bank-info/service/bank-info.service';
|
||||
import { Page } from 'src/modules/common/data/model/page';
|
||||
|
||||
export class BankInfoDataSource extends DataSource<BankInfo> {
|
||||
private filterSubject = new BehaviorSubject('');
|
||||
private pageSubject = new BehaviorSubject<Page<BankInfo>>({});
|
||||
|
||||
constructor(
|
||||
private bankInfoService: BankInfoService,
|
||||
private paginator: MatPaginator,
|
||||
private sort: MatSort
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
// Filter
|
||||
get filter(): string {
|
||||
return this.filterSubject.value;
|
||||
}
|
||||
|
||||
set filter(filter: string) {
|
||||
this.filterSubject.next(filter);
|
||||
}
|
||||
|
||||
get page(): Page<BankInfo> {
|
||||
return this.pageSubject.value;
|
||||
}
|
||||
|
||||
set page(value: Page<BankInfo>) {
|
||||
this.pageSubject.next(value);
|
||||
}
|
||||
|
||||
connect(
|
||||
collectionViewer: CollectionViewer
|
||||
): Observable<BankInfo[] | readonly BankInfo[]> {
|
||||
const displayDataChanges = [
|
||||
this.paginator.page,
|
||||
this.sort.sortChange,
|
||||
this.filterSubject
|
||||
];
|
||||
|
||||
return merge(...displayDataChanges).pipe(
|
||||
switchMap(() => {
|
||||
const filter = this.filter;
|
||||
const sortActive = this.sort.active;
|
||||
const sortDirection = this.sort.direction;
|
||||
const pageIndex = this.paginator.pageIndex;
|
||||
const pageSize = this.paginator.pageSize;
|
||||
|
||||
return this.bankInfoService.getBankInfos().pipe(
|
||||
map(page => {
|
||||
this.page = page;
|
||||
return page.content;
|
||||
})
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
disconnect(collectionViewer: CollectionViewer): void {
|
||||
this.filterSubject.complete();
|
||||
}
|
||||
}
|
15
src/app/pages/sites/sites-routing.module.ts
Normal file
15
src/app/pages/sites/sites-routing.module.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: 'bank-info',
|
||||
loadChildren: './bank-info/bank-info.module#BankInfoModule'
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class SitesRoutingModule {}
|
8
src/app/pages/sites/sites.module.ts
Normal file
8
src/app/pages/sites/sites.module.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { FuseSharedModule } from 'src/@fuse/shared.module';
|
||||
import { SitesRoutingModule } from './sites-routing.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [FuseSharedModule, SitesRoutingModule]
|
||||
})
|
||||
export class SitesModule {}
|
9
src/modules/sites/bank-info/model/bank-info.model.ts
Normal file
9
src/modules/sites/bank-info/model/bank-info.model.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { DateAudit } from 'src/modules/common/data/model/audit';
|
||||
|
||||
export interface BankInfo extends DateAudit {
|
||||
id?: number;
|
||||
name?: string;
|
||||
number?: string;
|
||||
holder?: string;
|
||||
description?: string;
|
||||
}
|
28
src/modules/sites/bank-info/service/bank-info.service.ts
Normal file
28
src/modules/sites/bank-info/service/bank-info.service.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
import { Injectable, Inject } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { BankInfo } from '../model/bank-info.model';
|
||||
import { API_BASE_URL } from 'src/modules/common/type/injection-token.type';
|
||||
import { Page } from 'src/modules/common/data/model/page';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class BankInfoService {
|
||||
constructor(
|
||||
@Inject(API_BASE_URL) private apiBaseUrl: string,
|
||||
private httpClient: HttpClient
|
||||
) {}
|
||||
|
||||
public getBankInfos(): Observable<Page<BankInfo>> {
|
||||
return this.httpClient.get<Page<BankInfo>>(
|
||||
`${this.apiBaseUrl}/bank-info`,
|
||||
{}
|
||||
);
|
||||
}
|
||||
|
||||
// public getUser(id: number): Observable<User> {
|
||||
// return this.httpClient.get<User>(`${this.apiBaseUrl}/users/${id}`, {});
|
||||
// }
|
||||
}
|
3
src/modules/sites/bank-info/service/index.ts
Normal file
3
src/modules/sites/bank-info/service/index.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
import { BankInfoService } from './bank-info.service';
|
||||
|
||||
export const BANK_INFO_SERVICES = [BankInfoService];
|
23
src/modules/sites/sites.module.ts
Normal file
23
src/modules/sites/sites.module.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { NgModule, ModuleWithProviders } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { BANK_INFO_SERVICES } from './bank-info/service';
|
||||
|
||||
@NgModule({
|
||||
imports: [],
|
||||
exports: []
|
||||
})
|
||||
export class SitesRootModule {}
|
||||
|
||||
@NgModule({
|
||||
declarations: [],
|
||||
imports: [CommonModule],
|
||||
exports: []
|
||||
})
|
||||
export class SitesModule {
|
||||
public static forRoot(): ModuleWithProviders<SitesRootModule> {
|
||||
return {
|
||||
ngModule: SitesRootModule,
|
||||
providers: [BANK_INFO_SERVICES]
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user