bet-history
This commit is contained in:
parent
6dff6de9bd
commit
de2ec9e203
|
@ -5,8 +5,8 @@ import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
import { CollectionViewer } from '@angular/cdk/collections';
|
import { CollectionViewer } from '@angular/cdk/collections';
|
||||||
|
|
||||||
import { BetHistory } from 'src/modules/infos/popup-set/model/popup-set.model';
|
import { BetHistory } from 'src/modules/game/model/bet-history.model';
|
||||||
import { BetHistoryService } from 'src/modules/infos/popup-set/service/popup-set.service';
|
import { BetHistoryService } from 'src/modules/game/service/bet-historyservice';
|
||||||
|
|
||||||
import { FormControl, FormGroup, Validators, FormArray } from '@angular/forms';
|
import { FormControl, FormGroup, Validators, FormArray } from '@angular/forms';
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ const ELEMENT_DATA: BetHistory[] = [
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
export class PopupSetDataSource extends DataSource<BetHistory> {
|
export class BetHistoryDataSource extends DataSource<BetHistory> {
|
||||||
private _objectStore: BetHistory[] = [];
|
private _objectStore: BetHistory[] = [];
|
||||||
private _ObjectsSubject$ = new BehaviorSubject<BetHistory[]>([]);
|
private _ObjectsSubject$ = new BehaviorSubject<BetHistory[]>([]);
|
||||||
private _loadingSubject$ = new BehaviorSubject<boolean>(false);
|
private _loadingSubject$ = new BehaviorSubject<boolean>(false);
|
||||||
|
@ -57,7 +57,7 @@ export class PopupSetDataSource extends DataSource<BetHistory> {
|
||||||
public loading$ = this._loadingSubject$.asObservable();
|
public loading$ = this._loadingSubject$.asObservable();
|
||||||
public formg: FormGroup;
|
public formg: FormGroup;
|
||||||
|
|
||||||
constructor(private fixBonusService: PopupSetService) {
|
constructor(private betHistoryService: BetHistoryService) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ export class PopupSetDataSource extends DataSource<BetHistory> {
|
||||||
// );
|
// );
|
||||||
return of(ELEMENT_DATA).pipe(
|
return of(ELEMENT_DATA).pipe(
|
||||||
map(res => {
|
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);
|
this._ObjectsSubject$.next(this._objectStore);
|
||||||
let fa = <FormArray>this.formg.get('formarray');
|
let fa = <FormArray>this.formg.get('formarray');
|
||||||
res.forEach(r => fa.push(this.createRowFormGroup(r)));
|
res.forEach(r => fa.push(this.createRowFormGroup(r)));
|
||||||
|
@ -92,7 +92,7 @@ export class PopupSetDataSource extends DataSource<BetHistory> {
|
||||||
// openStatus: true,
|
// openStatus: true,
|
||||||
// updatedAt: null,
|
// updatedAt: null,
|
||||||
// createdAt: null
|
// createdAt: null
|
||||||
createRowFormGroup(r: PopupSet): FormGroup {
|
createRowFormGroup(r: BetHistory): FormGroup {
|
||||||
let f = new FormGroup({
|
let f = new FormGroup({
|
||||||
title: this.createNewFormContorl(r, 'title'),
|
title: this.createNewFormContorl(r, 'title'),
|
||||||
imageWidth: this.createNewFormContorl(r, 'imageWidth'),
|
imageWidth: this.createNewFormContorl(r, 'imageWidth'),
|
||||||
|
@ -104,7 +104,7 @@ export class PopupSetDataSource extends DataSource<BetHistory> {
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
createNewFormContorl(r: PopupSet, propName: string): FormControl {
|
createNewFormContorl(r: BetHistory, propName: string): FormControl {
|
||||||
let m = new FormControl(r[propName], Validators.required);
|
let m = new FormControl(r[propName], Validators.required);
|
||||||
m.valueChanges.subscribe(val => {
|
m.valueChanges.subscribe(val => {
|
||||||
r[propName] = val;
|
r[propName] = val;
|
||||||
|
|
13
src/modules/game/model/bet-history.model.ts
Normal file
13
src/modules/game/model/bet-history.model.ts
Normal file
|
@ -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;
|
||||||
|
}
|
26
src/modules/game/service/bet-historyservice.ts
Normal file
26
src/modules/game/service/bet-historyservice.ts
Normal file
|
@ -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<Page<BankInfo>> {
|
||||||
|
// return this.httpClient.get<Page<BankInfo>>(
|
||||||
|
// `${this.apiBaseUrl}/bank_info`,
|
||||||
|
// {}
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
}
|
|
@ -1,3 +1,3 @@
|
||||||
import { LeagueService } from './league.service';
|
import { LeagueService } from './league.service';
|
||||||
|
import { BetHistoryService } from './bet-historyservice';
|
||||||
export const SERVICES = [LeagueService];
|
export const SERVICES = [LeagueService, BetHistoryService];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user