From b9d10d35868f38d88e6e3004931579d10bdad6c3 Mon Sep 17 00:00:00 2001 From: Park Byung Eun Date: Wed, 3 Aug 2022 10:09:54 +0000 Subject: [PATCH] =?UTF-8?q?=EB=A3=A8=EC=A7=95=20=EB=A6=AC=ED=8F=AC?= =?UTF-8?q?=ED=84=B0=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?=EB=B0=8F=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/mock-api/apps/report/loosing/api.ts | 32 +- src/app/mock-api/apps/report/loosing/data.ts | 203 ++++++++++- .../admin/report/loosing/components/index.ts | 5 +- .../loosing/components/list.component.html | 4 +- .../loosing/components/list.component.ts | 9 +- ....component.html => view-01.component.html} | 22 +- ...view.component.ts => view-01.component.ts} | 16 +- .../loosing/components/view-02.component.html | 314 ++++++++++++++++++ .../loosing/components/view-02.component.ts | 167 ++++++++++ .../admin/report/loosing/loosing.routing.ts | 14 +- .../report/loosing/models/bet-calculate.ts | 3 + .../report/loosing/models/loosing-report.ts | 1 + .../loosing/resolvers/loosing.resolver.ts | 5 +- .../loosing/services/loosing.service.ts | 7 +- 14 files changed, 772 insertions(+), 30 deletions(-) rename src/app/modules/admin/report/loosing/components/{view.component.html => view-01.component.html} (94%) rename src/app/modules/admin/report/loosing/components/{view.component.ts => view-01.component.ts} (91%) create mode 100644 src/app/modules/admin/report/loosing/components/view-02.component.html create mode 100644 src/app/modules/admin/report/loosing/components/view-02.component.ts diff --git a/src/app/mock-api/apps/report/loosing/api.ts b/src/app/mock-api/apps/report/loosing/api.ts index 85343a3..f1bf097 100644 --- a/src/app/mock-api/apps/report/loosing/api.ts +++ b/src/app/mock-api/apps/report/loosing/api.ts @@ -3,7 +3,8 @@ import { assign, cloneDeep } from 'lodash-es'; import { FuseMockApiService, FuseMockApiUtils } from '@fuse/lib/mock-api'; import { loosings as loosingsData, - loosingReports as loosingReportsData, + loosing01Reports as loosing01ReportsData, + loosing02Reports as loosing02ReportsData, } from './data'; @Injectable({ @@ -11,7 +12,8 @@ import { }) export class ReportLoosingMockApi { private _loosings: any[] = loosingsData; - private _loosingReports: any[] = loosingReportsData; + private _loosing01Reports: any[] = loosing01ReportsData; + private _loosing02Reports: any[] = loosing02ReportsData; /** * Constructor */ @@ -107,15 +109,37 @@ export class ReportLoosingMockApi { .reply(({ request }) => { // Get the id from the params const id = request.params.get('id'); + const type = request.params.get('type'); + let result; // Clone the loosings - const loosingReports = cloneDeep(this._loosingReports); + if (type === '1') { + result = cloneDeep(this._loosing01Reports); + } else { + result = cloneDeep(this._loosing02Reports); + } // Find the loosing // const loosing = loosings.find((item: any) => item.id === id); // Return the response - return [200, loosingReports]; + return [200, result]; + }); + + this._fuseMockApiService + .onGet('api/apps/report/loosing/loosing/02') + .reply(({ request }) => { + // Get the id from the params + const id = request.params.get('id'); + + // Clone the loosings + const loosing02Reports = cloneDeep(this._loosing02Reports); + + // Find the loosing + // const loosing = loosings.find((item: any) => item.id === id); + + // Return the response + return [200, loosing02Reports]; }); // ----------------------------------------------------------------------------------------------------- diff --git a/src/app/mock-api/apps/report/loosing/data.ts b/src/app/mock-api/apps/report/loosing/data.ts index 88bb12d..e4f4b5e 100644 --- a/src/app/mock-api/apps/report/loosing/data.ts +++ b/src/app/mock-api/apps/report/loosing/data.ts @@ -27,7 +27,7 @@ export const loosings = [ }, ]; -export const loosingReports = [ +export const loosing01Reports = [ { id: 'lossingReports_1', parentId: '0', @@ -245,3 +245,204 @@ export const loosingReports = [ }, }, ]; + +export const loosing02Reports = [ + { + id: 'lossingReports_1', + parentId: '0', + signinId: 'kgon1', + code: 'AAA', + depth: 0, + rank: '본사', + totalCalculate: '-55,388', + casinoReport: { + id: '1', + betWinLossMoneny: '1,100', + rollingMoney: '2,340', + rollingBottomMoney: '1,755', + rollingMeMoney: '585', + profitLossMoney: '-1,240', + loosingRate: '50%', + meMoney: '-620', + bottomMoney: '33', + calculateMoney: '-105,700', + }, + slotReport: { + id: '2', + betWinLossMoneny: '1,100', + rollingMoney: '2,340', + rollingBottomMoney: '1,755', + rollingMeMoney: '585', + profitLossMoney: '-1,240', + loosingRate: '50%', + meMoney: '-620', + bottomMoney: '33', + calculateMoney: '-105,700', + }, + }, + { + id: 'lossingReports_2', + parentId: 'lossingReports_1', + signinId: 'kgon2', + code: 'AAAAA', + depth: 1, + rank: '대본', + totalCalculate: '-55,388', + casinoReport: { + id: '1', + betWinLossMoneny: '1,100', + rollingMoney: '2,340', + rollingBottomMoney: '1,755', + rollingMeMoney: '585', + profitLossMoney: '-1,240', + loosingRate: '50%', + meMoney: '-620', + bottomMoney: '33', + calculateMoney: '-105,700', + }, + slotReport: { + id: '2', + betWinLossMoneny: '1,100', + rollingMoney: '2,340', + rollingBottomMoney: '1,755', + rollingMeMoney: '585', + profitLossMoney: '-1,240', + loosingRate: '50%', + meMoney: '-620', + bottomMoney: '33', + calculateMoney: '-105,700', + }, + }, + { + id: 'lossingReports_3', + parentId: 'lossingReports_2', + signinId: 'kgon2', + code: 'AAAAA', + depth: 1, + rank: '부본', + totalCalculate: '-55,388', + casinoReport: { + id: '1', + betWinLossMoneny: '1,100', + rollingMoney: '2,340', + rollingBottomMoney: '1,755', + rollingMeMoney: '585', + profitLossMoney: '-1,240', + loosingRate: '50%', + meMoney: '-620', + bottomMoney: '33', + calculateMoney: '-105,700', + }, + slotReport: { + id: '2', + betWinLossMoneny: '1,100', + rollingMoney: '2,340', + rollingBottomMoney: '1,755', + rollingMeMoney: '585', + profitLossMoney: '-1,240', + loosingRate: '50%', + meMoney: '-620', + bottomMoney: '33', + calculateMoney: '-105,700', + }, + }, + { + id: 'lossingReports_4', + parentId: '0', + signinId: 'test1', + code: 'AAAB', + depth: 0, + rank: '본사', + totalCalculate: '-55,388', + casinoReport: { + id: '1', + betWinLossMoneny: '1,100', + rollingMoney: '2,340', + rollingBottomMoney: '1,755', + rollingMeMoney: '585', + profitLossMoney: '-1,240', + loosingRate: '50%', + meMoney: '-620', + bottomMoney: '33', + calculateMoney: '-105,700', + }, + slotReport: { + id: '2', + betWinLossMoneny: '1,100', + rollingMoney: '2,340', + rollingBottomMoney: '1,755', + rollingMeMoney: '585', + profitLossMoney: '-1,240', + loosingRate: '50%', + meMoney: '-620', + bottomMoney: '33', + calculateMoney: '-105,700', + }, + }, + { + id: 'lossingReports_5', + parentId: 'lossingReports_4', + signinId: 'kgon2', + code: 'AAAAA', + depth: 1, + rank: '대본', + totalCalculate: '-55,388', + casinoReport: { + id: '1', + betWinLossMoneny: '1,100', + rollingMoney: '2,340', + rollingBottomMoney: '1,755', + rollingMeMoney: '585', + profitLossMoney: '-1,240', + loosingRate: '50%', + meMoney: '-620', + bottomMoney: '33', + calculateMoney: '-105,700', + }, + slotReport: { + id: '2', + betWinLossMoneny: '1,100', + rollingMoney: '2,340', + rollingBottomMoney: '1,755', + rollingMeMoney: '585', + profitLossMoney: '-1,240', + loosingRate: '50%', + meMoney: '-620', + bottomMoney: '33', + calculateMoney: '-105,700', + }, + }, + { + id: 'lossingReports_6', + parentId: 'lossingReports_5', + signinId: 'kgon2', + code: 'AAAAA', + depth: 1, + rank: '부본', + totalCalculate: '-55,388', + casinoReport: { + id: '1', + betWinLossMoneny: '1,100', + rollingMoney: '2,340', + rollingBottomMoney: '1,755', + rollingMeMoney: '585', + profitLossMoney: '-1,240', + loosingRate: '50%', + meMoney: '-620', + bottomMoney: '33', + calculateMoney: '-105,700', + }, + slotReport: { + id: '2', + betWinLossMoneny: '1,100', + rollingMoney: '2,340', + rollingBottomMoney: '1,755', + rollingMeMoney: '585', + profitLossMoney: '-1,240', + loosingRate: '50%', + meMoney: '-620', + bottomMoney: '33', + calculateMoney: '-105,700', + }, + }, +]; diff --git a/src/app/modules/admin/report/loosing/components/index.ts b/src/app/modules/admin/report/loosing/components/index.ts index 4e9e32b..2743e40 100644 --- a/src/app/modules/admin/report/loosing/components/index.ts +++ b/src/app/modules/admin/report/loosing/components/index.ts @@ -1,4 +1,5 @@ import { ListComponent } from './list.component'; -import { ViewComponent } from './view.component'; +import { View01Component } from './view-01.component'; +import { View02Component } from './view-02.component'; -export const COMPONENTS = [ListComponent, ViewComponent]; +export const COMPONENTS = [ListComponent, View01Component, View02Component]; diff --git a/src/app/modules/admin/report/loosing/components/list.component.html b/src/app/modules/admin/report/loosing/components/list.component.html index 06284e0..3ce66a5 100644 --- a/src/app/modules/admin/report/loosing/components/list.component.html +++ b/src/app/modules/admin/report/loosing/components/list.component.html @@ -123,7 +123,7 @@ mat-flat-button class="bet-mat-small-8" [color]="'primary'" - (click)="__viewLoosingDetail(info, '0')" + (click)="__viewLoosingDetail(info, '1')" > 상세보기 상세보기 목록으로 @@ -31,7 +31,7 @@ mat-flat-button [color]="'primary'" fxFlex - (click)="__createProduct()" + (click)="__onClickNext($event)" > 루징데이터보기 @@ -39,18 +39,21 @@ -
+
- + - + - + - + @@ -231,6 +234,7 @@ *matHeaderCellDef aria-label="row actions" [attr.rowspan]="2" + [attr.colspan]="2" style="border-left: 1px solid #e0e0e0; padding-left: 30px" >   diff --git a/src/app/modules/admin/report/loosing/components/view.component.ts b/src/app/modules/admin/report/loosing/components/view-01.component.ts similarity index 91% rename from src/app/modules/admin/report/loosing/components/view.component.ts rename to src/app/modules/admin/report/loosing/components/view-01.component.ts index 7c6b7e6..16fd99a 100644 --- a/src/app/modules/admin/report/loosing/components/view.component.ts +++ b/src/app/modules/admin/report/loosing/components/view-01.component.ts @@ -23,8 +23,8 @@ import { MatTableDataSource } from '@angular/material/table'; import { LoosingReport } from '../models/loosing-report'; @Component({ - selector: 'loosing-view', - templateUrl: './view.component.html', + selector: 'loosing-view-01', + templateUrl: './view-01.component.html', styles: [ /* language=SCSS */ ` @@ -49,12 +49,10 @@ import { LoosingReport } from '../models/loosing-report'; changeDetection: ChangeDetectionStrategy.OnPush, animations: fuseAnimations, }) -export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { +export class View01Component implements OnInit, AfterViewInit, OnDestroy { @ViewChild(MatPaginator) private _paginator!: MatPaginator; @ViewChild(MatSort) private _sort!: MatSort; - loosings$!: Observable; - isLoading = false; loosingDataSource: MatTableDataSource = new MatTableDataSource(); @@ -141,6 +139,14 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { */ __createProduct(): void {} + __onClickPrev(event: MouseEvent): void { + this._router.navigateByUrl('/report/loosing'); + } + + __onClickNext(event: MouseEvent): void { + this._router.navigateByUrl('/report/loosing/02/loosing_1?type=2'); + } + /** * Toggle product details * diff --git a/src/app/modules/admin/report/loosing/components/view-02.component.html b/src/app/modules/admin/report/loosing/components/view-02.component.html new file mode 100644 index 0000000..175d12f --- /dev/null +++ b/src/app/modules/admin/report/loosing/components/view-02.component.html @@ -0,0 +1,314 @@ +
+
+
+
+ +
+
+ 루징데이터 +
+ + +
+ +
+ + + + + +
+
+ +
+
@@ -58,18 +61,18 @@ 아이디 @@ -77,7 +80,7 @@ 코드
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + {{ info.signinId }} + + + 아이디 + + + {{ info.code }} + + + 코드 + 윈로스 + {{ + info.casinoReport.betWinLossMoneny + }} + 롤링 + + {{ info.casinoReport.rollingMoney }} +
+ {{ info.casinoReport.rollingBottomMoney }} +
+ {{ info.casinoReport.rollingMeMoney }} +
+
손익 + + {{ info.casinoReport.profitLossMoney }} + + 루징요율 + {{ + info.casinoReport.loosingRate + }} + 본인 + {{ + info.casinoReport.meMoney + }} + 하부 + {{ + info.casinoReport.bottomMoney + }} + 실정산금 + {{ + info.casinoReport.calculateMoney + }} + 윈로스 + {{ + info.slotReport.betWinLossMoneny + }} + 롤링 + + {{ info.slotReport.rollingMoney }} +
+ {{ info.slotReport.rollingBottomMoney }} +
+ {{ info.slotReport.rollingMeMoney }} +
+
손익 + + {{ info.slotReport.profitLossMoney }} + + 루징요율 + {{ + info.slotReport.loosingRate + }} + 본인 + {{ + info.slotReport.meMoney + }} + 하부 + {{ + info.slotReport.bottomMoney + }} + 실정산금 + {{ + info.slotReport.calculateMoney + }} + +   + + {{ + info.totalCalculate + }} + + 총실정산금 + + 카지노루징 + + 슬롯루징 +
+
+
+ + + + diff --git a/src/app/modules/admin/report/loosing/components/view-02.component.ts b/src/app/modules/admin/report/loosing/components/view-02.component.ts new file mode 100644 index 0000000..98e8234 --- /dev/null +++ b/src/app/modules/admin/report/loosing/components/view-02.component.ts @@ -0,0 +1,167 @@ +import { + AfterViewInit, + ChangeDetectionStrategy, + ChangeDetectorRef, + Component, + OnDestroy, + OnInit, + ViewChild, + ViewEncapsulation, +} from '@angular/core'; + +import { MatPaginator } from '@angular/material/paginator'; +import { MatSort } from '@angular/material/sort'; +import { map, merge, Observable, Subject, switchMap, takeUntil } from 'rxjs'; +import { fuseAnimations } from '@fuse/animations'; +import { FuseConfirmationService } from '@fuse/services/confirmation'; + +import { Loosing } from '../models/loosing'; + +import { LoosingService } from '../services/loosing.service'; +import { Router } from '@angular/router'; +import { MatTableDataSource } from '@angular/material/table'; +import { LoosingReport } from '../models/loosing-report'; + +@Component({ + selector: 'loosing-view-02', + templateUrl: './view-02.component.html', + styles: [ + /* language=SCSS */ + ` + .inventory-grid { + grid-template-columns: 60px auto 40px; + + @screen sm { + grid-template-columns: 40px 70px 70px 70px 70px 100px; + } + + @screen md { + grid-template-columns: 40px 70px 70px 70px 70px 100px; + } + + @screen lg { + grid-template-columns: 40px 70px 70px 70px 70px 100px; + } + } + `, + ], + encapsulation: ViewEncapsulation.None, + changeDetection: ChangeDetectionStrategy.OnPush, + animations: fuseAnimations, +}) +export class View02Component implements OnInit, AfterViewInit, OnDestroy { + @ViewChild(MatPaginator) private _paginator!: MatPaginator; + @ViewChild(MatSort) private _sort!: MatSort; + + loosings$!: Observable; + + isLoading = false; + + loosingDataSource: MatTableDataSource = new MatTableDataSource(); + + private _unsubscribeAll: Subject = new Subject(); + + displayedTableColumns: string[] = [ + 'userId', + 'userCode', + 'casinoWinLoss', + 'casinoRolling', + 'casinoProfitLoss', + 'casinoLoosing', + 'casinoSelf', + 'casinoBottom', + 'casinoCalculate', + 'slotWinLoss', + 'slotRolling', + 'slotSelf', + 'slotProfitLoss', + 'slotLoosing', + 'slotBottom', + 'slotCalculate', + 'totalCalculate', + ]; + + /** + * Constructor + */ + constructor( + private _changeDetectorRef: ChangeDetectorRef, + private _fuseConfirmationService: FuseConfirmationService, + private _loosingService: LoosingService, + private _router: Router + ) {} + + // ----------------------------------------------------------------------------------------------------- + // @ Lifecycle hooks + // ----------------------------------------------------------------------------------------------------- + + /** + * On init + */ + ngOnInit(): void { + // Get the products + this._loosingService.loosing$ + .pipe(takeUntil(this._unsubscribeAll)) + .subscribe((loosingReport: LoosingReport[] | undefined) => { + if (!loosingReport) { + return; + } + + this.loosingDataSource.data = loosingReport; + // Mark for check + this._changeDetectorRef.markForCheck(); + }); + } + + /** + * After view init + */ + ngAfterViewInit(): void {} + + /** + * On destroy + */ + ngOnDestroy(): void { + // Unsubscribe from all subscriptions + this._unsubscribeAll.next(null); + this._unsubscribeAll.complete(); + } + + // ----------------------------------------------------------------------------------------------------- + // @ Public methods + // ----------------------------------------------------------------------------------------------------- + + /* viewUserDetail(id: string): void { + let url: string = 'member/user/' + id; + this.router.navigateByUrl(url); + } */ + // ----------------------------------------------------------------------------------------------------- + // @ Private methods + // ----------------------------------------------------------------------------------------------------- + + /** + * Create product + */ + __createProduct(): void {} + + __onClickPrev(event: MouseEvent): void { + this._router.navigateByUrl('/report/loosing'); + } + + /** + * Toggle product details + * + * @param productId + */ + __toggleDetails(productId: string): void {} + + /** + * Track by function for ngFor loops + * + * @param index + * @param item + */ + __trackByFn(index: number, item: any): any { + return item.id || index; + } +} diff --git a/src/app/modules/admin/report/loosing/loosing.routing.ts b/src/app/modules/admin/report/loosing/loosing.routing.ts index 92c7c01..15b6c78 100644 --- a/src/app/modules/admin/report/loosing/loosing.routing.ts +++ b/src/app/modules/admin/report/loosing/loosing.routing.ts @@ -1,7 +1,8 @@ import { Route } from '@angular/router'; import { ListComponent } from './components/list.component'; -import { ViewComponent } from './components/view.component'; +import { View01Component } from './components/view-01.component'; +import { View02Component } from './components/view-02.component'; import { LoosingsResolver, @@ -17,8 +18,15 @@ export const loosingRoutes: Route[] = [ }, }, { - path: ':id', - component: ViewComponent, + path: '01/:id', + component: View01Component, + resolve: { + loosing: LoosingResolver, + }, + }, + { + path: '02/:id', + component: View02Component, resolve: { loosing: LoosingResolver, }, diff --git a/src/app/modules/admin/report/loosing/models/bet-calculate.ts b/src/app/modules/admin/report/loosing/models/bet-calculate.ts index 0c60cb0..6d472ce 100644 --- a/src/app/modules/admin/report/loosing/models/bet-calculate.ts +++ b/src/app/modules/admin/report/loosing/models/bet-calculate.ts @@ -11,4 +11,7 @@ export interface BetCalculate { rollingMeMoney?: string; loosingRate?: string; meMoney?: string; + profitLossMoney?: string; + bottomMoney?: string; + calculateMoney?: string; } diff --git a/src/app/modules/admin/report/loosing/models/loosing-report.ts b/src/app/modules/admin/report/loosing/models/loosing-report.ts index c7f1206..9175136 100644 --- a/src/app/modules/admin/report/loosing/models/loosing-report.ts +++ b/src/app/modules/admin/report/loosing/models/loosing-report.ts @@ -7,6 +7,7 @@ export interface LoosingReport { code?: string; depth?: number; rank?: string; + totalCalculate?: string; casinoCalculate?: BetCalculate; slotCalculate?: BetCalculate; } diff --git a/src/app/modules/admin/report/loosing/resolvers/loosing.resolver.ts b/src/app/modules/admin/report/loosing/resolvers/loosing.resolver.ts index 9a84bb5..e702848 100644 --- a/src/app/modules/admin/report/loosing/resolvers/loosing.resolver.ts +++ b/src/app/modules/admin/report/loosing/resolvers/loosing.resolver.ts @@ -39,7 +39,10 @@ export class LoosingResolver implements Resolve { state: RouterStateSnapshot ): Observable { return this._loosingService - .getLoosingById(route.paramMap.get('id') as string) + .getLoosingById( + route.paramMap.get('id') as string, + state.root.queryParamMap.get('type') as string + ) .pipe( // Error here means the requested product is not available catchError((error) => { diff --git a/src/app/modules/admin/report/loosing/services/loosing.service.ts b/src/app/modules/admin/report/loosing/services/loosing.service.ts index dea5ce1..5781088 100644 --- a/src/app/modules/admin/report/loosing/services/loosing.service.ts +++ b/src/app/modules/admin/report/loosing/services/loosing.service.ts @@ -107,10 +107,13 @@ export class LoosingService { /** * Get product by id */ - getLoosingById(id: string = '1'): Observable { + getLoosingById( + id: string = '1', + type: string = '1' + ): Observable { return this._httpClient .get('api/apps/report/loosing/loosing', { - params: { id }, + params: { id, type }, }) .pipe( tap((response: LoosingReport[]) => {