기본설정 수정

This commit is contained in:
Park Byung Eun 2022-07-13 11:18:14 +00:00
parent 34f87467b1
commit c8b5293f7e
5 changed files with 170 additions and 166 deletions

View File

@ -7,7 +7,7 @@ import { basicSetting as basicSettingData } from './data';
providedIn: 'root', providedIn: 'root',
}) })
export class BasicSettingMockApi { export class BasicSettingMockApi {
private _basicSetting: any[] = basicSettingData; private _basicSetting: any = basicSettingData;
/** /**
* Constructor * Constructor

View File

@ -2,82 +2,53 @@
import { SiteStatusType } from 'app/modules/admin/settings/basic/types/site-status.type'; import { SiteStatusType } from 'app/modules/admin/settings/basic/types/site-status.type';
export const basicSetting = [ export const basicSetting = {
infos: [
{ {
siteStatus: SiteStatusType.joinAvailable, name: '사이트 ON/OFF 설정',
memo: '메모 테스트', content: SiteStatusType.joinAvailable,
},
{
name: '메모',
content: '메모 테스트',
},
],
earnSettings: [ earnSettings: [
{ {
lv1: [ level: 'LV1',
{ firstRate: '15',
earnFirst: { firstIsUse: true,
rate: '15', firstMaxEarnMoney: '10000',
isUse: true, everyRate: '15',
maxEarnMoney: '10000', everyIsUse: true,
}, everyMaxEarnMoney: '10000',
}, },
{ {
earnEvery: { level: 'LV2',
rate: '15', firstRate: '15',
isUse: true, firstIsUse: true,
maxEarnMoney: '10000', firstMaxEarnMoney: '10000',
}, everyRate: '15',
}, everyIsUse: true,
], everyMaxEarnMoney: '10000',
}, },
{ {
lv2: [ level: 'LV3',
{ firstRate: '15',
earnFirst: { firstIsUse: true,
rate: '15', firstMaxEarnMoney: '10000',
isUse: true, everyRate: '15',
maxEarnMoney: '10000', everyIsUse: true,
}, everyMaxEarnMoney: '10000',
}, },
{ {
earnEvery: { level: 'LV4',
rate: '15', firstRate: '15',
isUse: true, firstIsUse: true,
maxEarnMoney: '10000', firstMaxEarnMoney: '10000',
}, everyRate: '15',
}, everyIsUse: true,
], everyMaxEarnMoney: '10000',
},
{
lv3: [
{
earnFirst: {
rate: '15',
isUse: true,
maxEarnMoney: '10000',
},
},
{
earnEvery: {
rate: '15',
isUse: true,
maxEarnMoney: '10000',
},
},
],
},
{
lv4: [
{
earnFirst: {
rate: '15',
isUse: true,
maxEarnMoney: '10000',
},
},
{
earnEvery: {
rate: '15',
isUse: true,
maxEarnMoney: '10000',
},
},
],
}, },
], ],
gameSetting: [ gameSetting: [
@ -124,9 +95,8 @@ export const basicSetting = [
description: '5분마다 정산내용 DB저장', description: '5분마다 정산내용 DB저장',
}, },
], ],
}, };
// siteStatus?: SiteStatusType; // siteStatus?: SiteStatusType;
// memo?: string; // memo?: string;
// earnSetting?: any; // earnSetting?: any;
// gameSetting?: any; // gameSetting?: any;
];

View File

@ -10,6 +10,7 @@ import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatRippleModule } from '@angular/material/core'; import { MatRippleModule } from '@angular/material/core';
import { MatSortModule } from '@angular/material/sort'; import { MatSortModule } from '@angular/material/sort';
import { MatSelectModule } from '@angular/material/select'; import { MatSelectModule } from '@angular/material/select';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { MatTooltipModule } from '@angular/material/tooltip'; import { MatTooltipModule } from '@angular/material/tooltip';
import { MatTableModule } from '@angular/material/table'; import { MatTableModule } from '@angular/material/table';
import { MatMenuModule } from '@angular/material/menu'; import { MatMenuModule } from '@angular/material/menu';
@ -43,6 +44,7 @@ import { basicSettingRoutes } from './basic.routing';
MatTableModule, MatTableModule,
MatMenuModule, MatMenuModule,
MatDividerModule, MatDividerModule,
MatSlideToggleModule,
], ],
}) })
export class BasicModule {} export class BasicModule {}

View File

@ -13,14 +13,14 @@
<table <table
class="min-w-240 overflow-y-visible" class="min-w-240 overflow-y-visible"
mat-table mat-table
[dataSource]="currentUserDataSource" [dataSource]="basicInfoSettingDataSource"
> >
<!-- Total --> <!-- Total -->
<ng-container matColumnDef="info"> <ng-container matColumnDef="info">
<th mat-header-cell *matHeaderCellDef>정보</th> <th mat-header-cell *matHeaderCellDef>정보</th>
<td mat-cell *matCellDef="let user"> <td mat-cell *matCellDef="let info">
<span class="font-medium text-right"> <span class="font-medium text-right">
{{ user.highRank }} {{ info.name }}
</span> </span>
</td> </td>
</ng-container> </ng-container>
@ -28,16 +28,16 @@
<!-- Expenses amount --> <!-- Expenses amount -->
<ng-container matColumnDef="description"> <ng-container matColumnDef="description">
<th mat-header-cell *matHeaderCellDef>내용</th> <th mat-header-cell *matHeaderCellDef>내용</th>
<td mat-cell *matCellDef="let user"> <td mat-cell *matCellDef="let info">{{ info.content }}</td>
{{ user.rank }}
</td>
</ng-container> </ng-container>
<!-- Expenses amount --> <!-- Expenses amount -->
<ng-container matColumnDef="updateBtn"> <ng-container matColumnDef="updateBtn">
<th mat-header-cell *matHeaderCellDef>수정</th> <th mat-header-cell *matHeaderCellDef>수정</th>
<td mat-cell *matCellDef="let user"> <td mat-cell *matCellDef="let basicSetting">
{{ user.rank }} <div class="hidden sm:block truncate">
<button mat-flat-button [color]="'primary'">수정</button>
</div>
</td> </td>
</ng-container> </ng-container>
@ -63,14 +63,14 @@
<table <table
class="min-w-240 overflow-y-visible" class="min-w-240 overflow-y-visible"
mat-table mat-table
[dataSource]="currentUserDataSource" [dataSource]="basicEarnSettingDataSource"
> >
<!-- Type --> <!-- Type -->
<ng-container matColumnDef="level" sticky> <ng-container matColumnDef="level" sticky>
<th mat-header-cell *matHeaderCellDef>레벨</th> <th mat-header-cell *matHeaderCellDef>레벨</th>
<td mat-cell *matCellDef="let user"> <td mat-cell *matCellDef="let earn">
<span class="flex items-center"> <span class="flex items-center">
{{ user.level }} {{ earn.level }}
</span> </span>
</td> </td>
</ng-container> </ng-container>
@ -78,9 +78,9 @@
<!-- Total --> <!-- Total -->
<ng-container matColumnDef="firstRate"> <ng-container matColumnDef="firstRate">
<th mat-header-cell *matHeaderCellDef>요율</th> <th mat-header-cell *matHeaderCellDef>요율</th>
<td mat-cell *matCellDef="let user"> <td mat-cell *matCellDef="let earn">
<span class="font-medium text-right"> <span class="font-medium text-right">
{{ user.highRank }} {{ earn.firstRate }}
</span> </span>
</td> </td>
</ng-container> </ng-container>
@ -88,39 +88,47 @@
<!-- Expenses amount --> <!-- Expenses amount -->
<ng-container matColumnDef="firstIsUse"> <ng-container matColumnDef="firstIsUse">
<th mat-header-cell *matHeaderCellDef>사용여부</th> <th mat-header-cell *matHeaderCellDef>사용여부</th>
<td mat-cell *matCellDef="let user"> <td mat-cell *matCellDef="let earn">
{{ user.rank }} <div class="sm:col-span-4 flex items-center justify-between">
<mat-slide-toggle
class="ml-4"
[color]="'primary'"
[formControlName]="'twoStep'"
#twoStepToggle
>
</mat-slide-toggle>
</div>
</td> </td>
</ng-container> </ng-container>
<!-- Expenses percentage --> <!-- Expenses percentage -->
<ng-container matColumnDef="firstMaxMoney"> <ng-container matColumnDef="firstMaxMoney">
<th mat-header-cell *matHeaderCellDef>최대금액</th> <th mat-header-cell *matHeaderCellDef>최대금액</th>
<td mat-cell *matCellDef="let user"> <td mat-cell *matCellDef="let earn">
{{ user.level }} {{ earn.firstMaxEarnMoney }}
</td> </td>
</ng-container> </ng-container>
<!-- Remaining amount --> <!-- Remaining amount -->
<ng-container matColumnDef="everyRate"> <ng-container matColumnDef="everyRate">
<th mat-header-cell *matHeaderCellDef>요율</th> <th mat-header-cell *matHeaderCellDef>요율</th>
<td mat-cell *matCellDef="let user"> <td mat-cell *matCellDef="let earn">
{{ user.signinId }} {{ earn.everyRate }}
</td> </td>
</ng-container> </ng-container>
<!-- Remaining percentage --> <!-- Remaining percentage -->
<ng-container matColumnDef="everyIsUse"> <ng-container matColumnDef="everyIsUse">
<th mat-header-cell *matHeaderCellDef>사용여부</th> <th mat-header-cell *matHeaderCellDef>사용여부</th>
<td mat-cell *matCellDef="let user"> <td mat-cell *matCellDef="let earn">
{{ user.nickname }} {{ earn.everyIsUse }}
</td> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="everyMaxMoney"> <ng-container matColumnDef="everyMaxMoney">
<th mat-header-cell *matHeaderCellDef>최대금액</th> <th mat-header-cell *matHeaderCellDef>최대금액</th>
<td mat-cell *matCellDef="let user"> <td mat-cell *matCellDef="let earn">
{{ user.currentLocation }} {{ earn.everyMaxEarnMoney }}
</td> </td>
</ng-container> </ng-container>
@ -155,15 +163,15 @@
<table <table
class="min-w-240 overflow-y-visible" class="min-w-240 overflow-y-visible"
mat-table mat-table
[dataSource]="currentUserDataSource" [dataSource]="basicGameSettingDataSource"
> >
<!-- Type --> <!-- Type -->
<ng-container matColumnDef="title" sticky> <ng-container matColumnDef="title" sticky>
<th mat-header-cell *matHeaderCellDef>제목</th> <th mat-header-cell *matHeaderCellDef>제목</th>
<td mat-cell *matCellDef="let user"> <td mat-cell *matCellDef="let game">
<span class="flex items-center"> <span class="flex items-center">
<span class="w-2 h-2 rounded-full"></span> <span class="w-2 h-2 rounded-full"></span>
<span class="ml-3 leading-4">{{ user.signinId }}</span> <span class="ml-3 leading-4">{{ game.name }}</span>
</span> </span>
</td> </td>
</ng-container> </ng-container>
@ -171,34 +179,42 @@
<!-- Total --> <!-- Total -->
<ng-container matColumnDef="isUse"> <ng-container matColumnDef="isUse">
<th mat-header-cell *matHeaderCellDef>사용여부</th> <th mat-header-cell *matHeaderCellDef>사용여부</th>
<td mat-cell *matCellDef="let user"> <td mat-cell *matCellDef="let game">
<span class="font-medium text-right"> <div class="sm:col-span-4 flex items-center justify-between">
{{ user.highRank }} <mat-slide-toggle
</span> class="ml-4"
[color]="'primary'"
[formControlName]="'twoStep'"
#twoStepToggle
>
</mat-slide-toggle>
</div>
</td> </td>
</ng-container> </ng-container>
<!-- Expenses amount --> <!-- Expenses amount -->
<ng-container matColumnDef="memo"> <ng-container matColumnDef="memo">
<th mat-header-cell *matHeaderCellDef>메모</th> <th mat-header-cell *matHeaderCellDef>메모</th>
<td mat-cell *matCellDef="let user"> <td mat-cell *matCellDef="let game">
{{ user.rank }} {{ game.memo }}
</td> </td>
</ng-container> </ng-container>
<!-- Expenses percentage --> <!-- Expenses percentage -->
<ng-container matColumnDef="description"> <ng-container matColumnDef="description">
<th mat-header-cell *matHeaderCellDef>내용</th> <th mat-header-cell *matHeaderCellDef>내용</th>
<td mat-cell *matCellDef="let user"> <td mat-cell *matCellDef="let game">
{{ user.level }} {{ game.description }}
</td> </td>
</ng-container> </ng-container>
<!-- Remaining amount --> <!-- Remaining amount -->
<ng-container matColumnDef="updateBtn"> <ng-container matColumnDef="updateBtn">
<th mat-header-cell *matHeaderCellDef>수정</th> <th mat-header-cell *matHeaderCellDef>수정</th>
<td mat-cell *matCellDef="let user"> <td mat-cell *matCellDef="let game">
{{ user.signinId }} <div class="hidden sm:block truncate">
<button mat-flat-button [color]="'primary'">수정</button>
</div>
</td> </td>
</ng-container> </ng-container>

View File

@ -89,7 +89,12 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
'updateBtn', 'updateBtn',
]; ];
currentUserDataSource: MatTableDataSource<any> = new MatTableDataSource(); basicInfoSettingDataSource: MatTableDataSource<any> =
new MatTableDataSource();
basicEarnSettingDataSource: MatTableDataSource<any> =
new MatTableDataSource();
basicGameSettingDataSource: MatTableDataSource<any> =
new MatTableDataSource();
basicSetting$!: Observable<BasicSetting | undefined>; basicSetting$!: Observable<BasicSetting | undefined>;
@ -115,6 +120,17 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
* On init * On init
*/ */
ngOnInit(): void { ngOnInit(): void {
// Get the products
this._basicService.basicSetting$
.pipe(takeUntil(this._unsubscribeAll))
.subscribe((basicSetting: any | undefined) => {
this.basicInfoSettingDataSource = basicSetting.infos;
this.basicEarnSettingDataSource = basicSetting.earnSettings;
this.basicGameSettingDataSource = basicSetting.gameSetting;
// Mark for check
this._changeDetectorRef.markForCheck();
});
// Get the products // Get the products
this.basicSetting$ = this._basicService.basicSetting$; this.basicSetting$ = this._basicService.basicSetting$;
} }