From 8dfd81dd114bfc840606a49e9551a730917d3f1b Mon Sep 17 00:00:00 2001 From: JUNG YI DAM Date: Thu, 28 Jul 2022 13:03:40 +0000 Subject: [PATCH] =?UTF-8?q?=EA=B8=88=EC=9D=BC=EB=B0=B0=ED=8C=85=EC=9E=90?= =?UTF-8?q?=EB=AA=A9=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mock-api/apps/report/daily-partner/api.ts | 2 +- src/app/mock-api/apps/report/today-bet/api.ts | 56 +- .../mock-api/apps/report/today-bet/data.ts | 548 +--------------- .../services/daily-partner.service.ts | 2 +- .../monthly/components/list.component.html | 4 +- .../today-bet/components/list.component.html | 618 +++++++++--------- .../today-bet/components/list.component.ts | 148 ++--- .../report/today-bet/models/today-bet.ts | 62 +- .../today-bet/services/today-bet.service.ts | 15 +- 9 files changed, 506 insertions(+), 949 deletions(-) diff --git a/src/app/mock-api/apps/report/daily-partner/api.ts b/src/app/mock-api/apps/report/daily-partner/api.ts index 59556ec..6c6d045 100644 --- a/src/app/mock-api/apps/report/daily-partner/api.ts +++ b/src/app/mock-api/apps/report/daily-partner/api.ts @@ -29,7 +29,7 @@ export class ReportDailyPartnerMockApi { // @ DailyPartners - GET // ----------------------------------------------------------------------------------------------------- this._fuseMockApiService - .onGet('api/apps/report/daily-partner', 300) + .onGet('api/apps/report/daily-partners', 300) .reply(({ request }) => { // Get available queries const search = request.params.get('search'); diff --git a/src/app/mock-api/apps/report/today-bet/api.ts b/src/app/mock-api/apps/report/today-bet/api.ts index 583a03f..722e1f6 100644 --- a/src/app/mock-api/apps/report/today-bet/api.ts +++ b/src/app/mock-api/apps/report/today-bet/api.ts @@ -2,7 +2,6 @@ import { Injectable } from '@angular/core'; import { assign, cloneDeep } from 'lodash-es'; import { FuseMockApiService, FuseMockApiUtils } from '@fuse/lib/mock-api'; import { todayBets as todayBetsData } from './data'; -import { contacts } from '../../chat/data'; @Injectable({ providedIn: 'root', @@ -34,12 +33,29 @@ export class ReportTodayBetMockApi { .reply(({ request }) => { // Get available queries const search = request.params.get('search'); - const sort = request.params.get('sort') || 'name'; + const sort = request.params.get('sort') || 'signinId'; const order = request.params.get('order') || 'asc'; + const page = parseInt(request.params.get('page') ?? '1', 10); + const size = parseInt(request.params.get('size') ?? '10', 10); // Clone the todayBets let todayBets: any[] | null = cloneDeep(this._todayBets); + // Sort the todayBets + if (sort === 'signinId' || sort === 'nickname' || sort === 'rank') { + todayBets.sort((a, b) => { + const fieldA = a[sort].toString().toUpperCase(); + const fieldB = b[sort].toString().toUpperCase(); + return order === 'asc' + ? fieldA.localeCompare(fieldB) + : fieldB.localeCompare(fieldA); + }); + } else { + todayBets.sort((a, b) => + order === 'asc' ? a[sort] - b[sort] : b[sort] - a[sort] + ); + } + // If search exists... if (search) { // Filter the todayBets @@ -50,11 +66,47 @@ export class ReportTodayBetMockApi { ); } + // Paginate - Start + const todayBetsLength = todayBets.length; + + // Calculate pagination details + const begin = page * size; + const end = Math.min(size * (page + 1), todayBetsLength); + const lastPage = Math.max(Math.ceil(todayBetsLength / size), 1); + + // Prepare the pagination object + let pagination = {}; + + // If the requested page number is bigger than + // the last possible page number, return null for + // todayBets but also send the last possible page so + // the app can navigate to there + if (page > lastPage) { + todayBets = null; + pagination = { + lastPage, + }; + } else { + // Paginate the results by size + todayBets = todayBets.slice(begin, end); + + // Prepare the pagination mock-api + pagination = { + length: todayBetsLength, + size: size, + page: page, + lastPage: lastPage, + startIndex: begin, + endIndex: end - 1, + }; + } + // Return the response return [ 200, { todayBets, + pagination, }, ]; }); diff --git a/src/app/mock-api/apps/report/today-bet/data.ts b/src/app/mock-api/apps/report/today-bet/data.ts index d998fcd..caeba1f 100644 --- a/src/app/mock-api/apps/report/today-bet/data.ts +++ b/src/app/mock-api/apps/report/today-bet/data.ts @@ -2,518 +2,40 @@ export const todayBets = [ { - user: { - id: '1', - signinId: 'kgon1', - type: '본사', - parentId: 0, - rank: '회원', - level: '4', - nickname: 'aa100', - }, - bank: { - users: { - deposit: '0', - withdraw: '0', - netProfit: 0, - }, - parthners: { - deposit: '0', - withdraw: '0', - netProfit: '0', - }, - totalNetProfit: '0', - passiveMoney: '0', - passiveComp: '0', - casino: { - betting: '382,000', - bettingTie: '33,000', - bettingCancel: '0', - bettingValid: '351,000', - bettingWin: '357,050', - winLoss: '26,950', - commission: { - total: '7,020', - partner: '5,265', - me: '1,755', - }, - betWinSettle: '19,930', - }, - slot: { - betting: '382,000', - bettingCancel: '0', - bettingValid: '351,000', - bettingWin: '357,050', - winLoss: '26,950', - commission: { - total: '7,020', - partner: '5,265', - me: '1,755', - }, - betWinSettle: '19,930', - }, - powerball: { - betting: '0', - bettingCancel: '0', - bettingValid: '0', - bettingWin: '0', - winLoss: '0', - commission: { - total: '0', - partner: '0', - me: '0', - }, - betWinSettle: '19,930', - }, - }, - totalBetSettle: '119,400', - }, - { - user: { - id: '2', - signinId: 'kgon2', - type: '대본', - parentId: 1, - }, - bank: { - users: { - deposit: '0', - withdraw: '0', - netProfit: 0, - }, - parthners: { - deposit: '0', - withdraw: '0', - netProfit: '0', - }, - totalNetProfit: '0', - passiveMoney: '0', - passiveComp: '0', - casino: { - betting: '382,000', - bettingTie: '33,000', - bettingCancel: '0', - bettingValid: '351,000', - bettingWin: '357,050', - winLoss: '26,950', - commission: { - total: '7,020', - partner: '5,265', - me: '1,755', - }, - betWinSettle: '19,930', - }, - slot: { - betting: '382,000', - bettingCancel: '0', - bettingValid: '351,000', - bettingWin: '357,050', - winLoss: '26,950', - commission: { - total: '7,020', - partner: '5,265', - me: '1,755', - }, - betWinSettle: '19,930', - }, - powerball: { - betting: '0', - bettingCancel: '0', - bettingValid: '0', - bettingWin: '0', - winLoss: '0', - commission: { - total: '0', - partner: '0', - me: '0', - }, - betWinSettle: '19,930', - }, - }, - totalBetSettle: '119,400', - }, - { - user: { - id: '3', - signinId: 'kgon1', - type: '본사', - parentId: 2, - }, - bank: { - users: { - deposit: '0', - withdraw: '0', - netProfit: 0, - }, - parthners: { - deposit: '0', - withdraw: '0', - netProfit: '0', - }, - totalNetProfit: '0', - passiveMoney: '0', - passiveComp: '0', - casino: { - betting: '382,000', - bettingTie: '33,000', - bettingCancel: '0', - bettingValid: '351,000', - bettingWin: '357,050', - winLoss: '26,950', - commission: { - total: '7,020', - partner: '5,265', - me: '1,755', - }, - betWinSettle: '19,930', - }, - slot: { - betting: '382,000', - bettingCancel: '0', - bettingValid: '351,000', - bettingWin: '357,050', - winLoss: '26,950', - commission: { - total: '7,020', - partner: '5,265', - me: '1,755', - }, - betWinSettle: '19,930', - }, - powerball: { - betting: '0', - bettingCancel: '0', - bettingValid: '0', - bettingWin: '0', - winLoss: '0', - commission: { - total: '0', - partner: '0', - me: '0', - }, - betWinSettle: '19,930', - }, - }, - totalBetSettle: '119,400', - }, - { - user: { - id: '4', - signinId: 'kgon1', - type: '부본', - parentId: 3, - }, - bank: { - users: { - deposit: '0', - withdraw: '0', - netProfit: 0, - }, - parthners: { - deposit: '0', - withdraw: '0', - netProfit: '0', - }, - totalNetProfit: '0', - passiveMoney: '0', - passiveComp: '0', - casino: { - betting: '382,000', - bettingTie: '33,000', - bettingCancel: '0', - bettingValid: '351,000', - bettingWin: '357,050', - winLoss: '26,950', - commission: { - total: '7,020', - partner: '5,265', - me: '1,755', - }, - betWinSettle: '19,930', - }, - slot: { - betting: '382,000', - bettingCancel: '0', - bettingValid: '351,000', - bettingWin: '357,050', - winLoss: '26,950', - commission: { - total: '7,020', - partner: '5,265', - me: '1,755', - }, - betWinSettle: '19,930', - }, - powerball: { - betting: '0', - bettingCancel: '0', - bettingValid: '0', - bettingWin: '0', - winLoss: '0', - commission: { - total: '0', - partner: '0', - me: '0', - }, - betWinSettle: '19,930', - }, - }, - totalBetSettle: '119,400', - }, - { - user: { - id: '5', - signinId: 'kgon1', - type: '본사', - parentId: 0, - }, - bank: { - users: { - deposit: '0', - withdraw: '0', - netProfit: 0, - }, - parthners: { - deposit: '0', - withdraw: '0', - netProfit: '0', - }, - totalNetProfit: '0', - passiveMoney: '0', - passiveComp: '0', - casino: { - betting: '382,000', - bettingTie: '33,000', - bettingCancel: '0', - bettingValid: '351,000', - bettingWin: '357,050', - winLoss: '26,950', - commission: { - total: '7,020', - partner: '5,265', - me: '1,755', - }, - betWinSettle: '19,930', - }, - slot: { - betting: '382,000', - bettingCancel: '0', - bettingValid: '351,000', - bettingWin: '357,050', - winLoss: '26,950', - commission: { - total: '7,020', - partner: '5,265', - me: '1,755', - }, - betWinSettle: '19,930', - }, - powerball: { - betting: '0', - bettingCancel: '0', - bettingValid: '0', - bettingWin: '0', - winLoss: '0', - commission: { - total: '0', - partner: '0', - me: '0', - }, - betWinSettle: '19,930', - }, - }, - totalBetSettle: '119,400', - }, - { - user: { - id: '6', - signinId: 'kgon1', - type: '본사', - parentId: 0, - }, - bank: { - users: { - deposit: '0', - withdraw: '0', - netProfit: 0, - }, - parthners: { - deposit: '0', - withdraw: '0', - netProfit: '0', - }, - totalNetProfit: '0', - passiveMoney: '0', - passiveComp: '0', - casino: { - betting: '382,000', - bettingTie: '33,000', - bettingCancel: '0', - bettingValid: '351,000', - bettingWin: '357,050', - winLoss: '26,950', - commission: { - total: '7,020', - partner: '5,265', - me: '1,755', - }, - betWinSettle: '19,930', - }, - slot: { - betting: '382,000', - bettingCancel: '0', - bettingValid: '351,000', - bettingWin: '357,050', - winLoss: '26,950', - commission: { - total: '7,020', - partner: '5,265', - me: '1,755', - }, - betWinSettle: '19,930', - }, - powerball: { - betting: '0', - bettingCancel: '0', - bettingValid: '0', - bettingWin: '0', - winLoss: '0', - commission: { - total: '0', - partner: '0', - me: '0', - }, - betWinSettle: '19,930', - }, - }, - totalBetSettle: '119,400', - }, - { - user: { - id: '7', - signinId: 'kgon1', - type: '본사', - parentId: 0, - }, - bank: { - users: { - deposit: '0', - withdraw: '0', - netProfit: 0, - }, - parthners: { - deposit: '0', - withdraw: '0', - netProfit: '0', - }, - totalNetProfit: '0', - passiveMoney: '0', - passiveComp: '0', - casino: { - betting: '382,000', - bettingTie: '33,000', - bettingCancel: '0', - bettingValid: '351,000', - bettingWin: '357,050', - winLoss: '26,950', - commission: { - total: '7,020', - partner: '5,265', - me: '1,755', - }, - betWinSettle: '19,930', - }, - slot: { - betting: '382,000', - bettingCancel: '0', - bettingValid: '351,000', - bettingWin: '357,050', - winLoss: '26,950', - commission: { - total: '7,020', - partner: '5,265', - me: '1,755', - }, - betWinSettle: '19,930', - }, - powerball: { - betting: '0', - bettingCancel: '0', - bettingValid: '0', - bettingWin: '0', - winLoss: '0', - commission: { - total: '0', - partner: '0', - me: '0', - }, - betWinSettle: '19,930', - }, - }, - totalBetSettle: '119,400', - }, - { - user: { - id: '8', - signinId: 'kgon1', - type: '본사', - parentId: 0, - }, - bank: { - users: { - deposit: '0', - withdraw: '0', - netProfit: 0, - }, - parthners: { - deposit: '0', - withdraw: '0', - netProfit: '0', - }, - totalNetProfit: '0', - passiveMoney: '0', - passiveComp: '0', - casino: { - betting: '382,000', - bettingTie: '33,000', - bettingCancel: '0', - bettingValid: '351,000', - bettingWin: '357,050', - winLoss: '26,950', - commission: { - total: '7,020', - partner: '5,265', - me: '1,755', - }, - betWinSettle: '19,930', - }, - slot: { - betting: '382,000', - bettingCancel: '0', - bettingValid: '351,000', - bettingWin: '357,050', - winLoss: '26,950', - commission: { - total: '7,020', - partner: '5,265', - me: '1,755', - }, - betWinSettle: '19,930', - }, - powerball: { - betting: '0', - bettingCancel: '0', - bettingValid: '0', - bettingWin: '0', - winLoss: '0', - commission: { - total: '0', - partner: '0', - me: '0', - }, - betWinSettle: '19,930', - }, - }, - totalBetSettle: '119,400', + id: '8fcce528-d878-4cc8-99f7-bd3451ed5402', + signinId: 'aa100', + rank: '회원', + level: '4', + nickname: 'aa100', + memberCharge: 40100000, + memberExchange: 19000000, + memberProfitLoss: 21100000, + partnerCharge: 0, + partnerExchange: 0, + partnerProfitLoss: 0, + totalProfitLoss: 21100000, + passiveMoney: -20002000, + passiveComp: 0, + casinoBetting: 13648000, + casinoTie: 314000, + casinoCancel: 0, + casinoAvailable: 13334000, + casinoWinning: 12649500, + casinoWinLoss: 998500, + casinoCommission: 83347, + casinoBetWinCalculate: 915153, + slotBetting: 1159511, + slotCancel: 0, + slotAvailable: 1159511, + slotWinning: 897768, + slotWinLoss: 261743, + slotCommission: 6800, + slotBetWinCalculate: 254943, + powerballBetting: 0, + powerballWinning: 0, + powerballWinLoss: 0, + powerballCommission: 0, + powerballBetWinCalculate: 0, + totalBetWinCalculate: 0, }, ]; diff --git a/src/app/modules/admin/report/daily-partner/services/daily-partner.service.ts b/src/app/modules/admin/report/daily-partner/services/daily-partner.service.ts index 166837d..1af2647 100644 --- a/src/app/modules/admin/report/daily-partner/services/daily-partner.service.ts +++ b/src/app/modules/admin/report/daily-partner/services/daily-partner.service.ts @@ -88,7 +88,7 @@ export class DailyPartnerService { .get<{ pagination: DailyPartnerPagination; dailyPartners: DailyPartner[]; - }>('api/apps/report/daily-partner/daily-partners', { + }>('api/apps/report/daily-partners', { params: { page: '' + page, size: '' + size, diff --git a/src/app/modules/admin/report/monthly/components/list.component.html b/src/app/modules/admin/report/monthly/components/list.component.html index 17a7572..29bb75c 100644 --- a/src/app/modules/admin/report/monthly/components/list.component.html +++ b/src/app/modules/admin/report/monthly/components/list.component.html @@ -7,9 +7,7 @@ class="sm:col-span-6 flex flex-col flex-auto p-6 bg-card shadow rounded-2xl overflow-hidden" > -
- CASINO 머니파악 -
+
월현황
+
+
+ +
+ +
+ + + + 전체 + 파워볼 + 카지노 + 슬롯 + + + + + 회원아이디 + 닉네임 + + + +
+ -
- 금일배팅자목록 -
-
- - -
- -
- - - - {{ - roleSelect.value | titlecase - }} - - - -
{{ role.label }}
-
-
-
-
-
- -
- - - - - -
- -
- - - - - -
- -
- - - - {{ - roleSelect.value | titlecase - }} - - - -
{{ role.label }}
-
-
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
등급 - - {{ info?.user.rank }} - - 레벨 - - {{ info?.user.level }} - - 아이디 - - {{ info?.user.signinId }} - - 닉네임 - - {{ info?.user.nickname }} - - 회원입출 - {{ info?.bank.users.deposit }} - {{ info?.bank.users.withdraw }} - {{ info?.bank.users.netProfit }} - 파트너입출 - {{ info?.bank.parthners.deposit }} - {{ info?.bank.parthners.withdraw }} - {{ info?.bank.parthners.netProfit }} - 총손익 - {{ info?.bank.totalNetProfit }} - 수동머니 - {{ info?.bank.passiveMoney }} - 수동콤프 - {{ info?.bank.passiveComp }} - 배팅 - {{ info?.bank.casino.betting }} - 당첨 - {{ info?.bank.casino.bettingWin }} - 윈로스(A) - {{ info?.bank.casino.winLoss }} - 수수료(B) - {{ info?.bank.casino.commission.total }} - 벳윈정산(A-B) - {{ info?.bank.casino.betWinSettle }} - 배팅 - {{ info?.bank.slot.betting }} - 당첨 - {{ info?.bank.slot.bettingWin }} - 윈로스(D) - {{ info?.bank.slot.winLoss }} - 수수료(E) - {{ info?.bank.slot.commission.total }} - 벳윈정산(A-B) - {{ info?.bank.slot.commission.betWinSettle }} - 배팅 - {{ info?.bank.powerball.betting }} - 당첨 - {{ info?.bank.powerball.bettingWin }} - 윈로스(G) - {{ info?.bank.powerball.winLoss }} - 수수료(H) - {{ info?.bank.powerball.commission.total }} - 벳윈정산(G-H) - {{ info?.bank.powerball.commission.betWinSettle }} - 총벳윈정산 - {{ info?.totalBetSettle }} - - Second group -
-
-
-
+ + + + +
+ +
+ + + + + +
+ + + + + + + +
+ +
+
+ +
+
+ +
+
+ +
+
+
+ + +
+ +
+ + +
+ +
+
+ 아이디 +
+ 닉네임 +
+
+ 등급 +
+ 레벨 +
+
회원입출금
+
파트너입출금
+ + + + + + + + + + + + + + + + + + + +
+ + + +
+
+ {{ todayBet.signinId }} +
+ {{ todayBet.nickname }} +
+
+ {{ todayBet.rank }} +
+ {{ todayBet.level }} +
+
+ 충전{{ todayBet.memberCharge }} +
+ 환전{{ todayBet.memberExchange }} +
+ 손익{{ todayBet.memberProfitLoss }} +
+
+ 충전{{ todayBet.partnerCharge }} +
+ 환전{{ todayBet.partnerExchange }} +
+ 손익{{ todayBet.partnerProfitLoss }} +
+ + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+
+ + +
+ There are no data! +
+
+
+
diff --git a/src/app/modules/admin/report/today-bet/components/list.component.ts b/src/app/modules/admin/report/today-bet/components/list.component.ts index 542cfb4..440eff0 100644 --- a/src/app/modules/admin/report/today-bet/components/list.component.ts +++ b/src/app/modules/admin/report/today-bet/components/list.component.ts @@ -34,7 +34,6 @@ import { TodayBet } from '../models/today-bet'; import { TodayBetPagination } from '../models/today-bet-pagination'; import { TodayBetService } from '../services/today-bet.service'; import { Router } from '@angular/router'; -import { MatTableDataSource } from '@angular/material/table'; @Component({ selector: 'today-bet-list', @@ -43,18 +42,22 @@ import { MatTableDataSource } from '@angular/material/table'; /* language=SCSS */ ` .inventory-grid { - grid-template-columns: 60px auto 40px; + /* 아이디 등급 회원 */ + grid-template-columns: 40px auto 30px; @screen sm { - grid-template-columns: 60px 60px 60px 60px 60px 60px auto 60px; + /* 아이디 등급 회원 파트너 손익 머니 콤프 카배팅 */ + grid-template-columns: 40px auto 30px 30px 30px 30px 30px 30px; } @screen md { - grid-template-columns: 60px 60px 60px 60px 60px 60px auto 60px 60px; + /* 아이디 등급 회원 파트너 손익 머니 콤프 카배팅 카당첨 */ + grid-template-columns: 40px auto 30px 30px 30px 30px 30px 30px 30px; } @screen lg { - grid-template-columns: 60px 70px 70px 70px 70px 100px 60px 60px auto 60px 60px 60px 60px; + /* 아이디 등급 회원 파트너 손익 머니 콤프 카배팅 카당첨 카윈로스 카수수료 카정산 슬배팅 슬당첨 슬윈로스 슬수수료 슬정산 파배팅 파당첨 파윈로스 파수수료 파정산 총정산 */ + grid-template-columns: 40px auto 30px 30px 30px 30px 30px 30px 30px 30px 30px 30px 30px 30px 30px 30px 30px 30px 30px 30px 30px 30px 30px; } } `, @@ -64,48 +67,20 @@ import { MatTableDataSource } from '@angular/material/table'; animations: fuseAnimations, }) export class ListComponent implements OnInit, AfterViewInit, OnDestroy { + @ViewChild(MatPaginator) private _paginator!: MatPaginator; + @ViewChild(MatSort) private _sort!: MatSort; + todayBets$!: Observable; users$!: Observable; + __isSearchOpened = false; isLoading = false; searchInputControl = new FormControl(); selectedTodayBet?: TodayBet; + pagination?: TodayBetPagination; - todayBetForm!: FormGroup; - - todayBetDataSource: MatTableDataSource = new MatTableDataSource(); - todayBetTableColumns: string[] = [ - 'rank', - 'level', - 'signinId', - 'nickname', - 'depositDetails', - 'depositPartnerDetails', - 'totalProfit', - 'passiveMoney', - 'passiveComp', - 'casinoBetDetails', - 'casinoWinningDetails', - 'casinoWinLoss', - 'casinoCommission', - 'casinoSettle', - 'slotBetDetails', - 'slotWinningDetails', - 'slotWinLoss', - 'slotCommission', - 'slotSettle', - 'powerballBetDetails', - 'powerballWinningDetails', - 'powerballWinLoss', - 'powerballCommission', - 'powerballSettle', - 'totalBetWinSettle', - ]; private _unsubscribeAll: Subject = new Subject(); - roles1: any[]; - roles2: any[]; - /** * Constructor */ @@ -115,36 +90,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { private _formBuilder: FormBuilder, private _todayBetService: TodayBetService, private router: Router - ) { - this.roles1 = [ - { - label: '전체', - value: '전체', - }, - { - label: '파워볼', - value: '파워볼', - }, - { - label: '카지노', - value: '카지노', - }, - { - label: '슬롯', - value: '슬롯', - }, - ]; - this.roles2 = [ - { - label: '회원아이디', - value: '회원아이디', - }, - { - label: '닉네임', - value: '닉네임', - }, - ]; - } + ) {} // ----------------------------------------------------------------------------------------------------- // @ Lifecycle hooks @@ -154,19 +100,14 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { * On init */ ngOnInit(): void { - this.todayBetForm = this._formBuilder.group({ - bankName: [''], - accountNumber: [''], - accountHolder: [''], - }); // Get the pagination - this._todayBetService - .getTodayBets() + this._todayBetService.pagination$ .pipe(takeUntil(this._unsubscribeAll)) - .subscribe((todayBets: any) => { + .subscribe((pagination: TodayBetPagination | undefined) => { + // Update the pagination + this.pagination = pagination; + // Mark for check - this.todayBetDataSource = todayBets.todayBets; - console.log(todayBets); this._changeDetectorRef.markForCheck(); }); @@ -177,7 +118,45 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { /** * After view init */ - ngAfterViewInit(): void {} + ngAfterViewInit(): void { + if (this._sort && this._paginator) { + // Set the initial sort + this._sort.sort({ + id: 'signinId', + start: 'asc', + disableClear: true, + }); + + // Mark for check + this._changeDetectorRef.markForCheck(); + + // If the todayBet changes the sort order... + this._sort.sortChange + .pipe(takeUntil(this._unsubscribeAll)) + .subscribe(() => { + // Reset back to the first page + this._paginator.pageIndex = 0; + }); + + // Get products if sort or page changes + merge(this._sort.sortChange, this._paginator.page) + .pipe( + switchMap(() => { + this.isLoading = true; + return this._todayBetService.getTodayBets( + this._paginator.pageIndex, + this._paginator.pageSize, + this._sort.active, + this._sort.direction + ); + }), + map(() => { + this.isLoading = false; + }) + ) + .subscribe(); + } + } /** * On destroy @@ -212,6 +191,14 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { */ __toggleDetails(productId: string): void {} + /** + * toggle the search + * Used in 'bar' + */ + __onClickSearch(): void { + this.__isSearchOpened = !this.__isSearchOpened; + } + /** * Track by function for ngFor loops * @@ -221,7 +208,4 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { __trackByFn(index: number, item: any): any { return item.id || index; } - __testData(info: any): any { - console.log(info); - } } diff --git a/src/app/modules/admin/report/today-bet/models/today-bet.ts b/src/app/modules/admin/report/today-bet/models/today-bet.ts index ff7c9ce..42936c7 100644 --- a/src/app/modules/admin/report/today-bet/models/today-bet.ts +++ b/src/app/modules/admin/report/today-bet/models/today-bet.ts @@ -1,29 +1,39 @@ +import { StringNullableChain } from 'lodash'; + export interface TodayBet { - id?: string; - totalPartnerCount?: number; - totalHoldingMoney?: number; - totalComp?: number; - total?: number; - branchCount?: number; - divisionCount?: number; - officeCount?: number; - storeCount?: number; - memberCount?: number; + id: string; + signinId?: string; + rank?: string; + level?: string; nickname?: string; - accountHolder?: string; - phoneNumber?: string; - calculateType?: string; - ownCash?: number; - ownComp?: number; - ownCoupon?: number; - gameMoney?: number; - todayComp?: number; - totalDeposit?: number; - totalWithdraw?: number; - balance?: number; - registDate?: string; - finalSigninDate?: string; - ip?: string; - state?: string; - note?: string; + memberCharge?: number; // 회원충전 + memberExchange?: number; // 회원환전 + memberProfitLoss?: number; // 회원손익 + partnerCharge?: number; // 파트너충전 + partnerExchange?: number; // 파트너환전 + partnerProfitLoss?: number; // 파트너손익 + totalProfitLoss?: number; // 전체손익 + passiveMoney?: number; + passiveComp?: number; + casinoBetting?: number; // 카지노배팅 + casinoTie?: number; // 카지노타이 + casinoCancel?: number; // 카지노취소 + casinoAvailable?: number; // 카지노유효 + casinoWinning?: number; // 카지노당첨 + casinoWinLoss?: number; // 카지노윈로스(A) + casinoCommission?: number; // 카지노수수료(B) + casinoBetWinCalculate?: number; // 카지노벳윈정산 (A-B) + slotBetting?: number; // 슬롯배팅 + slotCancel?: number; // 슬롯취소 + slotAvailable?: number; // 슬롯유효 + slotWinning?: number; // 슬롯당첨 + slotWinLoss?: number; // 슬롯윈로스(D) + slotCommission?: number; // 슬롯수수료(E) + slotBetWinCalculate?: number; // 슬롯벳윈정산(D-E) + powerballBetting?: number; // 파워볼배팅 + powerballWinning?: number; // 파워볼당첨 + powerballWinLoss?: number; // 파워볼윈로스(H) + powerballCommission?: number; // 파워볼수수료(I) + powerballBetWinCalculate?: number; // 파워볼벳윈정산(H-I) + totalBetWinCalculate?: number; // 총벳윈정산 } diff --git a/src/app/modules/admin/report/today-bet/services/today-bet.service.ts b/src/app/modules/admin/report/today-bet/services/today-bet.service.ts index 513819a..72b6ba6 100644 --- a/src/app/modules/admin/report/today-bet/services/today-bet.service.ts +++ b/src/app/modules/admin/report/today-bet/services/today-bet.service.ts @@ -70,19 +70,32 @@ export class TodayBetService { * @param order * @param search */ - getTodayBets(search: string = ''): Observable<{ + getTodayBets( + page: number = 0, + size: number = 10, + sort: string = 'name', + order: 'asc' | 'desc' | '' = 'asc', + search: string = '' + ): Observable<{ + pagination: TodayBetPagination; todayBets: TodayBet[]; }> { return this._httpClient .get<{ + pagination: TodayBetPagination; todayBets: TodayBet[]; }>('api/apps/report/today-bet/today-bets', { params: { + page: '' + page, + size: '' + size, + sort, + order, search, }, }) .pipe( tap((response) => { + this.__pagination.next(response.pagination); this.__todayBets.next(response.todayBets); }) );