diff --git a/src/app/app.module.ts b/src/app/app.module.ts index ea9c7f2..0b76505 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -28,7 +28,7 @@ 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 { SpecialModule } from 'src/modules/special/special.module'; import { from } from 'rxjs'; @NgModule({ imports: [ @@ -61,7 +61,8 @@ import { from } from 'rxjs'; DashboardModule.forRoot(), UserModule.forRoot(), GameModule.forRoot(), - SitesModule.forRoot() + SitesModule.forRoot(), + SpecialModule.forRoot() ], declarations: [AppComponent], providers: [], diff --git a/src/app/pages/specials/special/component/fix-bonus.component.html b/src/app/pages/specials/special/component/fix-bonus.component.html index 69dabf8..2cb860b 100644 --- a/src/app/pages/specials/special/component/fix-bonus.component.html +++ b/src/app/pages/specials/special/component/fix-bonus.component.html @@ -1 +1,158 @@ -

fix-bonus works!

+
+ + +
+
+
+ home + chevron_right + User Interface +
+
계좌분리 관리
+
+
+ + + +
+
+ 고정보너스 +
+ +
+
+
+ + + + 타입 + {{ fixBonus.gameType }} + + + + + 설명 + + {{ fixBonus.gameDescription }} + + + + + + 설명 + + + + + + + + + + 배당설정 + + + + + + + + + + 폴더설정 + + + + + + + + + + 허용불가 + + + + + + + + + + +
+
+
+
+ +
diff --git a/src/app/pages/specials/special/component/fix-bonus.component.scss b/src/app/pages/specials/special/component/fix-bonus.component.scss index e69de29..8f8f166 100644 --- a/src/app/pages/specials/special/component/fix-bonus.component.scss +++ b/src/app/pages/specials/special/component/fix-bonus.component.scss @@ -0,0 +1,140 @@ +@import 'src/@fuse/scss/fuse'; + +app-fix-bonus { + #fix-bonus { + .top-bg { + @include media-breakpoint('xs') { + height: 224px; + } + } + > .center { + > .header { + .search-wrapper { + width: 100%; + max-width: 480px; + border-radius: 28px; + overflow: hidden; + @include mat-elevation(1); + + @include media-breakpoint('xs') { + width: 100%; + } + + .search { + width: 100%; + height: 48px; + line-height: 48px; + padding: 0 18px; + + input { + width: 100%; + height: 48px; + min-height: 48px; + max-height: 48px; + padding: 0 16px; + border: none; + outline: none; + } + } + } + + @include media-breakpoint('xs') { + padding: 8px 0; + height: 160px !important; + min-height: 160px !important; + max-height: 160px !important; + } + } + } + } + + .fix-bonus-table { + color: black; + flex: 1 1 auto; + border-bottom: 1px solid rgba(0, 0, 0, 0.301); + overflow: auto; + // -webkit-overflow-scrolling: touch; + + .fix-bonus { + position: relative; + cursor: pointer; + // height: 84px; + } + .mat-cell { + min-width: 0; + display: flex; + align-items: center; + } + + //First column and header + // .mat-header-cell:first-child, + // .mat-cell:first-child { + // flex: 10%; + // } + // //Second column and header + // .mat-header-cell:nth-child(2), + // .mat-cell:nth-child(2) { + // flex: 30%; + // } + // .mat-header-cell:nth-child(3), + // .mat-cell:nth-child(2) { + // flex: 20%; + // } + // .mat-header-cell:nth-child(4), + // .mat-cell:nth-child(2) { + // flex: 15%; + // } + // //Last column and header + // .mat-header-cell:last-child, + // .mat-cell:last-child { + // flex: 15%; + // } + + .mat-column-icon { + max-width: 11%; + // justify-content: start; + } + .mat-column-korName { + max-width: 22%; + } + .mat-column-addMethod { + max-width: 22%; + } + .mat-column-sportsEntities { + max-width: 22%; + } + .mat-column-test { + max-width: 22%; + // justify-content: flex-end; + } + .mat-column-image { + flex: 1 0 84px; + + .product-image { + width: 52px; + height: 52px; + border: 1px solid rgba(0, 0, 0, 0.12); + } + } + .mat-column-buttons { + flex: 0 0 80px; + } + .quantity-indicator { + display: inline-block; + vertical-align: middle; + width: 8px; + height: 8px; + border-radius: 4px; + margin-right: 8px; + + & + span { + display: inline-block; + vertical-align: middle; + } + } + + .active-icon { + border-radius: 50%; + } + } +} diff --git a/src/app/pages/specials/special/component/fix-bonus.component.ts b/src/app/pages/specials/special/component/fix-bonus.component.ts index 4f042e1..f06d825 100644 --- a/src/app/pages/specials/special/component/fix-bonus.component.ts +++ b/src/app/pages/specials/special/component/fix-bonus.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit, + OnDestroy, ViewEncapsulation, AfterViewInit, ViewChild, @@ -19,6 +20,8 @@ import { } from '@angular/forms'; import { fuseAnimations } from 'src/@fuse/animations'; import { Observable, of, fromEvent, Subject, BehaviorSubject } from 'rxjs'; +import { FixBonusDataSource } from './fix-bonus.data-source'; +import { FixBonusService } from 'src/modules/special/fix-bonus/service/fix-bonus.service'; @Component({ selector: 'app-fix-bonus', @@ -27,7 +30,24 @@ import { Observable, of, fromEvent, Subject, BehaviorSubject } from 'rxjs'; encapsulation: ViewEncapsulation.None, animations: fuseAnimations }) -export class FixBonusComponent implements OnInit { +export class FixBonusComponent implements OnInit, OnDestroy, AfterViewInit { + displayedColumns = [ + 'gameType', + 'gameDescription', + 'userDescription', + 'odds', + 'folder', + 'allow' + ]; + constructor( + private fb: FormBuilder, + private fixBonusService: FixBonusService + ) { + this._unsubscribeAll = new Subject(); + } + + dataSource: FixBonusDataSource = new FixBonusDataSource(this.fixBonusService); + public inputChange$: Subject = new Subject(); public ClickedRowIndex: number = -1; // public ClickedRow: cObject; currentRow: cObject; @@ -35,19 +55,28 @@ export class FixBonusComponent implements OnInit { public mtformgroup: FormGroup; public mtformarray: FormArray; - public dataSource; - @ViewChild('filter', { static: true }) filter: ElementRef; // Private private _unsubscribeAll: Subject; - constructor(private fb: FormBuilder) {} - ngOnInit() { this.mtformarray = this.fb.array([]); this.mtformgroup = this.fb.group({ formarray: this.mtformarray }); this.dataSource.formg = this.mtformgroup; } + + /** + * On destroy + */ + ngOnDestroy(): void { + // Unsubscribe from all subscriptions + this._unsubscribeAll.next(); + this._unsubscribeAll.complete(); + } + + ngAfterViewInit(): void {} + + fixBonusfoUpdate(): void {} } diff --git a/src/app/pages/specials/special/component/fix-bonus.data-source.ts b/src/app/pages/specials/special/component/fix-bonus.data-source.ts new file mode 100644 index 0000000..474d251 --- /dev/null +++ b/src/app/pages/specials/special/component/fix-bonus.data-source.ts @@ -0,0 +1,216 @@ +import { DataSource } from '@angular/cdk/table'; + +import { BehaviorSubject, Observable, merge, of } from 'rxjs'; +import { map } from 'rxjs/operators'; + +import { CollectionViewer } from '@angular/cdk/collections'; + +import { FixBonus } from 'src/modules/special/fix-bonus/model/fix-bonus.model'; +import { FixBonusService } from 'src/modules/special/fix-bonus/service/fix-bonus.service'; + +import { FormControl, FormGroup, Validators, FormArray } from '@angular/forms'; + +const ELEMENT_DATA: FixBonus[] = [ + { + gameType: 'gameType1', + gameDescription: '크로스', + userDescription: + '[ 3폴더 ] 이상 조합가능 보너스 ㅡㅡㅡ 1.2배당 이상경기만 인정', + odds: '1.03', + folder: 3, + allow: false, + createdAt: null, + updatedAt: null + }, + { + gameType: 'gameType2', + gameDescription: '크로스', + userDescription: + '[ 3폴더 ] 이상 조합가능 보너스 ㅡㅡㅡ 1.2배당 이상경기만 인정', + odds: '1.03', + folder: 3, + allow: false, + createdAt: null, + updatedAt: null + }, + { + gameType: 'gameType3', + gameDescription: '크로스', + userDescription: + '[ 3폴더 ] 이상 조합가능 보너스 ㅡㅡㅡ 1.2배당 이상경기만 인정', + odds: '1.03', + folder: 3, + allow: false, + createdAt: null, + updatedAt: null + }, + { + gameType: 'gameType4', + gameDescription: '가상축구', + userDescription: + '[ 3폴더 ] 이상 조합가능 보너스 ㅡㅡㅡ 1.2배당 이상경기만 인정', + odds: '1.03', + folder: 3, + allow: false, + createdAt: null, + updatedAt: null + }, + { + gameType: 'gameType5', + gameDescription: '가상축구', + userDescription: + '[ 3폴더 ] 이상 조합가능 보너스 ㅡㅡㅡ 1.2배당 이상경기만 인정', + odds: '1.03', + folder: 3, + allow: false, + createdAt: null, + updatedAt: null + }, + { + gameType: 'gameType6', + gameDescription: '가상축구', + userDescription: + '[ 3폴더 ] 이상 조합가능 보너스 ㅡㅡㅡ 1.2배당 이상경기만 인정', + odds: '1.03', + folder: 3, + allow: false, + createdAt: null, + updatedAt: null + }, + { + gameType: 'gameType7', + gameDescription: '스페셜', + userDescription: + '[ 3폴더 ] 이상 조합가능 보너스 ㅡㅡㅡ 1.2배당 이상경기만 인정', + odds: '1.03', + folder: 3, + allow: false, + createdAt: null, + updatedAt: null + }, + { + gameType: 'gameType8', + gameDescription: '스페셜', + userDescription: + '[ 3폴더 ] 이상 조합가능 보너스 ㅡㅡㅡ 1.2배당 이상경기만 인정', + odds: '1.03', + folder: 3, + allow: false, + createdAt: null, + updatedAt: null + }, + { + gameType: 'gameType9', + gameDescription: '스페셜', + userDescription: + '[ 3폴더 ] 이상 조합가능 보너스 ㅡㅡㅡ 1.2배당 이상경기만 인정', + odds: '1.03', + folder: 3, + allow: false, + createdAt: null, + updatedAt: null + }, + { + gameType: 'gameType10', + gameDescription: '실시간', + userDescription: + '[ 3폴더 ] 이상 조합가능 보너스 ㅡㅡㅡ 1.2배당 이상경기만 인정', + odds: '1.03', + folder: 3, + allow: false, + createdAt: null, + updatedAt: null + }, + { + gameType: 'gameType11', + gameDescription: '실시간', + userDescription: + '[ 3폴더 ] 이상 조합가능 보너스 ㅡㅡㅡ 1.2배당 이상경기만 인정', + odds: '1.03', + folder: 3, + allow: false, + createdAt: null, + updatedAt: null + }, + { + gameType: 'gameType12', + gameDescription: '실시간', + userDescription: + '[ 3폴더 ] 이상 조합가능 보너스 ㅡㅡㅡ 1.2배당 이상경기만 인정', + odds: '1.03', + folder: 3, + allow: false, + createdAt: null, + updatedAt: null + }, + { + gameType: 'gameType13', + gameDescription: '개경주', + userDescription: + '[ 3폴더 ] 이상 조합가능 보너스 ㅡㅡㅡ 1.2배당 이상경기만 인정', + odds: '1.03', + folder: 3, + allow: false, + createdAt: null, + updatedAt: null + } +]; + +export class FixBonusDataSource extends DataSource { + private _objectStore: FixBonus[] = []; + private _ObjectsSubject$ = new BehaviorSubject([]); + private _loadingSubject$ = new BehaviorSubject(false); + + public loading$ = this._loadingSubject$.asObservable(); + public formg: FormGroup; + + constructor(private fixBonusService: FixBonusService) { + super(); + } + + connect(collectionViewer: CollectionViewer): Observable { + // return this.fixBonusService.getAll().pipe( + // map(res => { + // res.forEach(m => this._objectStore.push(m as FixBonus)); + // this._ObjectsSubject$.next(this._objectStore); + // let fa = this.formg.get('formarray'); + // res.forEach(r => fa.push(this.createRowFormGroup(r))); + // return res; + // }) + // ); + return of(ELEMENT_DATA).pipe( + map(res => { + res.forEach(m => this._objectStore.push(m as FixBonus)); + this._ObjectsSubject$.next(this._objectStore); + let fa = this.formg.get('formarray'); + res.forEach(r => fa.push(this.createRowFormGroup(r))); + return res; + }) + ); + } + + createRowFormGroup(r: FixBonus): FormGroup { + let f = new FormGroup({ + gameType: this.createNewFormContorl(r, 'gameType'), + gameDescription: this.createNewFormContorl(r, 'gameDescription'), + userDescription: this.createNewFormContorl(r, 'userDescription'), + odds: this.createNewFormContorl(r, 'odds'), + folder: this.createNewFormContorl(r, 'folder'), + allow: this.createNewFormContorl(r, 'allow') + }); + return f; + } + + createNewFormContorl(r: FixBonus, propName: string): FormControl { + let m = new FormControl(r[propName], Validators.required); + m.valueChanges.subscribe(val => { + r[propName] = val; + }); + return m; + } + + disconnect(collectionViewer: CollectionViewer): void { + this._ObjectsSubject$.complete(); + this._loadingSubject$.complete(); + } +} diff --git a/src/modules/special/fix-bonus/service/fix-bonus.service.ts b/src/modules/special/fix-bonus/service/fix-bonus.service.ts index fcc768f..2ef6af8 100644 --- a/src/modules/special/fix-bonus/service/fix-bonus.service.ts +++ b/src/modules/special/fix-bonus/service/fix-bonus.service.ts @@ -15,4 +15,8 @@ export class FixBonusService { @Inject(API_BASE_URL) private apiBaseUrl: string, private httpClient: HttpClient ) {} + + public getAll(): Observable { + return this.httpClient.get(`${this.apiBaseUrl}/fix_bonus`, {}); + } }