diff --git a/src/app/pages/games/game/component/bet-history.data-source.ts b/src/app/pages/games/game/component/bet-history.data-source.ts index bc6b46f..3548e90 100644 --- a/src/app/pages/games/game/component/bet-history.data-source.ts +++ b/src/app/pages/games/game/component/bet-history.data-source.ts @@ -5,8 +5,8 @@ import { map } from 'rxjs/operators'; import { CollectionViewer } from '@angular/cdk/collections'; -import { BetHistory } from 'src/modules/infos/popup-set/model/popup-set.model'; -import { BetHistoryService } from 'src/modules/infos/popup-set/service/popup-set.service'; +import { BetHistory } from 'src/modules/game/model/bet-history.model'; +import { BetHistoryService } from 'src/modules/game/service/bet-historyservice'; import { FormControl, FormGroup, Validators, FormArray } from '@angular/forms'; @@ -49,7 +49,7 @@ const ELEMENT_DATA: BetHistory[] = [ } ]; -export class PopupSetDataSource extends DataSource { +export class BetHistoryDataSource extends DataSource { private _objectStore: BetHistory[] = []; private _ObjectsSubject$ = new BehaviorSubject([]); private _loadingSubject$ = new BehaviorSubject(false); @@ -57,7 +57,7 @@ export class PopupSetDataSource extends DataSource { public loading$ = this._loadingSubject$.asObservable(); public formg: FormGroup; - constructor(private fixBonusService: PopupSetService) { + constructor(private betHistoryService: BetHistoryService) { super(); } @@ -73,7 +73,7 @@ export class PopupSetDataSource extends DataSource { // ); return of(ELEMENT_DATA).pipe( map(res => { - res.forEach(m => this._objectStore.push(m as PopupSet)); + res.forEach(m => this._objectStore.push(m as BetHistory)); this._ObjectsSubject$.next(this._objectStore); let fa = this.formg.get('formarray'); res.forEach(r => fa.push(this.createRowFormGroup(r))); @@ -92,7 +92,7 @@ export class PopupSetDataSource extends DataSource { // openStatus: true, // updatedAt: null, // createdAt: null - createRowFormGroup(r: PopupSet): FormGroup { + createRowFormGroup(r: BetHistory): FormGroup { let f = new FormGroup({ title: this.createNewFormContorl(r, 'title'), imageWidth: this.createNewFormContorl(r, 'imageWidth'), @@ -104,7 +104,7 @@ export class PopupSetDataSource extends DataSource { return f; } - createNewFormContorl(r: PopupSet, propName: string): FormControl { + createNewFormContorl(r: BetHistory, propName: string): FormControl { let m = new FormControl(r[propName], Validators.required); m.valueChanges.subscribe(val => { r[propName] = val; diff --git a/src/modules/game/model/bet-history.model.ts b/src/modules/game/model/bet-history.model.ts new file mode 100644 index 0000000..c841317 --- /dev/null +++ b/src/modules/game/model/bet-history.model.ts @@ -0,0 +1,13 @@ +import { DateAudit } from 'src/modules/common/data/model/audit'; + +export interface BetHistory extends DateAudit { + id?: number; + thumbNail?: string; + title?: string; + imageWidth?: number; + imageHeight?: number; + imageX?: number; + imageY?: number; + openStatus?: boolean; + popupEffect?: number; +} diff --git a/src/modules/game/service/bet-historyservice.ts b/src/modules/game/service/bet-historyservice.ts new file mode 100644 index 0000000..bd386f2 --- /dev/null +++ b/src/modules/game/service/bet-historyservice.ts @@ -0,0 +1,26 @@ +import { Injectable, Inject } from '@angular/core'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; + +import { Observable } from 'rxjs'; +import { map, takeUntil } from 'rxjs/operators'; +import { BetHistory } from '../model/bet-history.model'; +import { API_BASE_URL } from 'src/modules/common/type/injection-token.type'; +import { Page } from 'src/modules/common/data/model/page'; +import { FormArray } from '@angular/forms'; + +@Injectable({ + providedIn: 'root' +}) +export class BetHistoryService { + constructor( + @Inject(API_BASE_URL) private apiBaseUrl: string, + private httpClient: HttpClient + ) {} + + // public getBankInfos(): Observable> { + // return this.httpClient.get>( + // `${this.apiBaseUrl}/bank_info`, + // {} + // ); + // } +} diff --git a/src/modules/game/service/index.ts b/src/modules/game/service/index.ts index 0af720d..2a787af 100644 --- a/src/modules/game/service/index.ts +++ b/src/modules/game/service/index.ts @@ -1,3 +1,3 @@ import { LeagueService } from './league.service'; - -export const SERVICES = [LeagueService]; +import { BetHistoryService } from './bet-historyservice'; +export const SERVICES = [LeagueService, BetHistoryService];