diff --git a/src/app/pages/accounts/component/authentication/authentication.component.html b/src/app/pages/accounts/component/authentication/authentication.component.html index 9d37d6e..b7808b8 100644 --- a/src/app/pages/accounts/component/authentication/authentication.component.html +++ b/src/app/pages/accounts/component/authentication/authentication.component.html @@ -1,54 +1,74 @@
-
- -
- +
LOGIN TO YOUR ACCOUNT
-
- + username - + mail username is required - + Please enter a valid username Password - + vpn_key Password is required -
+ - - -
-
- -
\ No newline at end of file +
diff --git a/src/app/pages/accounts/component/authentication/authentication.component.ts b/src/app/pages/accounts/component/authentication/authentication.component.ts index bba9669..6e87130 100644 --- a/src/app/pages/accounts/component/authentication/authentication.component.ts +++ b/src/app/pages/accounts/component/authentication/authentication.component.ts @@ -64,10 +64,11 @@ export class AuthenticationComponent implements OnInit { } onSubmit(): void { - let userName = this.loginForm.get('username').value; - let password = this.loginForm.get('password').value; - - this._authService.authenticate(userName, password) + this._authService + .authenticate( + this.loginForm.get('username').value, + this.loginForm.get('password').value + ) .pipe(take(1)) .subscribe( res => { diff --git a/src/app/pages/users/user/component/user-detail/user-detail.component.html b/src/app/pages/users/user/component/user-detail/user-detail.component.html index 77b20e5..fbf05ce 100644 --- a/src/app/pages/users/user/component/user-detail/user-detail.component.html +++ b/src/app/pages/users/user/component/user-detail/user-detail.component.html @@ -1,449 +1,235 @@
+ +
+ - -
- - - -
- - -
- - -
- - - -
-
- Order {{user.reference}} -
-
- from - {{user.customer.firstName}} {{user.customer.lastName}} -
-
-
- + +
+ +
+ +
+ +
+
User {{ user.username }}
+
+ {{ user.nickname }} +
- - - -
- - -
- - - - - -
- -
- -
- account_circle -
Customer
-
- -
- - - - - - - - - - - - - - - - - -
NameEmailPhoneCompany
-
- - {{user.customer.firstName}} - {{user.customer.lastName}} - -
-
- - - {{user.customer.phone}} - - {{user.customer.company}} - -
-
- - - - - - - Shipping Address - - -
-
{{user.customer.shippingAddress.address}} -
- -
- -
- - - - - Invoice Address - - -
-
{{user.customer.invoiceAddress.address}} -
- -
- -
- -
- -
- -
- -
- access_time -
Order Status
-
- - - - - - - - - - - - - - - -
StatusUpdated On
- - {{status.name}} - - - - {{status.date | date}} - -
- - - -
- -
- -
- attach_money -
Payment
-
- - - - - - - - - - - - - - - - - - -
TransactionIDPayment MethodAmountDate
- - {{user.payment.transactionId}} - - - - {{user.payment.method}} - - - - {{user.payment.amount}} - - - - {{user.payment.date | date}} - -
-
- - -
- -
- local_shipping -
Shipping
-
- - - - - - - - - - - - - - - - - - - - -
Tracking CodeCarrierWeightFeeDate
- {{shipping.tracking}} - - {{shipping.carrier}} - - {{shipping.weight}} - - {{shipping.fee}} - - {{shipping.date}} -
-
- -
-
- - -
- - - - - - - - - - - - - - - - - - - -
IDImageNamePriceQuantity
- {{product.id}} - - - - {{product.name}} - - {{product.price}} - - {{product.quantity}} -
-
-
- - - -
- -
- -
- - -
- -
-
{{user.date}}
- -
-
-
- INVOICE - {{user.reference}} -
- -
-
- {{user.customer.firstName}} - {{user.customer.lastName}} -
-
- {{user.customer.invoiceAddress.address}} -
-
{{user.customer.phone}}
- -
-
- -
- - -
-
FUSE INC.
-
2810 Country Club Road Cranford, NJ 07016 -
-
+66 123 455 87
- -
www.fuseinc.com
-
-
-
-
- -
- - - - - - - - - - - - - - - - - - -
PRODUCTPRICEQUANTITYTOTAL
-
- {{product.name}} -
-
- {{product.price | currency:'USD':'symbol'}} - - {{product.quantity}} - - {{product.total | currency:'USD':'symbol'}} -
- - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
-
-
-
- -
- -
- - -
- - +
+
- -
\ No newline at end of file + + + +
+ +
+ + +
+
+
+ account_circle +
기본정보
+
+ +
+
+
+ + 아이디 (disabled) + +   + +
+
+ + 패스워드 + +   + +
+
+ + 이메일 + +   + +
+
+ + 연락처 + phone + +   + +
+
+ + 닉네임 + +   + +
+
+ + Notes + + +
+
+ +
+
+
+
+ +
+
+
+
+
+
+ + +
+
+
+
+ +
+ +
+ +
diff --git a/src/app/pages/users/user/component/user-detail/user-detail.component.ts b/src/app/pages/users/user/component/user-detail/user-detail.component.ts index 1959c86..257681e 100644 --- a/src/app/pages/users/user/component/user-detail/user-detail.component.ts +++ b/src/app/pages/users/user/component/user-detail/user-detail.component.ts @@ -4,6 +4,9 @@ import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { fuseAnimations } from 'src/@fuse/animations'; +import { User } from 'src/modules/user/model/user.model'; +import { UserService } from 'src/modules/user/service/user.service'; +import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'app-user-user-detail', @@ -13,7 +16,8 @@ import { fuseAnimations } from 'src/@fuse/animations'; animations: fuseAnimations }) export class UserDetailComponent implements OnInit, OnDestroy { - user: any; + user: User; + userForm: FormGroup; // Private private _unsubscribeAll: Subject; @@ -24,7 +28,11 @@ export class UserDetailComponent implements OnInit, OnDestroy { * @param {EcommerceOrderService} userService * @param {FormBuilder} _formBuilder */ - constructor(private _formBuilder: FormBuilder) { + constructor( + private userService: UserService, + private activatedRoute: ActivatedRoute, + private formBuilder: FormBuilder + ) { // Set the defaults // Set the private defaults this._unsubscribeAll = new Subject(); @@ -39,6 +47,11 @@ export class UserDetailComponent implements OnInit, OnDestroy { */ ngOnInit(): void { // Subscribe to update order on changes + this.activatedRoute.data.subscribe(data => { + this.user = data.user; + + this.initializeForm(); + }); } /** @@ -50,6 +63,24 @@ export class UserDetailComponent implements OnInit, OnDestroy { this._unsubscribeAll.complete(); } + // ----------------------------------------------------------------------------------------------------- + // @ Private methods + // ----------------------------------------------------------------------------------------------------- + initializeForm(): void { + this.userForm = this.formBuilder.group({ + username: [ + { + value: this.user.username, + disabled: true + } + ], + password: '', + email: '', + nickname: '', + phone: '' + }); + } + // ----------------------------------------------------------------------------------------------------- // @ Public methods // ----------------------------------------------------------------------------------------------------- @@ -57,5 +88,15 @@ export class UserDetailComponent implements OnInit, OnDestroy { /** * Update status */ - updateStatus(): void {} + updateStatus(): void { + // const newStatusId = Number.parseInt(this.statusForm.get('newStatus').value); + // if (!newStatusId) { + // return; + // } + // const newStatus = this.orderStatuses.find(status => { + // return status.id === newStatusId; + // }); + // newStatus['date'] = new Date().toString(); + // this.order.status.unshift(newStatus); + } } diff --git a/src/app/pages/users/user/component/user-list/user-list.component.html b/src/app/pages/users/user/component/user-list/user-list.component.html index 359c7e4..d5033d7 100644 --- a/src/app/pages/users/user/component/user-list/user-list.component.html +++ b/src/app/pages/users/user/component/user-list/user-list.component.html @@ -38,7 +38,7 @@ fusePerfectScrollbar> - 아이디/닉네임 + 아이디

{{ user.username }}

@@ -54,16 +54,17 @@
+ + {{ user.status }} 정상

- + --> 보유금 @@ -165,22 +166,22 @@ - + - 10 -

- + {{ user.coupon }} + 10 +

+
- + --> 가입날짜

- {{ user.createAt }} + {{ user.createdAt | date: 'yyyy-mm-dd HH:mm'}}

@@ -190,7 +191,7 @@ 최근접속일

- {{ user.updateAt }} + {{ user.updatedAt | date: 'yyyy-mm-dd HH:mm'}}

@@ -207,8 +208,8 @@ - + diff --git a/src/app/pages/users/user/component/user-list/user-list.component.ts b/src/app/pages/users/user/component/user-list/user-list.component.ts index eb539d3..df69911 100644 --- a/src/app/pages/users/user/component/user-list/user-list.component.ts +++ b/src/app/pages/users/user/component/user-list/user-list.component.ts @@ -37,7 +37,7 @@ export class UserListComponent implements OnInit, OnDestroy, AfterViewInit { displayedColumns = [ 'username', 'phone', - 'status', + // 'status', 'totalPrice', 'point', 'level', @@ -47,7 +47,7 @@ export class UserListComponent implements OnInit, OnDestroy, AfterViewInit { 'numberOfBets', 'referrals', 'recommender', - 'couponStatus', + // 'couponStatus', 'registerDate', 'recentConnectDate', 'recentConnectIp' diff --git a/src/app/pages/users/user/resolver/detail.resolver.ts b/src/app/pages/users/user/resolver/detail.resolver.ts new file mode 100644 index 0000000..da89019 --- /dev/null +++ b/src/app/pages/users/user/resolver/detail.resolver.ts @@ -0,0 +1,31 @@ +import { Injectable } from '@angular/core'; +import { + ActivatedRouteSnapshot, + Resolve, + RouterStateSnapshot +} from '@angular/router'; +import { Observable, of } from 'rxjs'; +import { User } from 'src/modules/user/model/user.model'; +import { UserService } from 'src/modules/user/service/user.service'; + +@Injectable() +export class DetailResolver implements Resolve { + /** + * Constructor + */ + constructor(private userService: UserService) {} + + /** + * Resolver + */ + resolve( + route: ActivatedRouteSnapshot, + state: RouterStateSnapshot + ): Observable | Promise | any { + const id = route.params.id; + if ('0' === id) { + return of({}); + } + return this.userService.getUser(route.params.id); + } +} diff --git a/src/app/pages/users/user/resolver/index.ts b/src/app/pages/users/user/resolver/index.ts new file mode 100644 index 0000000..d11a5dd --- /dev/null +++ b/src/app/pages/users/user/resolver/index.ts @@ -0,0 +1,3 @@ +import { DetailResolver } from './detail.resolver'; + +export const RESOLVERS = [DetailResolver]; diff --git a/src/app/pages/users/user/user-routing.module.ts b/src/app/pages/users/user/user-routing.module.ts index 6980e0d..616ec27 100644 --- a/src/app/pages/users/user/user-routing.module.ts +++ b/src/app/pages/users/user/user-routing.module.ts @@ -7,6 +7,7 @@ import { UserConnectComponent } from './component/user-connect/user-connect.comp import { UserRegistComponent } from './component/user-regist/user-regist.component'; import { UserFeesComponent } from './component/user-fees/user-fees.component'; import { UserAttendanceComponent } from './component/user-attendance/user-attendance.component'; +import { DetailResolver } from './resolver/detail.resolver'; const routes: Routes = [ @@ -15,8 +16,11 @@ const routes: Routes = [ component: UserListComponent, }, { - path: 'list/:userId', - component: UserDetailComponent + path: 'list/:id', + component: UserDetailComponent, + resolve: { + user: DetailResolver + } }, { path: 'connect', diff --git a/src/app/pages/users/user/user.module.ts b/src/app/pages/users/user/user.module.ts index ddf59af..014f6b2 100644 --- a/src/app/pages/users/user/user.module.ts +++ b/src/app/pages/users/user/user.module.ts @@ -17,7 +17,11 @@ import { MatDatepickerModule } from '@angular/material/datepicker'; import { MatDialogModule } from '@angular/material/dialog'; import { MatToolbarModule } from '@angular/material/toolbar'; import { MatTooltipModule } from '@angular/material/tooltip'; -import { CalendarModule as AngularCalendarModule, DateAdapter } from 'angular-calendar'; +import { MatGridListModule } from '@angular/material/grid-list'; +import { + CalendarModule as AngularCalendarModule, + DateAdapter +} from 'angular-calendar'; import { FuseSharedModule } from 'src/@fuse/shared.module'; import { UserRoutingModule } from './user-routing.module'; @@ -25,6 +29,7 @@ import { COMPONENTS } from './component'; import { MatStepperModule } from '@angular/material/stepper'; import { adapterFactory } from 'angular-calendar/date-adapters/date-fns'; +import { RESOLVERS } from './resolver'; @NgModule({ imports: [ @@ -33,6 +38,7 @@ import { adapterFactory } from 'angular-calendar/date-adapters/date-fns'; MatDialogModule, MatChipsModule, MatExpansionModule, + MatGridListModule, MatFormFieldModule, MatIconModule, MatInputModule, @@ -57,6 +63,6 @@ import { adapterFactory } from 'angular-calendar/date-adapters/date-fns'; UserRoutingModule ], declarations: [...COMPONENTS], - + providers: [...RESOLVERS] }) -export class UserModule { } +export class UserModule {} diff --git a/src/modules/user/service/user.service.ts b/src/modules/user/service/user.service.ts index baa6731..9c1345e 100644 --- a/src/modules/user/service/user.service.ts +++ b/src/modules/user/service/user.service.ts @@ -16,4 +16,8 @@ export class UserService { public getAllUsers(): Observable> { return this.httpClient.get>(`${this.apiBaseUrl}/users`, {}); } + + public getUser(id: number): Observable { + return this.httpClient.get(`${this.apiBaseUrl}/users/${id}`, {}); + } }