고정보너스 디자인

This commit is contained in:
byung eun park 2019-09-20 16:50:54 +09:00
parent 55f84dccba
commit b4713392b1
6 changed files with 555 additions and 8 deletions

View File

@ -28,7 +28,7 @@ import { DashboardModule } from 'src/modules/dashboard/dashboard.module';
import { UserModule } from 'src/modules/user/user.module'; import { UserModule } from 'src/modules/user/user.module';
import { GameModule } from 'src/modules/game/game.module'; import { GameModule } from 'src/modules/game/game.module';
import { SitesModule } from 'src/modules/sites/sites.module'; import { SitesModule } from 'src/modules/sites/sites.module';
import { SpecialModule } from 'src/modules/special/special.module';
import { from } from 'rxjs'; import { from } from 'rxjs';
@NgModule({ @NgModule({
imports: [ imports: [
@ -61,7 +61,8 @@ import { from } from 'rxjs';
DashboardModule.forRoot(), DashboardModule.forRoot(),
UserModule.forRoot(), UserModule.forRoot(),
GameModule.forRoot(), GameModule.forRoot(),
SitesModule.forRoot() SitesModule.forRoot(),
SpecialModule.forRoot()
], ],
declarations: [AppComponent], declarations: [AppComponent],
providers: [], providers: [],

View File

@ -1 +1,158 @@
<p>fix-bonus works!</p> <div id="fix-bonus" class="page-layout simple fullwidth" fxLayout="column">
<!-- <div id="orders" class="page-layout carded fullwidth inner-scroll"> -->
<!-- HEADER -->
<div
class="header accent p-24 h-160"
fxLayout="row"
fxLayoutAlign="start center"
>
<div fxLayout="column" fxLayoutAlign="center start">
<div fxLayout="row" fxLayoutAlign="start center">
<mat-icon class="secondary-text s-18">home</mat-icon>
<mat-icon class="secondary-text s-16">chevron_right</mat-icon>
<span class="secondary-text">User Interface</span>
</div>
<div class="h1 mt-16">계좌분리 관리</div>
</div>
</div>
<!-- / HEADER -->
<!-- CONTENT -->
<div class="content p-24">
<div class="h1">
고정보너스
</div>
<div
class="mb-24"
fxLayout="column"
fxLayoutAlign="start"
fxLayout.gt-md="row"
>
<div
class="mat-elevation-z8 p-24 mr-24"
fxFlex="3 0 auto"
fxLayout="column"
>
<form
name="fixBonusForm"
[formGroup]="mtformgroup"
(ngSubmit)="fixBonusUpdate()"
novalidate
>
<mat-table
class="fix-bonus-table"
#table
[dataSource]="dataSource"
[@animateStagger]="{ value: '50' }"
matSort
formArrayName="formarray"
>
<!-- Game Type Column [formGroupName] -->
<ng-container matColumnDef="gameType">
<mat-header-cell *matHeaderCellDef>타입</mat-header-cell>
<mat-cell
*matCellDef="let fixBonus; let i = index"
[formGroupName]="i"
>{{ fixBonus.gameType }}</mat-cell
>
</ng-container>
<!-- Game Description Column -->
<ng-container matColumnDef="gameDescription">
<mat-header-cell *matHeaderCellDef>설명</mat-header-cell>
<mat-cell
*matCellDef="let fixBonus; let i = index"
[formGroupName]="i"
>
{{ fixBonus.gameDescription }}
</mat-cell>
</ng-container>
<!-- User Description Column -->
<ng-container matColumnDef="userDescription">
<mat-header-cell *matHeaderCellDef>설명</mat-header-cell>
<mat-cell
*matCellDef="let fixBonus; let i = index"
[formGroupName]="i"
>
<mat-form-field appearance="outline">
<input
name="inputUserDescription={{ fixBonus.userDescription }}"
matInput
type="text"
formControlName="userDescription"
/>
</mat-form-field>
</mat-cell>
</ng-container>
<!-- Odds Column -->
<ng-container matColumnDef="odds">
<mat-header-cell *matHeaderCellDef>배당설정</mat-header-cell>
<mat-cell
*matCellDef="let fixBonus; let i = index"
[formGroupName]="i"
>
<mat-form-field appearance="outline">
<input
name="inputHolder={{ fixBonus.odds }}"
matInput
type="text"
formControlName="odds"
/>
</mat-form-field>
</mat-cell>
</ng-container>
<!-- Folder Column -->
<ng-container matColumnDef="folder">
<mat-header-cell *matHeaderCellDef>폴더설정</mat-header-cell>
<mat-cell
*matCellDef="let fixBonus; let i = index"
[formGroupName]="i"
>
<mat-form-field appearance="outline">
<input
name="inputFolder={{ fixBonus.folder }}"
matInput
type="text"
formControlName="folder"
/>
</mat-form-field>
</mat-cell>
</ng-container>
<!-- Allow Column -->
<ng-container matColumnDef="allow">
<mat-header-cell *matHeaderCellDef>허용불가</mat-header-cell>
<mat-cell
*matCellDef="let fixBonus; let i = index"
[formGroupName]="i"
>
<mat-form-field appearance="outline">
<input
name="inputFolder={{ fixBonus.allow }}"
matInput
type="text"
formControlName="allow"
/>
</mat-form-field>
</mat-cell>
</ng-container>
<mat-header-row
*matHeaderRowDef="displayedColumns"
></mat-header-row>
<mat-row
*matRowDef="let row; columns: displayedColumns"
class="fix-bonus"
matRipple
></mat-row>
</mat-table>
</form>
</div>
</div>
</div>
<!-- / CONTENT -->
</div>

View File

@ -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%;
}
}
}

View File

@ -1,6 +1,7 @@
import { import {
Component, Component,
OnInit, OnInit,
OnDestroy,
ViewEncapsulation, ViewEncapsulation,
AfterViewInit, AfterViewInit,
ViewChild, ViewChild,
@ -19,6 +20,8 @@ import {
} from '@angular/forms'; } from '@angular/forms';
import { fuseAnimations } from 'src/@fuse/animations'; import { fuseAnimations } from 'src/@fuse/animations';
import { Observable, of, fromEvent, Subject, BehaviorSubject } from 'rxjs'; 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({ @Component({
selector: 'app-fix-bonus', selector: 'app-fix-bonus',
@ -27,7 +30,24 @@ import { Observable, of, fromEvent, Subject, BehaviorSubject } from 'rxjs';
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
animations: fuseAnimations 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<string> = new Subject<string>(); public inputChange$: Subject<string> = new Subject<string>();
public ClickedRowIndex: number = -1; public ClickedRowIndex: number = -1;
// public ClickedRow: cObject; currentRow: cObject; // public ClickedRow: cObject; currentRow: cObject;
@ -35,19 +55,28 @@ export class FixBonusComponent implements OnInit {
public mtformgroup: FormGroup; public mtformgroup: FormGroup;
public mtformarray: FormArray; public mtformarray: FormArray;
public dataSource;
@ViewChild('filter', { static: true }) @ViewChild('filter', { static: true })
filter: ElementRef; filter: ElementRef;
// Private // Private
private _unsubscribeAll: Subject<any>; private _unsubscribeAll: Subject<any>;
constructor(private fb: FormBuilder) {}
ngOnInit() { ngOnInit() {
this.mtformarray = this.fb.array([]); this.mtformarray = this.fb.array([]);
this.mtformgroup = this.fb.group({ formarray: this.mtformarray }); this.mtformgroup = this.fb.group({ formarray: this.mtformarray });
this.dataSource.formg = this.mtformgroup; this.dataSource.formg = this.mtformgroup;
} }
/**
* On destroy
*/
ngOnDestroy(): void {
// Unsubscribe from all subscriptions
this._unsubscribeAll.next();
this._unsubscribeAll.complete();
}
ngAfterViewInit(): void {}
fixBonusfoUpdate(): void {}
} }

View File

@ -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<FixBonus> {
private _objectStore: FixBonus[] = [];
private _ObjectsSubject$ = new BehaviorSubject<FixBonus[]>([]);
private _loadingSubject$ = new BehaviorSubject<boolean>(false);
public loading$ = this._loadingSubject$.asObservable();
public formg: FormGroup;
constructor(private fixBonusService: FixBonusService) {
super();
}
connect(collectionViewer: CollectionViewer): Observable<FixBonus[]> {
// return this.fixBonusService.getAll().pipe(
// map(res => {
// res.forEach(m => this._objectStore.push(m as FixBonus));
// this._ObjectsSubject$.next(this._objectStore);
// let fa = <FormArray>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 = <FormArray>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();
}
}

View File

@ -15,4 +15,8 @@ export class FixBonusService {
@Inject(API_BASE_URL) private apiBaseUrl: string, @Inject(API_BASE_URL) private apiBaseUrl: string,
private httpClient: HttpClient private httpClient: HttpClient
) {} ) {}
public getAll(): Observable<FixBonus[]> {
return this.httpClient.get<FixBonus[]>(`${this.apiBaseUrl}/fix_bonus`, {});
}
} }