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" > -