diff --git a/src/app/auth/login/login.component.ts b/src/app/auth/login/login.component.ts index 0466d42..2f9b015 100644 --- a/src/app/auth/login/login.component.ts +++ b/src/app/auth/login/login.component.ts @@ -46,13 +46,22 @@ export class LoginComponent implements OnInit { try { // const result = await lastValueFrom(this.authService.login(this.dataForm)); let cathayResult: any = await lastValueFrom(this.cathayAuthService.login(this.cathayForm)); + let isAdmin = cathayResult.token.userName == ROLE_ADMIN ? true : false cathayResult = { ...cathayResult, - isAdmin: cathayResult.token.userName == ROLE_ADMIN ? true : false + isAdmin: isAdmin } this.appService.setToken(cathayResult.token.token) this.appService.setAuth(cathayResult); - return this.router.navigate(['/pages']); + + if(isAdmin){ + return this.router.navigate(['/pages']); + } + + if(!isAdmin){ + return this.router.navigate(['/pages/report/transactions']); + } + } catch (err) { return this.appService.message(EAction.ERROR, EText.NO_DATA); } diff --git a/src/app/pages/report/transactions/components/user-information/user-information.component.html b/src/app/pages/report/transactions/components/user-information/user-information.component.html new file mode 100644 index 0000000..8a0d33f --- /dev/null +++ b/src/app/pages/report/transactions/components/user-information/user-information.component.html @@ -0,0 +1,79 @@ +

{{ title }}

+
+
+
+ User Name: + + {{ user?.userName || '-'}} + + +
+
+ +
+
+ ชื่อเต็ม + + {{ user?.fullName || '-'}} + + +
+
+ +
+
+ อีเมล์ + + {{ user?.email || '-'}} + + +
+
+ +
+
+ เบอร์โทรศัพท์ + + {{ user?.phoneNumber || '-'}} + + +
+
+ +
+
+ เลขบัตรกดเงินสด + + {{ user?.personalCardId || '-'}} + + + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+
diff --git a/src/app/pages/report/transactions/components/user-information/user-information.component.scss b/src/app/pages/report/transactions/components/user-information/user-information.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/report/transactions/components/user-information/user-information.component.spec.ts b/src/app/pages/report/transactions/components/user-information/user-information.component.spec.ts new file mode 100644 index 0000000..c67ab12 --- /dev/null +++ b/src/app/pages/report/transactions/components/user-information/user-information.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { UserInformationComponent } from './user-information.component'; + +describe('UserInformationComponent', () => { + let component: UserInformationComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ UserInformationComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(UserInformationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/report/transactions/components/user-information/user-information.component.ts b/src/app/pages/report/transactions/components/user-information/user-information.component.ts new file mode 100644 index 0000000..e7bfa44 --- /dev/null +++ b/src/app/pages/report/transactions/components/user-information/user-information.component.ts @@ -0,0 +1,11 @@ +import { Component, Input } from '@angular/core'; + +@Component({ + selector: 'app-user-information', + templateUrl: './user-information.component.html', + styleUrls: ['./user-information.component.scss'] +}) +export class UserInformationComponent { + @Input() title: string = '' + @Input() user +} diff --git a/src/app/pages/report/transactions/container/transactions/transactions.container.ts b/src/app/pages/report/transactions/container/transactions/transactions.container.ts index 7c18ab4..211ba90 100644 --- a/src/app/pages/report/transactions/container/transactions/transactions.container.ts +++ b/src/app/pages/report/transactions/container/transactions/transactions.container.ts @@ -1,5 +1,7 @@ import { Component } from '@angular/core'; import { Observable, map } from 'rxjs'; +import { AppService } from 'src/app/app.service'; +import { AuthService } from 'src/app/core/service/auth/auth.service'; import { ReportService } from 'src/app/core/service/common/report.service'; import { TransactionService } from 'src/app/core/service/transaction/transaction.service'; @@ -10,11 +12,11 @@ import { TransactionService } from 'src/app/core/service/transaction/transaction }) export class TransactionsContainer { report$ = new Observable(); + private isAdmin: boolean = false constructor( - - private transactionSV: TransactionService + private transactionSV: TransactionService, + private appSV: AppService ) { - // this.report$ = this.transactionSV.getAll() } onSearchTransaction(event) { @@ -22,7 +24,7 @@ export class TransactionsContainer { let req = { "id": "", "payeeUserAccountId": "", - "payerUserAccountId": "", + "payerUserAccountId": this.isAdmin ? "" : this.appSV.auth().token.id, "invoiceId": "", "referencE1": "", "referencE2": "", diff --git a/src/app/pages/report/transactions/presenter/list/list.component.html b/src/app/pages/report/transactions/presenter/list/list.component.html index 3aa05db..db982a9 100644 --- a/src/app/pages/report/transactions/presenter/list/list.component.html +++ b/src/app/pages/report/transactions/presenter/list/list.component.html @@ -90,7 +90,8 @@ ref 3 -
{{item.price | number : '1.2-2'}}
+ {{item.referencE3 }} +
@@ -127,7 +128,7 @@ More Detail
-
+
diff --git a/src/app/pages/report/transactions/presenter/list/list.component.ts b/src/app/pages/report/transactions/presenter/list/list.component.ts index cc62707..77d8233 100644 --- a/src/app/pages/report/transactions/presenter/list/list.component.ts +++ b/src/app/pages/report/transactions/presenter/list/list.component.ts @@ -25,6 +25,7 @@ export class ListComponent extends BaseList implements OnChanges { ) { super() } + ngOnChanges(changes: SimpleChanges): void { if('reportList' in changes){ this.reportList = this.updateMatTable(changes.reportList.currentValue || []) @@ -42,9 +43,12 @@ export class ListComponent extends BaseList implements OnChanges { this.onSearch.emit(this.request) } - openDialog(payerUserAccountId){ - console.log(payerUserAccountId) - this.dialogConfig.data.ids = payerUserAccountId + openDialog(transaction){ + console.log(transaction) + this.dialogConfig.data.datas = { + payerUserAccountId: transaction.payerUserAccountId, + payeeUserAccountId: transaction.payeeUserAccountId + } const dialogRef = this.dialog.open(TransactionDialogComponent,this.dialogConfig); } } diff --git a/src/app/pages/report/transactions/presenter/transaction-dialog/transaction-dialog.component.html b/src/app/pages/report/transactions/presenter/transaction-dialog/transaction-dialog.component.html index c289eea..741e99e 100644 --- a/src/app/pages/report/transactions/presenter/transaction-dialog/transaction-dialog.component.html +++ b/src/app/pages/report/transactions/presenter/transaction-dialog/transaction-dialog.component.html @@ -5,84 +5,8 @@ clear
-
-
-
- User Name: - - {{ userInformation?.userName || '-'}} - - -
-
- -
-
- ชื่อเต็ม - - {{ userInformation?.fullName || '-'}} - - -
-
- -
-
- อีเมล์ - - {{ userInformation?.email || '-'}} - - -
-
- -
-
- เบอร์โทรศัพท์ - - {{ userInformation?.phoneNumber || '-'}} - - -
-
- -
-
- เลขบัตรกดเงินสด - - {{ userInformation?.personalCardId || '-'}} - - - -
-
- -
-
- - -
-
- -
-
- - -
-
-
+ +
diff --git a/src/app/pages/report/transactions/presenter/transaction-dialog/transaction-dialog.component.ts b/src/app/pages/report/transactions/presenter/transaction-dialog/transaction-dialog.component.ts index 9654228..b952a88 100644 --- a/src/app/pages/report/transactions/presenter/transaction-dialog/transaction-dialog.component.ts +++ b/src/app/pages/report/transactions/presenter/transaction-dialog/transaction-dialog.component.ts @@ -8,6 +8,40 @@ import { EAction } from 'src/app/@config/app'; import { AppService } from 'src/app/app.service'; import { KycService } from 'src/app/core/service/common/kyc.service'; import { UserCathayService } from 'src/app/core/service/users/user-cathay.service'; +export interface UserCathay { + fullName: string + nationalProfileId: any + createdDate: string + updatedDate: string + mobileDeviceId: string + personalCardId: string + parentId: string + pinLogin: string + userType: string + customerTypeId: string + genderCode: any + maritalStatusCode: any + titleCode: any + lockoutEndDateUtc: any + roleId: any + role: any + roleList: any + id: string + userName: string + normalizedUserName: string + email: string + normalizedEmail: string + emailConfirmed: boolean + passwordHash: string + securityStamp: string + concurrencyStamp: string + phoneNumber: string + phoneNumberConfirmed: boolean + twoFactorEnabled: boolean + lockoutEnd: any + lockoutEnabled: boolean + accessFailedCount: number +} @@ -17,7 +51,8 @@ import { UserCathayService } from 'src/app/core/service/users/user-cathay.servic styleUrls: ['./transaction-dialog.component.scss'] }) export class TransactionDialogComponent { - userInformation + userPayeeInformation: UserCathay + userPayerInformation: UserCathay constructor( public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: any, @@ -28,8 +63,14 @@ export class TransactionDialogComponent { ) { - this.userCathaySV.getUserCathay(this.data.ids) - .subscribe((data: any) => this.userInformation = {...data.data}) + + let { payerUserAccountId, payeeUserAccountId } = this.data.datas + + this.userCathaySV.getUserCathay(payerUserAccountId) + .subscribe((data: any) => this.userPayerInformation = {...data.data}) + + this.userCathaySV.getUserCathay(payeeUserAccountId) + .subscribe(r => this.userPayeeInformation = {...data.data}) } } diff --git a/src/app/pages/report/transactions/transactions.module.ts b/src/app/pages/report/transactions/transactions.module.ts index eb1198e..9b057a0 100644 --- a/src/app/pages/report/transactions/transactions.module.ts +++ b/src/app/pages/report/transactions/transactions.module.ts @@ -6,6 +6,7 @@ import { ListComponent } from "./presenter/list/list.component"; import { TransactionsRouter } from "./router/router"; import { TransactionsContainer } from "./container/transactions/transactions.container"; import { TransactionDialogComponent } from './presenter/transaction-dialog/transaction-dialog.component'; +import { UserInformationComponent } from './components/user-information/user-information.component'; const routes: Routes = [ @@ -26,7 +27,8 @@ const routes: Routes = [ TransactionsRouter, TransactionsContainer, ListComponent, - TransactionDialogComponent + TransactionDialogComponent, + UserInformationComponent ], imports: [ AppSharedModule,