현재접속자 쪽지전송 page 추가
This commit is contained in:
parent
dded7ac3db
commit
834b3207d9
|
@ -164,6 +164,13 @@ export const appRoutes: Route[] = [
|
|||
'app/modules/admin/member/unconnected/unconnected.module'
|
||||
).then((m: any) => m.UnconnectedModule),
|
||||
},
|
||||
{
|
||||
path: 'current-user',
|
||||
loadChildren: () =>
|
||||
import(
|
||||
'app/modules/admin/member/current-user/current-user.module'
|
||||
).then((m: any) => m.CurrentUserModule),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
217
src/app/mock-api/apps/member/current-user/api.ts
Normal file
217
src/app/mock-api/apps/member/current-user/api.ts
Normal file
|
@ -0,0 +1,217 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { assign, cloneDeep } from 'lodash-es';
|
||||
import { FuseMockApiService, FuseMockApiUtils } from '@fuse/lib/mock-api';
|
||||
import { currentUsers as currentUsersData } from './data';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class MemberCurrentUserMockApi {
|
||||
private _currentUsers: any[] = currentUsersData;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
constructor(private _fuseMockApiService: FuseMockApiService) {
|
||||
// Register Mock API handlers
|
||||
this.registerHandlers();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Public methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Register Mock API handlers
|
||||
*/
|
||||
registerHandlers(): void {
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ CurrentUsers - GET
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onGet('api/apps/member/current-user/current-users', 300)
|
||||
.reply(({ request }) => {
|
||||
// Get available queries
|
||||
const search = request.params.get('search');
|
||||
const sort = request.params.get('sort') || 'name';
|
||||
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 currentUsers
|
||||
let currentUsers: any[] | null = cloneDeep(this._currentUsers);
|
||||
|
||||
// Sort the currentUsers
|
||||
if (sort === 'sku' || sort === 'name' || sort === 'active') {
|
||||
currentUsers.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 {
|
||||
currentUsers.sort((a, b) =>
|
||||
order === 'asc' ? a[sort] - b[sort] : b[sort] - a[sort]
|
||||
);
|
||||
}
|
||||
|
||||
// If search exists...
|
||||
if (search) {
|
||||
// Filter the currentUsers
|
||||
currentUsers = currentUsers.filter(
|
||||
(contact: any) =>
|
||||
contact.name &&
|
||||
contact.name.toLowerCase().includes(search.toLowerCase())
|
||||
);
|
||||
}
|
||||
|
||||
// Paginate - Start
|
||||
const currentUsersLength = currentUsers.length;
|
||||
|
||||
// Calculate pagination details
|
||||
const begin = page * size;
|
||||
const end = Math.min(size * (page + 1), currentUsersLength);
|
||||
const lastPage = Math.max(Math.ceil(currentUsersLength / size), 1);
|
||||
|
||||
// Prepare the pagination object
|
||||
let pagination = {};
|
||||
|
||||
// If the requested page number is bigger than
|
||||
// the last possible page number, return null for
|
||||
// currentUsers but also send the last possible page so
|
||||
// the app can navigate to there
|
||||
if (page > lastPage) {
|
||||
currentUsers = null;
|
||||
pagination = {
|
||||
lastPage,
|
||||
};
|
||||
} else {
|
||||
// Paginate the results by size
|
||||
currentUsers = currentUsers.slice(begin, end);
|
||||
|
||||
// Prepare the pagination mock-api
|
||||
pagination = {
|
||||
length: currentUsersLength,
|
||||
size: size,
|
||||
page: page,
|
||||
lastPage: lastPage,
|
||||
startIndex: begin,
|
||||
endIndex: end - 1,
|
||||
};
|
||||
}
|
||||
|
||||
// Return the response
|
||||
return [
|
||||
200,
|
||||
{
|
||||
currentUsers,
|
||||
pagination,
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ CurrentUsers - GET
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onGet('api/apps/member/current-user/current-user')
|
||||
.reply(({ request }) => {
|
||||
// Get the id from the params
|
||||
const id = request.params.get('id');
|
||||
|
||||
// Clone the currentUsers
|
||||
const currentUsers = cloneDeep(this._currentUsers);
|
||||
|
||||
// Find the currentUser
|
||||
const currentUser = currentUsers.find((item: any) => item.id === id);
|
||||
|
||||
// Return the response
|
||||
return [200, currentUser];
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ CurrentUser - POST
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onPost('api/apps/member/current-user/current-user')
|
||||
.reply(() => {
|
||||
// Generate a new currentUser
|
||||
const newCurrentUser = {
|
||||
id: FuseMockApiUtils.guid(),
|
||||
category: '',
|
||||
name: 'A New User',
|
||||
description: '',
|
||||
tags: [],
|
||||
sku: '',
|
||||
barcode: '',
|
||||
brand: '',
|
||||
vendor: '',
|
||||
stock: '',
|
||||
reserved: '',
|
||||
cost: '',
|
||||
basePrice: '',
|
||||
taxPercent: '',
|
||||
price: '',
|
||||
weight: '',
|
||||
thumbnail: '',
|
||||
images: [],
|
||||
active: false,
|
||||
};
|
||||
|
||||
// Unshift the new currentUser
|
||||
this._currentUsers.unshift(newCurrentUser);
|
||||
|
||||
// Return the response
|
||||
return [200, newCurrentUser];
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ CurrentUser - PATCH
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onPatch('api/apps/member/current-user/current-user')
|
||||
.reply(({ request }) => {
|
||||
// Get the id and currentUser
|
||||
const id = request.body.id;
|
||||
const currentUser = cloneDeep(request.body.currentUser);
|
||||
|
||||
// Prepare the updated currentUser
|
||||
let updatedCurrentUser = null;
|
||||
|
||||
// Find the currentUser and update it
|
||||
this._currentUsers.forEach((item, index, currentUsers) => {
|
||||
if (item.id === id) {
|
||||
// Update the currentUser
|
||||
currentUsers[index] = assign({}, currentUsers[index], currentUser);
|
||||
|
||||
// Store the updated currentUser
|
||||
updatedCurrentUser = currentUsers[index];
|
||||
}
|
||||
});
|
||||
|
||||
// Return the response
|
||||
return [200, updatedCurrentUser];
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ CurrentUser - DELETE
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onDelete('api/apps/member/current-user/current-user')
|
||||
.reply(({ request }) => {
|
||||
// Get the id
|
||||
const id = request.params.get('id');
|
||||
|
||||
// Find the currentUser and delete it
|
||||
this._currentUsers.forEach((item, index) => {
|
||||
if (item.id === id) {
|
||||
this._currentUsers.splice(index, 1);
|
||||
}
|
||||
});
|
||||
|
||||
// Return the response
|
||||
return [200, true];
|
||||
});
|
||||
}
|
||||
}
|
16
src/app/mock-api/apps/member/current-user/data.ts
Normal file
16
src/app/mock-api/apps/member/current-user/data.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
/* eslint-disable */
|
||||
|
||||
export const currentUsers = [
|
||||
{
|
||||
id: 'aa100',
|
||||
highRank: '[매장]kgon5',
|
||||
rank: '회원',
|
||||
level: 4,
|
||||
nickname: 'aa100',
|
||||
currentLocation: '메인',
|
||||
cash: 0,
|
||||
comp: 3111,
|
||||
gameMoney: 0,
|
||||
siteAddress: 'web4nova114.com',
|
||||
},
|
||||
];
|
|
@ -60,6 +60,13 @@ export const defaultNavigation: FuseNavigationItem[] = [
|
|||
icon: 'heroicons_outline:academic-cap',
|
||||
link: '/member/unconnected',
|
||||
},
|
||||
{
|
||||
id: 'member.current-user',
|
||||
title: 'Current User',
|
||||
type: 'basic',
|
||||
icon: 'heroicons_outline:academic-cap',
|
||||
link: '/member/current-user',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ import { MailboxMockApi } from 'app/mock-api/apps/mailbox/api';
|
|||
import { MemberUserMockApi } from 'app/mock-api/apps/member/user/api';
|
||||
import { MemberCasinomoneyMockApi } from './apps/member/casinomoney/api';
|
||||
import { MemberUnconnectedMockApi } from './apps/member/unconnected/api';
|
||||
import { MemberCurrentUserMockApi } from './apps/member/current-user/api';
|
||||
import { MessagesMockApi } from 'app/mock-api/common/messages/api';
|
||||
import { NavigationMockApi } from 'app/mock-api/common/navigation/api';
|
||||
import { NotesMockApi } from 'app/mock-api/apps/notes/api';
|
||||
|
@ -48,6 +49,7 @@ export const mockApiServices = [
|
|||
MemberUserMockApi,
|
||||
MemberCasinomoneyMockApi,
|
||||
MemberUnconnectedMockApi,
|
||||
MemberCurrentUserMockApi,
|
||||
MessagesMockApi,
|
||||
NavigationMockApi,
|
||||
NotesMockApi,
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
import { ListComponent } from './list.component';
|
||||
|
||||
export const COMPONENTS = [ListComponent];
|
|
@ -0,0 +1,402 @@
|
|||
<div
|
||||
class="sm:absolute sm:inset-0 flex flex-col flex-auto min-w-0 sm:overflow-hidden bg-card dark:bg-transparent"
|
||||
>
|
||||
<!-- Header -->
|
||||
<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>
|
||||
<!-- 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">
|
||||
<!-- Main -->
|
||||
<div class="flex flex-auto overflow-hidden">
|
||||
<!-- Products list -->
|
||||
<div
|
||||
class="flex flex-col flex-auto sm:mb-18 overflow-hidden sm:overflow-y-auto"
|
||||
>
|
||||
<ng-container *ngIf="currentUsers$ | async as currentUsers">
|
||||
<ng-container *ngIf="currentUsers.length > 0; else noCurrentUser">
|
||||
<div class="grid">
|
||||
<!-- Header -->
|
||||
<div
|
||||
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"
|
||||
matSort
|
||||
matSortDisableClear
|
||||
>
|
||||
<div></div>
|
||||
<div class="hidden sm:block" [mat-sort-header]="'index'">
|
||||
번호
|
||||
</div>
|
||||
<div class="hidden sm:block" [mat-sort-header]="'highRank'">
|
||||
상위
|
||||
</div>
|
||||
<div class="hidden sm:block" [mat-sort-header]="'rank'">
|
||||
등급
|
||||
</div>
|
||||
<div class="hidden sm:block" [mat-sort-header]="'level'">
|
||||
레벨
|
||||
</div>
|
||||
<div class="hidden sm:block" [mat-sort-header]="'id'">
|
||||
아이디
|
||||
</div>
|
||||
<div class="hidden sm:block" [mat-sort-header]="'nickname'">
|
||||
닉네임
|
||||
</div>
|
||||
<div
|
||||
class="hidden sm:block"
|
||||
[mat-sort-header]="'currentLocation'"
|
||||
>
|
||||
현재위치
|
||||
</div>
|
||||
<div class="hidden sm:block" [mat-sort-header]="'cash'">
|
||||
캐쉬
|
||||
</div>
|
||||
<div class="hidden sm:block" [mat-sort-header]="'gameMoney'">
|
||||
게임중머니
|
||||
</div>
|
||||
<div class="hidden sm:block" [mat-sort-header]="''">
|
||||
카지노->캐쉬
|
||||
</div>
|
||||
<div class="hidden sm:block" [mat-sort-header]="'comp'">
|
||||
콤프
|
||||
</div>
|
||||
<div
|
||||
class="hidden sm:block"
|
||||
[mat-sort-header]="'siteAddress'"
|
||||
>
|
||||
사이트
|
||||
</div>
|
||||
<div class="hidden sm:block" [mat-sort-header]="''">
|
||||
쪽지보내기
|
||||
</div>
|
||||
<div class="hidden sm:block" [mat-sort-header]="''">
|
||||
배팅내역
|
||||
</div>
|
||||
<div class="hidden sm:block" [mat-sort-header]="''">
|
||||
로그아웃
|
||||
</div>
|
||||
|
||||
<!-- <div class="hidden md:block" [mat-sort-header]="'sku'">SKU</div>
|
||||
<div [mat-sort-header]="'name'">Name</div>
|
||||
<div class="hidden sm:block" [mat-sort-header]="'price'">
|
||||
Price
|
||||
</div>
|
||||
<div class="hidden lg:block" [mat-sort-header]="'stock'">
|
||||
Stock
|
||||
</div>
|
||||
<div class="hidden lg:block" [mat-sort-header]="'active'">
|
||||
Active
|
||||
</div>
|
||||
<div class="hidden sm:block">Details</div> -->
|
||||
</div>
|
||||
<!-- Rows -->
|
||||
<ng-container *ngIf="currentUsers$ | async as currentUsers">
|
||||
<ng-container
|
||||
*ngFor="
|
||||
let currentUser of currentUsers;
|
||||
trackBy: __trackByFn
|
||||
"
|
||||
>
|
||||
<div
|
||||
class="inventory-grid grid items-center gap-4 py-3 px-6 md:px-8 border-b"
|
||||
>
|
||||
<!-- index -->
|
||||
<div class="hidden sm:block truncate">
|
||||
{{ currentUser.index }}
|
||||
</div>
|
||||
<!-- highRank -->
|
||||
<div class="hidden sm:block truncate">
|
||||
{{ currentUser.highRank }}
|
||||
</div>
|
||||
<!-- rank -->
|
||||
<div class="hidden sm:block truncate">
|
||||
{{ currentUser.rank }}
|
||||
</div>
|
||||
<!-- level -->
|
||||
<div class="hidden sm:block truncate">
|
||||
LV.{{ currentUser.level }}
|
||||
</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!)"
|
||||
>
|
||||
{{ currentUser.id }}
|
||||
</div>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
<!-- nickname -->
|
||||
<div class="hidden sm:block truncate">
|
||||
{{ currentUser.nickname }}
|
||||
</div>
|
||||
|
||||
<!-- currentLocation -->
|
||||
<div class="hidden sm:block truncate">
|
||||
{{ currentUser.currentLocation }}
|
||||
</div>
|
||||
<!-- cash -->
|
||||
<div class="hidden sm:block truncate">
|
||||
캐쉬{{ currentUser.cash }}
|
||||
</div>
|
||||
<!-- casinoCash -->
|
||||
<div class="hidden sm:block truncate">
|
||||
<button mat-flat-button [color]="'primary'">
|
||||
게임머니확인
|
||||
</button>
|
||||
<button mat-flat-button [color]="'primary'">
|
||||
게임머니회수
|
||||
</button>
|
||||
</div>
|
||||
<!-- comp -->
|
||||
<div class="hidden sm:block truncate">
|
||||
{{ currentUser.comp }}
|
||||
</div>
|
||||
<!-- site -->
|
||||
<div class="hidden sm:block truncate">
|
||||
{{ currentUser.siteAddress }}
|
||||
</div>
|
||||
|
||||
<!-- message -->
|
||||
<div class="hidden sm:block truncate">
|
||||
<button mat-flat-button [color]="'primary'">
|
||||
<mat-icon svgIcon="heroicons_outline:mail"></mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- bettinglist -->
|
||||
<div class="hidden sm:block truncate">
|
||||
<button mat-flat-button [color]="'primary'">
|
||||
배팅리스트
|
||||
</button>
|
||||
</div>
|
||||
<!-- logout -->
|
||||
<div class="hidden sm:block truncate">
|
||||
<button mat-flat-button [color]="'primary'">
|
||||
로그아웃
|
||||
</button>
|
||||
</div>
|
||||
<!-- Image -->
|
||||
<!-- <div class="flex items-center">
|
||||
<div
|
||||
class="relative flex flex-0 items-center justify-center w-12 h-12 mr-6 rounded overflow-hidden border"
|
||||
>
|
||||
<img
|
||||
class="w-8"
|
||||
*ngIf="user.thumbnail"
|
||||
[alt]="'Product thumbnail image'"
|
||||
[src]="user.thumbnail"
|
||||
/>
|
||||
<div
|
||||
class="flex items-center justify-center w-full h-full text-xs font-semibold leading-none text-center uppercase"
|
||||
*ngIf="!user.thumbnail"
|
||||
>
|
||||
NO THUMB
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<!-- SKU -->
|
||||
<!-- <div class="hidden md:block truncate">
|
||||
{{ user.sku }}
|
||||
</div> -->
|
||||
|
||||
<!-- Name -->
|
||||
<!-- <div class="truncate">
|
||||
{{ user.name }}
|
||||
</div> -->
|
||||
|
||||
<!-- Price -->
|
||||
<!-- <div class="hidden sm:block">
|
||||
{{ user.price | currency: "USD":"symbol":"1.2-2" }}
|
||||
</div> -->
|
||||
|
||||
<!-- Stock -->
|
||||
<!-- <div class="hidden lg:flex items-center">
|
||||
<div class="min-w-4">{{ user.stock }}</div> -->
|
||||
<!-- Low stock -->
|
||||
<!-- <div
|
||||
class="flex items-end ml-2 w-1 h-4 bg-red-200 rounded overflow-hidden"
|
||||
*ngIf="user.stock < 20"
|
||||
>
|
||||
<div class="flex w-full h-1/3 bg-red-600"></div>
|
||||
</div> -->
|
||||
<!-- Medium stock -->
|
||||
<!-- <div
|
||||
class="flex items-end ml-2 w-1 h-4 bg-orange-200 rounded overflow-hidden"
|
||||
*ngIf="user.stock >= 20 && user.stock < 30"
|
||||
>
|
||||
<div class="flex w-full h-2/4 bg-orange-400"></div>
|
||||
</div> -->
|
||||
<!-- High stock -->
|
||||
<!-- <div
|
||||
class="flex items-end ml-2 w-1 h-4 bg-green-100 rounded overflow-hidden"
|
||||
*ngIf="user.stock >= 30"
|
||||
>
|
||||
<div class="flex w-full h-full bg-green-400"></div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<!-- Active -->
|
||||
<!-- <div class="hidden lg:block">
|
||||
<ng-container *ngIf="user.active">
|
||||
<mat-icon
|
||||
class="text-green-400 icon-size-5"
|
||||
[svgIcon]="'heroicons_solid:check'"
|
||||
></mat-icon>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="!user.active">
|
||||
<mat-icon
|
||||
class="text-gray-400 icon-size-5"
|
||||
[svgIcon]="'heroicons_solid:x'"
|
||||
></mat-icon>
|
||||
</ng-container>
|
||||
</div> -->
|
||||
|
||||
<!-- Details button -->
|
||||
<!-- <div>
|
||||
<button
|
||||
class="min-w-10 min-h-7 h-7 px-2 leading-6"
|
||||
mat-stroked-button
|
||||
(click)="__toggleDetails(user.id)"
|
||||
>
|
||||
<mat-icon
|
||||
class="icon-size-5"
|
||||
[svgIcon]="
|
||||
selectedUser?.id === user.id
|
||||
? 'heroicons_solid:chevron-up'
|
||||
: 'heroicons_solid:chevron-down'
|
||||
"
|
||||
></mat-icon>
|
||||
</button>
|
||||
</div> -->
|
||||
</div>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</div>
|
||||
<div>
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<span><b>현재 접속자 & 전체회원 쪽지보내기</b></span>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<!-- 구분 -->
|
||||
<!-- <div class="flex">
|
||||
<mat-form-field class="w-1/3 pr-2">
|
||||
<mat-label>구분</mat-label>
|
||||
<mat-radio-group>
|
||||
<mat-radio-button value="auto">전체</mat-radio-button>
|
||||
<mat-radio-button value="auto"
|
||||
>현재 접속자</mat-radio-button
|
||||
>
|
||||
<mat-radio-button value="auto">본사</mat-radio-button>
|
||||
<mat-radio-button value="auto">대본</mat-radio-button>
|
||||
<mat-radio-button value="auto">부본</mat-radio-button>
|
||||
<mat-radio-button value="auto">총판</mat-radio-button>
|
||||
<mat-radio-button value="auto">매장</mat-radio-button>
|
||||
<mat-radio-button value="auto">회원</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
</mat-form-field>
|
||||
</div> -->
|
||||
|
||||
<!-- 대본아이디 -->
|
||||
<!-- <div class="flex">
|
||||
<mat-form-field class="w-1/3 pr-2">
|
||||
<mat-label>대본아이디</mat-label>
|
||||
<mat-form-field class="w-1/3 pr-2">
|
||||
<mat-label>
|
||||
<mat-radio-group>
|
||||
<mat-radio-button value="auto"
|
||||
>대본하부회원</mat-radio-button
|
||||
>
|
||||
</mat-radio-group>
|
||||
</mat-label>
|
||||
<mat-select>
|
||||
<mat-option value="brand.id">
|
||||
brand option
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</mat-form-field>
|
||||
</div> -->
|
||||
|
||||
<!-- 부본아이디 -->
|
||||
<!-- <div class="flex">
|
||||
<mat-form-field class="w-1/3 pr-2">
|
||||
<mat-label>부본아이디</mat-label>
|
||||
<mat-form-field class="w-1/3 pr-2">
|
||||
<mat-label>
|
||||
<mat-radio-group>
|
||||
<mat-radio-button value="auto"
|
||||
>부본하부회원</mat-radio-button
|
||||
>
|
||||
</mat-radio-group>
|
||||
</mat-label>
|
||||
<mat-select>
|
||||
<mat-option value="brand.id">
|
||||
brand option
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</mat-form-field>
|
||||
</div> -->
|
||||
<div class="flex">
|
||||
<mat-form-field class="w-1/3 pr-2">
|
||||
<mat-label>제목</mat-label>
|
||||
<input matInput />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<mat-form-field class="w-1/3 pr-2">
|
||||
<mat-label>글쓴이</mat-label>
|
||||
<input matInput placeholder="관리자" />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<mat-form-field class="w-1/3 pr-2">
|
||||
<mat-label>내용</mat-label>
|
||||
<input matInput />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<mat-form-field class="w-1/3 pr-2">
|
||||
<input matInput />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</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-template #noCurrentUser>
|
||||
<div
|
||||
class="p-8 sm:p-16 border-t text-4xl font-semibold tracking-tight text-center"
|
||||
>
|
||||
There are no currentUser!
|
||||
</div>
|
||||
</ng-template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,198 @@
|
|||
import {
|
||||
AfterViewInit,
|
||||
ChangeDetectionStrategy,
|
||||
ChangeDetectorRef,
|
||||
Component,
|
||||
OnDestroy,
|
||||
OnInit,
|
||||
ViewChild,
|
||||
ViewEncapsulation,
|
||||
} from '@angular/core';
|
||||
import {
|
||||
FormBuilder,
|
||||
FormControl,
|
||||
FormGroup,
|
||||
Validators,
|
||||
} from '@angular/forms';
|
||||
import { MatCheckboxChange } from '@angular/material/checkbox';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import {
|
||||
debounceTime,
|
||||
map,
|
||||
merge,
|
||||
Observable,
|
||||
Subject,
|
||||
switchMap,
|
||||
takeUntil,
|
||||
} from 'rxjs';
|
||||
import { fuseAnimations } from '@fuse/animations';
|
||||
import { FuseConfirmationService } from '@fuse/services/confirmation';
|
||||
|
||||
import { User } from '../../user/models/user';
|
||||
import { CurrentUser } from '../models/current-user';
|
||||
import { CurrentUserPagination } from '../models/current-user-pagination';
|
||||
import { CurrentUserService } from '../services/current-user.service';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'currentUser-list',
|
||||
templateUrl: './list.component.html',
|
||||
styles: [
|
||||
/* language=SCSS */
|
||||
`
|
||||
.inventory-grid {
|
||||
grid-template-columns: 60px auto 40px;
|
||||
|
||||
@screen sm {
|
||||
grid-template-columns: 60px auto 60px 72px;
|
||||
}
|
||||
|
||||
@screen md {
|
||||
grid-template-columns: 60px 60px auto 112px 72px;
|
||||
}
|
||||
|
||||
@screen lg {
|
||||
grid-template-columns: 60px 60px auto 112px 96px 96px 72px;
|
||||
}
|
||||
}
|
||||
`,
|
||||
],
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
animations: fuseAnimations,
|
||||
})
|
||||
export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
@ViewChild(MatPaginator) private _paginator!: MatPaginator;
|
||||
@ViewChild(MatSort) private _sort!: MatSort;
|
||||
|
||||
currentUsers$!: Observable<CurrentUser[] | undefined>;
|
||||
users$!: Observable<User[] | undefined>;
|
||||
|
||||
isLoading = false;
|
||||
searchInputControl = new FormControl();
|
||||
selectedCurrentUser?: CurrentUser;
|
||||
pagination?: CurrentUserPagination;
|
||||
|
||||
private _unsubscribeAll: Subject<any> = new Subject<any>();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
constructor(
|
||||
private _changeDetectorRef: ChangeDetectorRef,
|
||||
private _fuseConfirmationService: FuseConfirmationService,
|
||||
private _formBuilder: FormBuilder,
|
||||
private _currentUserService: CurrentUserService,
|
||||
private router: Router
|
||||
) {}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Lifecycle hooks
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* On init
|
||||
*/
|
||||
ngOnInit(): void {
|
||||
// Get the pagination
|
||||
this._currentUserService.pagination$
|
||||
.pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe((pagination: CurrentUserPagination | undefined) => {
|
||||
// Update the pagination
|
||||
this.pagination = pagination;
|
||||
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
|
||||
// Get the products
|
||||
this.currentUsers$ = this._currentUserService.currentUsers$;
|
||||
}
|
||||
|
||||
/**
|
||||
* After view init
|
||||
*/
|
||||
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 currentUser 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._currentUserService.getCurrentUsers(
|
||||
this._paginator.pageIndex,
|
||||
this._paginator.pageSize,
|
||||
this._sort.active,
|
||||
this._sort.direction
|
||||
);
|
||||
}),
|
||||
map(() => {
|
||||
this.isLoading = false;
|
||||
})
|
||||
)
|
||||
.subscribe();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On destroy
|
||||
*/
|
||||
ngOnDestroy(): void {
|
||||
// Unsubscribe from all subscriptions
|
||||
this._unsubscribeAll.next(null);
|
||||
this._unsubscribeAll.complete();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Public methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
viewUserDetail(id: string): void {
|
||||
let url: string = 'member/user/' + id;
|
||||
this.router.navigateByUrl(url);
|
||||
}
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Private methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Create product
|
||||
*/
|
||||
__createProduct(): void {}
|
||||
|
||||
/**
|
||||
* Toggle product details
|
||||
*
|
||||
* @param productId
|
||||
*/
|
||||
__toggleDetails(productId: string): void {}
|
||||
|
||||
/**
|
||||
* Track by function for ngFor loops
|
||||
*
|
||||
* @param index
|
||||
* @param item
|
||||
*/
|
||||
__trackByFn(index: number, item: any): any {
|
||||
return item.id || index;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatPaginatorModule } from '@angular/material/paginator';
|
||||
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
||||
import { MatRippleModule } from '@angular/material/core';
|
||||
import { MatSortModule } from '@angular/material/sort';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { MatGridListModule } from '@angular/material/grid-list';
|
||||
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
||||
import { MatRadioModule } from '@angular/material/radio';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
|
||||
import { TranslocoModule } from '@ngneat/transloco';
|
||||
|
||||
import { SharedModule } from 'app/shared/shared.module';
|
||||
|
||||
import { COMPONENTS } from './components';
|
||||
|
||||
import { currentUserRoutes } from './current-user.routing';
|
||||
@NgModule({
|
||||
declarations: [COMPONENTS],
|
||||
imports: [
|
||||
TranslocoModule,
|
||||
SharedModule,
|
||||
RouterModule.forChild(currentUserRoutes),
|
||||
|
||||
MatButtonModule,
|
||||
MatFormFieldModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
MatPaginatorModule,
|
||||
MatProgressBarModule,
|
||||
MatRippleModule,
|
||||
MatSortModule,
|
||||
MatSelectModule,
|
||||
MatTooltipModule,
|
||||
MatGridListModule,
|
||||
MatSlideToggleModule,
|
||||
MatRadioModule,
|
||||
MatCardModule,
|
||||
],
|
||||
})
|
||||
export class CurrentUserModule {}
|
|
@ -0,0 +1,24 @@
|
|||
import { Route } from '@angular/router';
|
||||
|
||||
import { ListComponent } from './components/list.component';
|
||||
import { ViewComponent } from '../user/components/view.component';
|
||||
|
||||
import { CurrentUsersResolver } from './resolvers/current-user.resolver';
|
||||
import { UserResolver } from '../user/resolvers/user.resolver';
|
||||
|
||||
export const currentUserRoutes: Route[] = [
|
||||
{
|
||||
path: '',
|
||||
component: ListComponent,
|
||||
resolve: {
|
||||
curretnUsers: CurrentUsersResolver,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
component: ViewComponent,
|
||||
resolve: {
|
||||
users: UserResolver,
|
||||
},
|
||||
},
|
||||
];
|
|
@ -0,0 +1,8 @@
|
|||
export interface CurrentUserPagination {
|
||||
length: number;
|
||||
size: number;
|
||||
page: number;
|
||||
lastPage: number;
|
||||
startIndex: number;
|
||||
endIndex: number;
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
export interface CurrentUser {
|
||||
id?: string;
|
||||
index?: number;
|
||||
nickname?: string;
|
||||
highRank?: string;
|
||||
rank?: string;
|
||||
level?: string;
|
||||
currentLocation?: string;
|
||||
cash?: number;
|
||||
gameMoney?: number;
|
||||
comp?: number;
|
||||
siteAddress?: string;
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import {
|
||||
ActivatedRouteSnapshot,
|
||||
Resolve,
|
||||
Router,
|
||||
RouterStateSnapshot,
|
||||
} from '@angular/router';
|
||||
import { catchError, Observable, throwError } from 'rxjs';
|
||||
|
||||
import { CurrentUser } from '../models/current-user';
|
||||
import { CurrentUserPagination } from '../models/current-user-pagination';
|
||||
import { CurrentUserService } from '../services/current-user.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class CurrentUserResolver implements Resolve<any> {
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
constructor(
|
||||
private _currentUserService: CurrentUserService,
|
||||
private _router: Router
|
||||
) {}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Public methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Resolver
|
||||
*
|
||||
* @param route
|
||||
* @param state
|
||||
*/
|
||||
resolve(
|
||||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot
|
||||
): Observable<CurrentUser | undefined> {
|
||||
return this._currentUserService
|
||||
.getCurrentUserById(route.paramMap.get('id'))
|
||||
.pipe(
|
||||
// Error here means the requested product is not available
|
||||
catchError((error) => {
|
||||
// Log the error
|
||||
console.error(error);
|
||||
|
||||
// Get the parent url
|
||||
const parentUrl = state.url.split('/').slice(0, -1).join('/');
|
||||
|
||||
// Navigate to there
|
||||
this._router.navigateByUrl(parentUrl);
|
||||
|
||||
// Throw an error
|
||||
return throwError(error);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class CurrentUsersResolver implements Resolve<any> {
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
constructor(private _currentUserService: CurrentUserService) {}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Public methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Resolver
|
||||
*
|
||||
* @param route
|
||||
* @param state
|
||||
*/
|
||||
resolve(
|
||||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot
|
||||
): Observable<{
|
||||
pagination: CurrentUserPagination;
|
||||
currentUsers: CurrentUser[];
|
||||
}> {
|
||||
return this._currentUserService.getCurrentUsers();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,158 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import {
|
||||
BehaviorSubject,
|
||||
filter,
|
||||
map,
|
||||
Observable,
|
||||
of,
|
||||
switchMap,
|
||||
take,
|
||||
tap,
|
||||
throwError,
|
||||
} from 'rxjs';
|
||||
|
||||
import { CurrentUser } from '../models/current-user';
|
||||
import { CurrentUserPagination } from '../models/current-user-pagination';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class CurrentUserService {
|
||||
// Private
|
||||
private __pagination = new BehaviorSubject<CurrentUserPagination | undefined>(
|
||||
undefined
|
||||
);
|
||||
private __currentUser = new BehaviorSubject<CurrentUser | undefined>(
|
||||
undefined
|
||||
);
|
||||
private __currentUsers = new BehaviorSubject<CurrentUser[] | undefined>(
|
||||
undefined
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
constructor(private _httpClient: HttpClient) {}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Accessors
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Getter for pagination
|
||||
*/
|
||||
get pagination$(): Observable<CurrentUserPagination | undefined> {
|
||||
return this.__pagination.asObservable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for currentUser
|
||||
*/
|
||||
get currentUser$(): Observable<CurrentUser | undefined> {
|
||||
return this.__currentUser.asObservable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for currentUsers
|
||||
*/
|
||||
get currentUsers$(): Observable<CurrentUser[] | undefined> {
|
||||
return this.__currentUsers.asObservable();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Public methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get currentUsers
|
||||
*
|
||||
*
|
||||
* @param page
|
||||
* @param size
|
||||
* @param sort
|
||||
* @param order
|
||||
* @param search
|
||||
*/
|
||||
getCurrentUsers(
|
||||
page: number = 0,
|
||||
size: number = 10,
|
||||
sort: string = 'name',
|
||||
order: 'asc' | 'desc' | '' = 'asc',
|
||||
search: string = ''
|
||||
): Observable<{
|
||||
pagination: CurrentUserPagination;
|
||||
currentUsers: CurrentUser[];
|
||||
}> {
|
||||
return this._httpClient
|
||||
.get<{ pagination: CurrentUserPagination; currentUsers: CurrentUser[] }>(
|
||||
'api/apps/member/current-user/current-users',
|
||||
{
|
||||
params: {
|
||||
page: '' + page,
|
||||
size: '' + size,
|
||||
sort,
|
||||
order,
|
||||
search,
|
||||
},
|
||||
}
|
||||
)
|
||||
.pipe(
|
||||
tap((response) => {
|
||||
this.__pagination.next(response.pagination);
|
||||
this.__currentUsers.next(response.currentUsers);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get product by id
|
||||
*/
|
||||
getCurrentUserById(id: string | null): Observable<CurrentUser> {
|
||||
return this.__currentUsers.pipe(
|
||||
take(1),
|
||||
map((currentUsers) => {
|
||||
// Find the product
|
||||
const currentUser =
|
||||
currentUsers?.find((item) => item.id === id) || undefined;
|
||||
|
||||
// Update the product
|
||||
this.__currentUser.next(currentUser);
|
||||
|
||||
// Return the product
|
||||
return currentUser;
|
||||
}),
|
||||
switchMap((product) => {
|
||||
if (!product) {
|
||||
return throwError('Could not found product with id of ' + id + '!');
|
||||
}
|
||||
|
||||
return of(product);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create product
|
||||
*/
|
||||
createCurrentUser(): Observable<CurrentUser> {
|
||||
return this.currentUsers$.pipe(
|
||||
take(1),
|
||||
switchMap((currentUsers) =>
|
||||
this._httpClient
|
||||
.post<CurrentUser>('api/apps/member/currentUser/product', {})
|
||||
.pipe(
|
||||
map((newCurrentUser) => {
|
||||
// Update the currentUsers with the new product
|
||||
if (!!currentUsers) {
|
||||
this.__currentUsers.next([newCurrentUser, ...currentUsers]);
|
||||
}
|
||||
|
||||
// Return the new product
|
||||
return newCurrentUser;
|
||||
})
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -13,5 +13,6 @@
|
|||
"Powerball": "Powerball",
|
||||
"Casino": "Casino",
|
||||
"Evolution": "Evolution",
|
||||
"Slot": "Slot"
|
||||
"Slot": "Slot",
|
||||
"Current User": "Current User"
|
||||
}
|
||||
|
|
|
@ -13,5 +13,6 @@
|
|||
"Powerball": "파워볼",
|
||||
"Casino": "카지노배팅리스트",
|
||||
"Evolution": "에볼루션배팅리스트",
|
||||
"Slot": "슬롯배팅리스트"
|
||||
"Slot": "슬롯배팅리스트",
|
||||
"Current User": "현재접속자 & 쪽지전송"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user