루징 관리 리스트 수정

This commit is contained in:
Park Byung Eun 2022-08-02 06:55:07 +00:00
parent db7360aa17
commit 6298e601fa
9 changed files with 256 additions and 465 deletions

View File

@ -33,29 +33,14 @@ export class ReportLoosingMockApi {
.reply(({ request }) => { .reply(({ request }) => {
// Get available queries // Get available queries
const search = request.params.get('search'); const search = request.params.get('search');
const sort = request.params.get('sort') || 'name'; // const sort = request.params.get('sort') || 'name';
const order = request.params.get('order') || 'asc'; // const order = request.params.get('order') || 'asc';
const page = parseInt(request.params.get('page') ?? '1', 10); const page = parseInt(request.params.get('page') ?? '1', 10);
const size = parseInt(request.params.get('size') ?? '10', 10); const size = parseInt(request.params.get('size') ?? '10', 10);
// Clone the loosings // Clone the loosings
let loosings: any[] | null = cloneDeep(this._loosings); let loosings: any[] | null = cloneDeep(this._loosings);
// Sort the loosings
if (sort === 'sku' || sort === 'name' || sort === 'active') {
loosings.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 {
loosings.sort((a, b) =>
order === 'asc' ? a[sort] - b[sort] : b[sort] - a[sort]
);
}
// If search exists... // If search exists...
if (search) { if (search) {
// Filter the loosings // Filter the loosings

View File

@ -2,32 +2,27 @@
export const loosings = [ export const loosings = [
{ {
id: 'on00', id: '1',
totalPartnerCount: '5', startDate: '2022-06-01 15:38',
totalHoldingMoney: 303675, endDate: '2022-06-12 15:38',
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', registDate: '2022-06-12 15:38',
finalSigninDate: '', defaultCount: '15',
ip: '', loosingCount: '15',
state: '정상', },
note: '', {
id: '2',
startDate: '2022-06-01 15:38',
endDate: '2022-06-12 15:38',
registDate: '2022-06-12 15:38',
defaultCount: '14',
loosingCount: '16',
},
{
id: '3',
startDate: '2022-06-01 15:38',
endDate: '2022-06-12 15:38',
registDate: '2022-06-12 15:38',
defaultCount: '12',
loosingCount: '11',
}, },
]; ];

View File

@ -9,6 +9,7 @@
<div class="text-lg font-medium tracking-tight leading-6 truncate"> <div class="text-lg font-medium tracking-tight leading-6 truncate">
팝업 관리 팝업 관리
</div> </div>
<div class="flex flex-col flex-auto mt-2 overflow-x-auto"> <div class="flex flex-col flex-auto mt-2 overflow-x-auto">
<table <table
class="min-w-240 overflow-y-visible" class="min-w-240 overflow-y-visible"

View File

@ -29,7 +29,6 @@ import {
import { fuseAnimations } from '@fuse/animations'; import { fuseAnimations } from '@fuse/animations';
import { FuseConfirmationService } from '@fuse/services/confirmation'; import { FuseConfirmationService } from '@fuse/services/confirmation';
import { User } from '../../../member/user/models/user';
import { Popup } from '../models/popup'; import { Popup } from '../models/popup';
import { PopupPagination } from '../models/popup-pagination'; import { PopupPagination } from '../models/popup-pagination';
import { PopupService } from '../services/popup.service'; import { PopupService } from '../services/popup.service';
@ -68,7 +67,6 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild(MatSort) private _sort!: MatSort; @ViewChild(MatSort) private _sort!: MatSort;
popups$!: Observable<Popup[] | undefined>; popups$!: Observable<Popup[] | undefined>;
users$!: Observable<User[] | undefined>;
isLoading = false; isLoading = false;
searchInputControl = new FormControl(); searchInputControl = new FormControl();

View File

@ -15,6 +15,8 @@ import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatTableModule } from '@angular/material/table'; import { MatTableModule } from '@angular/material/table';
import { MatDividerModule } from '@angular/material/divider'; import { MatDividerModule } from '@angular/material/divider';
import { MatMenuModule } from '@angular/material/menu'; import { MatMenuModule } from '@angular/material/menu';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatMomentDateModule } from '@angular/material-moment-adapter';
import { TranslocoModule } from '@ngneat/transloco'; import { TranslocoModule } from '@ngneat/transloco';
@ -45,6 +47,8 @@ import { popupRoutes } from './popup.routing';
MatTableModule, MatTableModule,
MatDividerModule, MatDividerModule,
MatMenuModule, MatMenuModule,
MatDatepickerModule,
MatMomentDateModule,
], ],
}) })
export class PopupModule {} export class PopupModule {}

View File

@ -1,355 +1,189 @@
<div class="flex flex-col flex-auto min-w-0">
<div class="flex-auto border-t -mt-px pt-4 sm:pt-6">
<div class="w-full max-w-screen-xl mx-auto">
<div class="grid grid-cols-1 sm:grid-cols-6 gap-6 w-full min-w-0">
<!-- Budget distribution -->
<div <div
class="sm:absolute sm:inset-0 flex flex-col flex-auto min-w-0 sm:overflow-hidden bg-card dark:bg-transparent" class="sm:col-span-6 flex flex-col flex-auto p-6 bg-card shadow rounded-2xl overflow-hidden"
> >
<!-- Header --> <div class="text-lg font-medium tracking-tight leading-6 truncate">
<div 팝업 관리
class="relative flex flex-col sm:flex-row flex-0 sm:items-center sm:justify-between py-8 px-6 md:px-8 border-b"
>
<!-- Loader -->
<div class="absolute inset-x-0 bottom-0" *ngIf="isLoading">
<mat-progress-bar [mode]="'indeterminate'"></mat-progress-bar>
</div> </div>
<!-- Title -->
<div class="text-4xl font-extrabold tracking-tight">루징관리</div>
<!-- Actions -->
<div class="flex shrink-0 items-center mt-6 sm:mt-0 sm:ml-4">
<!-- Memo -->
<!-- <mat-form-field>
<ng-container *ngIf="loosings$ | async as loosings">
<ng-container
*ngFor="let loosing of loosings; trackBy: __trackByFn"
>
<div
class="inventory-grid grid items-center gap-4 py-3 px-6 md:px-8 border-b"
>
<fieldset>
총 파트너수:{{ loosing.totalPartnerCount }} 총 보유머니:{{
loosing.totalHoldingMoney
}}
총 콤프:{{ loosing.totalComp }} 총 합계:{{
loosing.total
}}
</fieldset>
</div>
</ng-container>
</ng-container>
</mat-form-field> -->
<!-- SelectBox -->
<mat-form-field>
<mat-select placeholder="리스트수">
<mat-option value="40">40</mat-option>
<mat-option value="60">60</mat-option>
<mat-option value="80">80</mat-option>
<mat-option value="100">100</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="레벨">
<mat-option value="level1">LV.1</mat-option>
<mat-option value="level2">LV.2</mat-option>
<mat-option value="level3">LV.3</mat-option>
<mat-option value="level4">LV.4</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="상태">
<mat-option value="">정상</mat-option>
<mat-option value="">대기</mat-option>
<mat-option value="">탈퇴</mat-option>
<mat-option value="">휴면</mat-option>
<mat-option value="">블랙</mat-option>
<mat-option value="">정지</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="제한">
<mat-option value="">카지노제한</mat-option>
<mat-option value="">슬롯제한</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="입금">
<mat-option value="">계좌입금</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="내용">
<mat-option value="">카지노콤프</mat-option>
<mat-option value="">슬롯콤프</mat-option>
<mat-option value="">배팅콤프</mat-option>
<mat-option value="">첫충콤프</mat-option>
</mat-select>
</mat-form-field>
<!-- <mat-form-field>
<mat-select placeholder="입금">
<mat-option value="">계좌입금</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="아이디">
<mat-option value="">아이디</mat-option>
<mat-option value="">닉네임</mat-option>
<mat-option value="">이름</mat-option>
<mat-option value="">사이트</mat-option>
<mat-option value="">파트너수동지급</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="가입일 정렬">
<mat-option value="">가입일 정렬</mat-option>
<mat-option value="">아이디 정렬</mat-option>
<mat-option value="">닉네임 정렬</mat-option>
<mat-option value="">캐쉬 정렬</mat-option>
<mat-option value="">콤프 정렬</mat-option>
<mat-option value="">쿠폰 정렬</mat-option>
<mat-option value="">입금 정렬</mat-option>
<mat-option value="">출금 정렬</mat-option>
<mat-option value="">차익 정렬</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="내림차순">
<mat-option value="">내림차순</mat-option>
<mat-option value="">오름차순</mat-option>
</mat-select>
</mat-form-field> -->
<!-- Search --> <!-- Search -->
<mat-form-field <div
class="fuse-mat-dense fuse-mat-no-subscript fuse-mat-rounded min-w-64" class="relative flex flex-col sm:flex-row flex-0 sm:items-center sm:justify-between py-4 px-6 md:px-8 border-b"
>
<!-- Card inception -->
<div class="col-span-2 sm:col-span-1">
<mat-form-field
class="fuse-mat-no-subscript w-full"
[floatLabel]="'always'"
> >
<mat-icon
class="icon-size-5"
matPrefix
[svgIcon]="'heroicons_solid:search'"
></mat-icon>
<input <input
matInput matInput
[formControl]="searchInputControl" [matDatepicker]="picker1"
[autocomplete]="'off'" [placeholder]="'Choose a date'"
[placeholder]="'Search'"
/> />
<mat-datepicker-toggle
matSuffix
[for]="picker1"
></mat-datepicker-toggle>
<mat-datepicker #picker1></mat-datepicker>
</mat-form-field> </mat-form-field>
</div>
<!-- Card expiration -->
<div class="col-span-2 sm:col-span-1">
<mat-form-field
class="fuse-mat-no-subscript w-full"
[floatLabel]="'always'"
>
<input
matInput
[matDatepicker]="picker2"
[placeholder]="'Choose a date'"
/>
<mat-datepicker-toggle
matSuffix
[for]="picker2"
></mat-datepicker-toggle>
<mat-datepicker #picker2></mat-datepicker>
</mat-form-field>
</div>
<!-- Actions -->
<div fxLayout="row wrap" class="items-center mt-6 sm:mt-0 sm:ml-0">
<!-- Search -->
<!-- Add user button --> <!-- Add user button -->
<button <button
class="ml-4"
mat-flat-button mat-flat-button
[color]="'primary'" [color]="'primary'"
fxFlex
(click)="__createProduct()" (click)="__createProduct()"
> >
<!-- <mat-icon [svgIcon]="'heroicons_outline:plus'"></mat-icon> --> <mat-icon [svgIcon]="'heroicons_outline:search'"></mat-icon>
<span class="ml-2 mr-1">검색하기</span> <span class="ml-2 mr-1">기본데이터생성</span>
</button> </button>
<button>엑셀저장</button>
<button>카지노머니확인</button>
</div> </div>
</div> </div>
<!-- Main --> <div class="flex flex-col flex-auto mt-2 overflow-x-auto">
<div class="flex flex-auto overflow-hidden"> <table
<!-- Products list --> class="min-w-240 overflow-y-visible"
<div mat-table
class="flex flex-col flex-auto sm:mb-18 overflow-hidden sm:overflow-y-auto" [dataSource]="loosingDataSource"
> >
<ng-container *ngIf="loosings$ | async as loosings"> <!-- Index -->
<ng-container *ngIf="loosings.length > 0; else noLoosing"> <ng-container matColumnDef="index">
<div class="grid"> <th mat-header-cell *matHeaderCellDef>번호</th>
<!-- Header --> <td mat-cell *matCellDef="let info; let i = index">
<div <span class="font-medium text-right">
class="inventory-grid z-10 sticky top-0 grid gap-4 py-4 px-6 md:px-8 shadow text-md font-semibold text-secondary bg-gray-50 dark:bg-black dark:bg-opacity-5" {{ i + 1 }}
matSort </span>
matSortDisableClear </td>
>
<div class="hidden sm:block"><mat-checkbox></mat-checkbox></div>
<div class="hidden sm:block">요율</div>
<div class="hidden sm:block">상부트리</div>
<div class="hidden sm:block">관리</div>
<div class="hidden sm:block">매장수</div>
<div class="hidden sm:block">회원수</div>
<div class="hidden sm:block">아이디</div>
<div class="hidden sm:block">닉네임</div>
<div class="hidden sm:block">예금주</div>
<div class="hidden sm:block">연락처</div>
<div class="hidden sm:block">정산</div>
<div class="hidden sm:block">보유금</div>
<div class="hidden sm:block">게임중머니</div>
<div class="hidden sm:block">카지노->캐쉬</div>
<div class="hidden sm:block">금일콤프</div>
<div class="hidden sm:block">총입출</div>
<div class="hidden sm:block">로그</div>
<div class="hidden sm:block">상태</div>
<div class="hidden sm:block">회원수</div>
<div class="hidden sm:block">비고</div>
</div>
<!-- Rows -->
<ng-container *ngIf="loosings$ | async as loosings">
<ng-container
*ngFor="let loosing of loosings; trackBy: __trackByFn"
>
<div
class="inventory-grid grid items-center gap-4 py-3 px-6 md:px-8 border-b"
>
<div class="hidden sm:block truncate">
<mat-checkbox></mat-checkbox>
</div>
<!-- rate -->
<div class="hidden sm:block truncate">
<button
mat-button
color="primary"
matTooltip="요율확인
카지노-바카라: 0%
카지노-룰렛: 0%
카지노-드레곤타이거: 0%
카지노-그외: 0%
슬롯: 0%
카지노루징: 0%
슬롯루징: 0%"
>
요율
</button>
<div class="hidden sm:block truncate">
<!-- 관리 -->
<button mat-flat-button [color]="'primary'">
<mat-form-field>
<mat-select placeholder="관리">
<mat-option value="">보유금지급/회수</mat-option>
<mat-option value="">수수료설정</mat-option>
<mat-option value="">콤프지급/회수</mat-option>
<mat-option value="">쿠폰머니지급/회수</mat-option>
<mat-option value="">쪽지보내기</mat-option>
<mat-option value="">베팅리스트</mat-option>
<mat-option value="">강제로그아웃</mat-option>
</mat-select>
</mat-form-field>
</button>
</div>
</div>
<!-- 매장수 -->
<div class="hidden sm:block truncate">
<button mat-flat-button [color]="'primary'">
{{ loosing.branchCount }}
</button>
<button mat-flat-button [color]="'primary'">
{{ loosing.divisionCount }}
</button>
<button mat-flat-button [color]="'primary'">
{{ loosing.officeCount }}
</button>
<button mat-flat-button [color]="'primary'">
{{ loosing.storeCount }}
</button>
</div>
<!-- 회원수 -->
<div class="hidden sm:block truncate">
<button mat-flat-button [color]="'primary'">
{{ loosing.memberCount }}
</button>
</div>
<!-- id -->
<ng-container *ngIf="users$ | async as users">
<ng-container
*ngFor="let user of users; trackBy: __trackByFn"
>
<div
class="hidden sm:block truncate"
(click)="viewUserDetail(user.id!)"
>
{{ loosing.id }}
</div>
</ng-container>
</ng-container>
<!-- nickname -->
<div class="hidden sm:block truncate">
{{ loosing.nickname }}
</div>
<!-- accountHolder -->
<div class="hidden sm:block truncate">
{{ loosing.accountHolder }}
</div>
<!-- 연락처 -->
<div class="hidden sm:block truncate">
{{ loosing.phoneNumber }}
</div>
<!-- 정산 -->
<div class="hidden sm:block truncate">
{{ loosing.calculateType }}
</div>
<!-- 보유금 -->
<div class="hidden sm:block truncate">
캐쉬{{ loosing.ownCash }} 콤프{{ loosing.ownComp }} 쿠폰{{
loosing.ownCoupon
}}
</div>
<!-- gameMoney -->
<div class="hidden sm:block truncate">
{{ loosing.gameMoney }}
</div>
<!-- casinoCash -->
<div class="hidden sm:block truncate">
<button mat-flat-button [color]="'primary'">
게임머니확인
</button>
<button mat-flat-button [color]="'primary'">
게임머니회수
</button>
</div>
<!-- todayComp -->
<div class="hidden sm:block truncate">
{{ loosing.todayComp }}P
</div>
<!-- 총입출 -->
<div class="hidden sm:block truncate">
입금{{ loosing.totalDeposit }} 출금{{
loosing.totalWithdraw
}}
차익{{ loosing.balance }}
</div>
<!-- log -->
<div class="hidden sm:block truncate">
가입{{ loosing.registDate }} 최종{{
loosing.finalSigninDate
}}
IP{{ loosing.ip }}
</div>
<!-- state -->
<div class="hidden sm:block truncate">
{{ loosing.state }}
</div>
<!-- 회원수 -->
<div class="hidden sm:block truncate">
{{ loosing.memberCount }}
</div>
<!-- 비고 -->
<div class="hidden sm:block truncate">
<button mat-flat-button [color]="'primary'">
{{ loosing.note }}
</button>
</div>
</div>
</ng-container>
</ng-container>
</div>
<mat-paginator
class="sm:absolute sm:inset-x-0 sm:bottom-0 border-b sm:border-t sm:border-b-0 z-10 bg-gray-50 dark:bg-transparent"
[ngClass]="{ 'pointer-events-none': isLoading }"
[length]="pagination?.length"
[pageIndex]="pagination?.page"
[pageSize]="pagination?.size"
[pageSizeOptions]="[5, 10, 25, 100]"
[showFirstLastButtons]="true"
></mat-paginator>
</ng-container>
</ng-container> </ng-container>
<ng-template #noLoosing> <!-- 시작일 -->
<div <ng-container matColumnDef="startDate">
class="p-8 sm:p-16 border-t text-4xl font-semibold tracking-tight text-center" <th mat-header-cell *matHeaderCellDef>시작일</th>
<td mat-cell *matCellDef="let info">
<span class="font-medium text-right">
{{ info.startDate }}
</span>
</td>
</ng-container>
<!-- 종료일 -->
<ng-container matColumnDef="endDate">
<th mat-header-cell *matHeaderCellDef>종료일</th>
<td mat-cell *matCellDef="let info">
<span class="font-medium text-right">
{{ info.endDate }}
</span>
</td>
</ng-container>
<!-- 기본데이터 -->
<ng-container matColumnDef="defaultDataTotalCount">
<th mat-header-cell *matHeaderCellDef colspan="2">
기본데이터
</th>
<td mat-cell *matCellDef="let info">
<span class="font-medium text-right">{{
info.defaultCount
}}</span>
</td>
</ng-container>
<ng-container matColumnDef="defaultDataViewBtn">
<td
mat-cell
*matCellDef="let info"
style="border-left: 1px solid #e0e0e0"
> >
There are no loosing datas! <span class="font-medium text-right"
</div> ><button
</ng-template> mat-flat-button
class="bet-mat-small-8"
[color]="'primary'"
>
상세보기
</button></span
>
</td>
</ng-container>
<!-- 루징데이터 -->
<ng-container matColumnDef="loosingDataTotalCount">
<th mat-header-cell *matHeaderCellDef colspan="2">
루징데이터
</th>
<td mat-cell *matCellDef="let info">
<span class="font-medium text-right">{{
info.loosingCount
}}</span>
</td>
</ng-container>
<ng-container matColumnDef="loosingDataViewBtn">
<td
mat-cell
*matCellDef="let info"
style="border-left: 1px solid #e0e0e0"
>
<span class="font-medium text-right"
><button
mat-flat-button
class="bet-mat-small-8"
[color]="'primary'"
>
상세보기
</button></span
>
</td>
</ng-container>
<!-- 삭제 -->
<ng-container matColumnDef="removeBtn">
<th mat-header-cell *matHeaderCellDef>삭제</th>
<td mat-cell *matCellDef="let info">
<span class="font-medium text-right"
><button
mat-flat-button
class="bet-mat-small-8"
[color]="'primary'"
>
삭제
</button></span
>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="headerTableColumns"></tr>
<tr
mat-row
*matRowDef="let row; columns: displayedTableColumns"
></tr>
</table>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -8,32 +8,18 @@ import {
ViewChild, ViewChild,
ViewEncapsulation, ViewEncapsulation,
} from '@angular/core'; } from '@angular/core';
import {
FormBuilder,
FormControl,
FormGroup,
Validators,
} from '@angular/forms';
import { MatCheckboxChange } from '@angular/material/checkbox';
import { MatPaginator } from '@angular/material/paginator'; import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort'; import { MatSort } from '@angular/material/sort';
import { import { map, merge, Observable, Subject, switchMap, takeUntil } from 'rxjs';
debounceTime,
map,
merge,
Observable,
Subject,
switchMap,
takeUntil,
} from 'rxjs';
import { fuseAnimations } from '@fuse/animations'; import { fuseAnimations } from '@fuse/animations';
import { FuseConfirmationService } from '@fuse/services/confirmation'; import { FuseConfirmationService } from '@fuse/services/confirmation';
import { User } from '../../../member/user/models/user';
import { Loosing } from '../models/loosing'; import { Loosing } from '../models/loosing';
import { LoosingPagination } from '../models/loosing-pagination';
import { LoosingService } from '../services/loosing.service'; import { LoosingService } from '../services/loosing.service';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { MatTableDataSource } from '@angular/material/table';
@Component({ @Component({
selector: 'loosing-list', selector: 'loosing-list',
@ -67,22 +53,39 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild(MatSort) private _sort!: MatSort; @ViewChild(MatSort) private _sort!: MatSort;
loosings$!: Observable<Loosing[] | undefined>; loosings$!: Observable<Loosing[] | undefined>;
users$!: Observable<User[] | undefined>;
isLoading = false; isLoading = false;
searchInputControl = new FormControl();
selectedLoosing?: Loosing; loosingDataSource: MatTableDataSource<Loosing> = new MatTableDataSource();
pagination?: LoosingPagination;
private _unsubscribeAll: Subject<any> = new Subject<any>(); private _unsubscribeAll: Subject<any> = new Subject<any>();
headerTableColumns: string[] = [
'index',
'startDate',
'endDate',
'defaultDataTotalCount',
'loosingDataTotalCount',
'removeBtn',
];
displayedTableColumns: string[] = [
'index',
'startDate',
'endDate',
'defaultDataTotalCount',
'defaultDataViewBtn',
'loosingDataTotalCount',
'loosingDataViewBtn',
'removeBtn',
];
/** /**
* Constructor * Constructor
*/ */
constructor( constructor(
private _changeDetectorRef: ChangeDetectorRef, private _changeDetectorRef: ChangeDetectorRef,
private _fuseConfirmationService: FuseConfirmationService, private _fuseConfirmationService: FuseConfirmationService,
private _formBuilder: FormBuilder,
private _loosingService: LoosingService, private _loosingService: LoosingService,
private router: Router private router: Router
) {} ) {}
@ -95,63 +98,24 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
* On init * On init
*/ */
ngOnInit(): void { ngOnInit(): void {
// Get the pagination // Get the products
this._loosingService.pagination$ this._loosingService.loosings$
.pipe(takeUntil(this._unsubscribeAll)) .pipe(takeUntil(this._unsubscribeAll))
.subscribe((pagination: LoosingPagination | undefined) => { .subscribe((loosings: Loosing[] | undefined) => {
// Update the pagination if (!loosings) {
this.pagination = pagination; return;
}
this.loosingDataSource.data = loosings;
// Mark for check // Mark for check
this._changeDetectorRef.markForCheck(); this._changeDetectorRef.markForCheck();
}); });
// Get the products
this.loosings$ = this._loosingService.loosings$;
} }
/** /**
* After view init * After view init
*/ */
ngAfterViewInit(): void { ngAfterViewInit(): void {}
if (this._sort && this._paginator) {
// Set the initial sort
this._sort.sort({
id: 'name',
start: 'asc',
disableClear: true,
});
// Mark for check
this._changeDetectorRef.markForCheck();
// If the loosing 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._loosingService.getLoosings(
this._paginator.pageIndex,
this._paginator.pageSize,
this._sort.active,
this._sort.direction
);
}),
map(() => {
this.isLoading = false;
})
)
.subscribe();
}
}
/** /**
* On destroy * On destroy
@ -166,10 +130,10 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
// @ Public methods // @ Public methods
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
viewUserDetail(id: string): void { /* viewUserDetail(id: string): void {
let url: string = 'member/user/' + id; let url: string = 'member/user/' + id;
this.router.navigateByUrl(url); this.router.navigateByUrl(url);
} } */
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
// @ Private methods // @ Private methods
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------

View File

@ -15,6 +15,9 @@ import { MatGridListModule } from '@angular/material/grid-list';
import { MatSlideToggleModule } from '@angular/material/slide-toggle'; import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { MatRadioModule } from '@angular/material/radio'; import { MatRadioModule } from '@angular/material/radio';
import { MatCheckboxModule } from '@angular/material/checkbox'; import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatMomentDateModule } from '@angular/material-moment-adapter';
import { MatTableModule } from '@angular/material/table';
import { TranslocoModule } from '@ngneat/transloco'; import { TranslocoModule } from '@ngneat/transloco';
@ -45,6 +48,9 @@ import { loosingRoutes } from './loosing.routing';
MatSlideToggleModule, MatSlideToggleModule,
MatRadioModule, MatRadioModule,
MatCheckboxModule, MatCheckboxModule,
MatDatepickerModule,
MatMomentDateModule,
MatTableModule,
], ],
}) })
export class LoosingModule {} export class LoosingModule {}

View File

@ -21,7 +21,11 @@ export interface Loosing {
totalDeposit?: number; totalDeposit?: number;
totalWithdraw?: number; totalWithdraw?: number;
balance?: number; balance?: number;
startDate?: string;
endDate?: string;
registDate?: string; registDate?: string;
defaultCount?: string;
loosingCount?: string;
finalSigninDate?: string; finalSigninDate?: string;
ip?: string; ip?: string;
state?: string; state?: string;