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 4981939..59556ec 100644 --- a/src/app/mock-api/apps/report/daily-partner/api.ts +++ b/src/app/mock-api/apps/report/daily-partner/api.ts @@ -33,12 +33,32 @@ export class ReportDailyPartnerMockApi { .reply(({ request }) => { // Get available queries const search = request.params.get('search'); - const sort = request.params.get('sort') || 'name'; + const sort = request.params.get('sort') || 'lastDayHoldingMoney'; 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 dailyPartners let dailyPartners: any[] | null = cloneDeep(this._dailyPartners); + // Sort the dailys + if ( + sort === 'lastDayHoldingMoney' || + sort === 'memberCharge' || + sort === 'memberExchange' + ) { + dailyPartners.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 { + dailyPartners.sort((a, b) => + order === 'asc' ? a[sort] - b[sort] : b[sort] - a[sort] + ); + } // If search exists... if (search) { // Filter the dailyPartners @@ -49,6 +69,41 @@ export class ReportDailyPartnerMockApi { ); } + // Paginate - Start + const dailysLength = dailyPartners.length; + + // Calculate pagination details + const begin = page * size; + const end = Math.min(size * (page + 1), dailysLength); + const lastPage = Math.max(Math.ceil(dailysLength / size), 1); + + // Prepare the pagination object + let pagination = {}; + + // If the requested page number is bigger than + // the last possible page number, return null for + // dailys but also send the last possible page so + // the app can navigate to there + if (page > lastPage) { + dailyPartners = null; + pagination = { + lastPage, + }; + } else { + // Paginate the results by size + dailyPartners = dailyPartners.slice(begin, end); + + // Prepare the pagination mock-api + pagination = { + length: dailysLength, + size: size, + page: page, + lastPage: lastPage, + startIndex: begin, + endIndex: end - 1, + }; + } + // Return the response return [ 200, @@ -61,21 +116,21 @@ export class ReportDailyPartnerMockApi { // ----------------------------------------------------------------------------------------------------- // @ DailyPartner - GET // ----------------------------------------------------------------------------------------------------- - // this._fuseMockApiService - // .onGet('api/apps/report/daily-partner') - // .reply(({ request }) => { - // // Get the id from the params - // const id = request.params.get('id'); + this._fuseMockApiService + .onGet('api/apps/report/daily-partner') + .reply(({ request }) => { + // Get the id from the params + const id = request.params.get('id'); - // // Clone the dailyPartners - // const dailyPartners = cloneDeep(this._dailyPartners); + // Clone the dailyPartners + const dailyPartners = cloneDeep(this._dailyPartners); - // // Find the dailyPartner - // const dailyPartner = dailyPartners.find((item: any) => item.id === id); + // Find the dailyPartner + const dailyPartner = dailyPartners.find((item: any) => item.id === id); - // // Return the response - // return [200, dailyPartner]; - // }); + // Return the response + return [200, dailyPartner]; + }); // ----------------------------------------------------------------------------------------------------- // @ DailyPartner - POST diff --git a/src/app/mock-api/apps/report/daily-partner/data.ts b/src/app/mock-api/apps/report/daily-partner/data.ts index 2fd6c65..f64a447 100644 --- a/src/app/mock-api/apps/report/daily-partner/data.ts +++ b/src/app/mock-api/apps/report/daily-partner/data.ts @@ -1,545 +1,551 @@ /* eslint-disable */ export const dailyPartners = [ + { + id: '8fcce528-d878-4cc8-99f7-bd3451ed5402', + processDate: '2022-06-20', + lastDayHoldingMoney: 22846133, + memberCharge: 0, + memberExchange: 0, + memberProfitLoss: 0, + partnerCharge: 0, + partnerExchange: 0, + partnerProfitLoss: 0, + totalProfitLoss: 0, + passiveMoney: 0, + passiveComp: 0, + casinoBetting: 0, + casinoTie: 0, + casinoCancel: 0, + casinoAvailable: 0, + casinoWinning: 0, + casinoWinLoss: 0, + casinoCommission: 0, + casinoBetWinCalculate: 0, + slotBetting: 160000, + slotCancel: 0, + slotAvailable: 160000, + slotWinning: 90280, + slotWinLoss: 69720, + slotCommission: 8000, + slotBetWinCalculate: 61720, + powerballBetting: 0, + powerballWinning: 0, + powerballWinLoss: 0, + powerballCommission: 0, + powerballBetWinCalculate: 0, + totalBetWinCalculate: 61720, + }, // { - // id: 'on00', - // totalPartnerCount: '5', - // totalHoldingMoney: 303675, - // totalComp: 108933, - // total: 412608, - // branchCount: 1, - // divisionCount: 1, - // officeCount: 1, - // storeCount: 1, - // memberCount: 1, - // nickname: 'on00', - // accountHolder: '11', - // phoneNumber: '010-1111-1111', - // calculateType: '롤링', - // ownCash: 50000, - // ownComp: 1711, - // ownCoupon: 50000, - // gameMoney: 0, - // todayComp: 0, - // totalDeposit: 0, - // totalWithdraw: 0, - // balance: 0, - // registDate: '2022-06-12 15:38', - // finalSigninDate: '', - // ip: '', - // state: '정상', - // note: '', + // user: { + // id: '1', + // 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: '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', // }, - { - user: { - id: '1', - 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: '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', - }, ]; diff --git a/src/app/modules/admin/report/daily-partner/components/list.component.html b/src/app/modules/admin/report/daily-partner/components/list.component.html index 4e72342..6b300f4 100644 --- a/src/app/modules/admin/report/daily-partner/components/list.component.html +++ b/src/app/modules/admin/report/daily-partner/components/list.component.html @@ -1,348 +1,230 @@ -
-
-
-
- -
-
- 파트너일일현황 -
-
- +
+ +
+ +
+ +
+ +
파트너일일현황
+ +
+ + +
+
+ +
+ +
+ + + + 전체 + 파워볼 + 카지노 + 슬롯 + + + + + +
+ +
+ + + + + +
+ +
+ + + + + +
-
- -
- - - - {{ - roleSelect.value | titlecase - }} - - - -
{{ role.label }}
-
-
-
-
+
+ +
+
+ +
+
+ +
+
+ + +
+ +
+ + +
+ +
+
요율
+
상부
+
+ 아이디 +
+ 닉네임 +
+ 연락처
- -
- - - - - +
+ 등급 +
+ 레벨
- -
- - - - - -
- -
-
- - - - -
+ + + + +
-
-
-
- + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
정보 - - {{ info?.user.signinId }} - - - {{ info?.user.type }} - - 매출보기 - +회원입출 - {{ 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.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.betWinSettle }} - 총벳윈정산 - {{ info?.totalBetSettle }} - - Second group -
-
+
+
요율
+
+ {{ dailyPartner.highRank }} +
+
+ {{ dailyPartner.signinId }} +
+ {{ dailyPartner.nickname }} +
+ {{ dailyPartner.phoneNumber }} +
+
+ {{ dailyPartner.rank }} +
+ LV{{ dailyPartner.level }} +
+ + + + + +
+ +
+ + + + + + +
+ There are no data!
-
+
diff --git a/src/app/modules/admin/report/daily-partner/components/list.component.ts b/src/app/modules/admin/report/daily-partner/components/list.component.ts index aa499ab..f0c216e 100644 --- a/src/app/modules/admin/report/daily-partner/components/list.component.ts +++ b/src/app/modules/admin/report/daily-partner/components/list.component.ts @@ -14,7 +14,8 @@ import { FormGroup, Validators, } from '@angular/forms'; - +import { MatPaginator } from '@angular/material/paginator'; +import { MatSort } from '@angular/material/sort'; import { debounceTime, map, @@ -24,9 +25,6 @@ import { switchMap, takeUntil, } from 'rxjs'; - -import { MatTableDataSource } from '@angular/material/table'; - import { fuseAnimations } from '@fuse/animations'; import { FuseConfirmationService } from '@fuse/services/confirmation'; @@ -64,46 +62,20 @@ import { Router } from '@angular/router'; animations: fuseAnimations, }) export class ListComponent implements OnInit, AfterViewInit, OnDestroy { + @ViewChild(MatPaginator) private _paginator!: MatPaginator; + @ViewChild(MatSort) private _sort!: MatSort; + dailyPartners$!: Observable; users$!: Observable; + __isSearchOpened = false; isLoading = false; searchInputControl = new FormControl(); selectedDailyPartner?: DailyPartner; + pagination?: DailyPartnerPagination; - dailyParthnerForm!: FormGroup; - - dailyPartnerDataSource: MatTableDataSource = new MatTableDataSource(); - dailyPartnerTableColumns: string[] = [ - 'partnerInfo', - 'expansionBtn', - '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(); - roles: any[]; - roles2: any[]; - /** * Constructor */ @@ -113,37 +85,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { private _formBuilder: FormBuilder, private _dailyPartnerService: DailyPartnerService, private router: Router - ) { - this.roles = [ - { - label: '전체', - value: '전체', - }, - { - label: '파워볼', - value: '파워볼', - }, - { - label: '카지노', - value: '카지노', - }, - - { - label: '슬롯', - value: '슬롯', - }, - ]; - this.roles2 = [ - { - label: '회원아이디', - value: '전체', - }, - { - label: '닉네임', - value: '파워볼', - }, - ]; - } + ) {} // ----------------------------------------------------------------------------------------------------- // @ Lifecycle hooks @@ -153,27 +95,63 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { * On init */ ngOnInit(): void { - this.dailyParthnerForm = this._formBuilder.group({ - bankName: [''], - accountNumber: [''], - accountHolder: [''], - }); // Get the pagination - this._dailyPartnerService - .getDailyPartners() + this._dailyPartnerService.pagination$ .pipe(takeUntil(this._unsubscribeAll)) - .subscribe((dailyPartners: any) => { + .subscribe((pagination: DailyPartnerPagination | undefined) => { + // Update the pagination + this.pagination = pagination; + // Mark for check - this.dailyPartnerDataSource = dailyPartners.dailyPartners; - console.log(dailyPartners); this._changeDetectorRef.markForCheck(); }); + + // Get the products + this.dailyPartners$ = this._dailyPartnerService.dailyPartners$; } /** * After view init */ - ngAfterViewInit(): void {} + ngAfterViewInit(): void { + if (this._sort && this._paginator) { + // Set the initial sort + this._sort.sort({ + id: 'lastDayHoldingMoney', + start: 'asc', + disableClear: true, + }); + + // Mark for check + this._changeDetectorRef.markForCheck(); + + // If the daily 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._dailyPartnerService.getDailyPartners( + this._paginator.pageIndex, + this._paginator.pageSize, + this._sort.active, + this._sort.direction + ); + }), + map(() => { + this.isLoading = false; + }) + ) + .subscribe(); + } + } /** * On destroy @@ -208,6 +186,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 * @@ -217,7 +203,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/daily-partner/models/daily-partner.ts b/src/app/modules/admin/report/daily-partner/models/daily-partner.ts index 623b465..edf6229 100644 --- a/src/app/modules/admin/report/daily-partner/models/daily-partner.ts +++ b/src/app/modules/admin/report/daily-partner/models/daily-partner.ts @@ -1,29 +1,38 @@ export interface DailyPartner { - 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; 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) + slotTotalCommission?: number; // 슬롯전체수수료(E) + slotBottomCommission?: number; // 슬롯하부수수료(E) + slotOwnCommission?: 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/daily-partner/resolvers/daily-partner.resolver.ts b/src/app/modules/admin/report/daily-partner/resolvers/daily-partner.resolver.ts index f9ed4e7..dd62c7d 100644 --- a/src/app/modules/admin/report/daily-partner/resolvers/daily-partner.resolver.ts +++ b/src/app/modules/admin/report/daily-partner/resolvers/daily-partner.resolver.ts @@ -81,8 +81,9 @@ export class DailyPartnersResolver implements Resolve { route: ActivatedRouteSnapshot, state: RouterStateSnapshot ): Observable<{ + pagination: DailyPartnerPagination; dailyPartners: DailyPartner[]; }> { - return this._dailyPartnerService.getDailyPartners(''); + return this._dailyPartnerService.getDailyPartners(); } } 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 92cefa6..166837d 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 @@ -74,19 +74,32 @@ export class DailyPartnerService { * @param order * @param search */ - getDailyPartners(search: string = ''): Observable<{ - dailyPartners: any; + getDailyPartners( + page: number = 0, + size: number = 10, + sort: string = 'name', + order: 'asc' | 'desc' | '' = 'asc', + search: string = '' + ): Observable<{ + pagination: DailyPartnerPagination; + dailyPartners: DailyPartner[]; }> { return this._httpClient .get<{ - dailyPartners: any; - }>('api/apps/report/daily-partner', { + pagination: DailyPartnerPagination; + dailyPartners: DailyPartner[]; + }>('api/apps/report/daily-partner/daily-partners', { params: { + page: '' + page, + size: '' + size, + sort, + order, search, }, }) .pipe( tap((response) => { + this.__pagination.next(response.pagination); this.__dailyPartners.next(response.dailyPartners); }) );