diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index 62937a2..262adc0 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -68,6 +68,14 @@ export const routes: Routes = [ m => m.LoggingComponent ) }, + { + path: 'transactionLogs', + canActivate: [ActivityGuard], + loadComponent: () => + import('./transaction-logs/transaction-logs.component').then( + m => m.TransactionLogsComponent + ) + }, { path: 'analysis', canActivate: [ActivityGuard], diff --git a/src/app/models/user.ts b/src/app/models/user.ts index 9844065..6a18b8a 100644 --- a/src/app/models/user.ts +++ b/src/app/models/user.ts @@ -7,7 +7,8 @@ export class User { export interface SetupUser { userId: string; userFullname: string; - defaultPassword: string; + password: string; + porOrgacode: string | null; email: string; role: string; } diff --git a/src/app/shared/components/side-nav/side-nav.component.html b/src/app/shared/components/side-nav/side-nav.component.html index 87ece28..66e0cfc 100644 --- a/src/app/shared/components/side-nav/side-nav.component.html +++ b/src/app/shared/components/side-nav/side-nav.component.html @@ -47,7 +47,13 @@ {{ 'loggerManager' | translate }} +
  • + + {{ 'transactionLogs' | translate }} + +
  • +
  • diff --git a/src/app/shared/services/transaction-log.service.ts b/src/app/shared/services/transaction-log.service.ts new file mode 100644 index 0000000..a00a489 --- /dev/null +++ b/src/app/shared/services/transaction-log.service.ts @@ -0,0 +1,24 @@ +import { Injectable } from '@angular/core'; +import { map, Observable } from 'rxjs'; +import { URIKey } from '../../utils/uri-enums'; +import { HttpErrorResponse, HttpParams } from '@angular/common/http'; +import { HttpURIService } from '../../app.http.uri.service'; + +@Injectable({ + providedIn: 'root' +}) +export class TransactionLogService { + + constructor(private httpUriService: HttpURIService) { } + + getTransactionLogs(): Observable { + const params = new HttpParams(); + return this.httpUriService.requestGET(URIKey.TRANSACTION_LOGS, params).pipe(map((response: any) => { + if (!(response instanceof HttpErrorResponse)) { + return Array.isArray(response) ? response : []; + } + return []; + }) + ); + } +} diff --git a/src/app/transaction-logs/transaction-logs.component.html b/src/app/transaction-logs/transaction-logs.component.html new file mode 100644 index 0000000..4d65ccb --- /dev/null +++ b/src/app/transaction-logs/transaction-logs.component.html @@ -0,0 +1,81 @@ +
    +
    +
    +
    +
    + +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + {{'transactionLogs' | translate}} + +
    + +
    +
    +

    {{'loadingTransactionLogs' | translate}}

    +
    + +
    +

    {{'noTransactionLogsFound' | translate}}

    +
    + +
    + {{ errorMessage }} +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {{'logID' | translate}}{{'organization' | translate}}{{'transactionID' | translate}}{{'drAccount' | translate}}{{'crAccount' | translate}}{{'paymentMode' | translate}}{{'date' | translate}}{{'channel' | translate}}{{'createdAt' | translate}}
    {{ log.logId }}{{ log.porOrgacode }}{{ log.transactionID }}{{ log.drMbmbkmsnumber || '-' }}{{ log.crMbmbkmsnumber || '-' }}{{ log.ppmPymdcode }}{{ log.sgtGntrdate | date: 'MMM dd, yyyy' }}{{ log.channelCode }}{{ log.createdAt | date: 'MMM dd, yyyy HH:mm' }}
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/src/app/transaction-logs/transaction-logs.component.scss b/src/app/transaction-logs/transaction-logs.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/transaction-logs/transaction-logs.component.spec.ts b/src/app/transaction-logs/transaction-logs.component.spec.ts new file mode 100644 index 0000000..062d679 --- /dev/null +++ b/src/app/transaction-logs/transaction-logs.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TransactionLogsComponent } from './transaction-logs.component'; + +describe('TransactionLogsComponent', () => { + let component: TransactionLogsComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [TransactionLogsComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(TransactionLogsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/transaction-logs/transaction-logs.component.ts b/src/app/transaction-logs/transaction-logs.component.ts new file mode 100644 index 0000000..d999918 --- /dev/null +++ b/src/app/transaction-logs/transaction-logs.component.ts @@ -0,0 +1,56 @@ +import { Component, OnInit } from '@angular/core'; +import { TransactionLogService } from '../shared/services/transaction-log.service'; +import { CommonModule } from '@angular/common'; +import { TranslateModule } from '@ngx-translate/core'; + +interface TransactionLog { + logId: number; + porOrgacode: string; + drMbmbkmsnumber: string; + crMbmbkmsnumber: string; + crPcaglacode: string; + drPcaGlacode: string; + ppmPymdcode: string; + sgtGntrdate: string; + sgtGntrcreateat: string; + channelCode: string; + transactionID: string; + createdAt: string; + updatedAt: string; +} + +@Component({ + selector: 'app-transaction-logs', + templateUrl: './transaction-logs.component.html', + providers: [TransactionLogService], + imports:[CommonModule, TranslateModule] +}) +export class TransactionLogsComponent implements OnInit { + + logs: TransactionLog[] = []; + isLoading = false; + errorMessage: string = ''; + + constructor(private transactionLogService: TransactionLogService) {} + + ngOnInit(): void { + this.loadLogs(); + } + + loadLogs() { + this.isLoading = true; + this.errorMessage = ''; + + this.transactionLogService.getTransactionLogs().subscribe({ + next: (res) => { + this.logs = res; + this.isLoading = false; + }, + error: (err) => { + console.error('Failed to load transaction logs', err); + this.errorMessage = 'Failed to load transaction logs. Please try again.'; + this.isLoading = false; + } + }); + } +} \ No newline at end of file diff --git a/src/app/user-management/change-password/change-password.component.ts b/src/app/user-management/change-password/change-password.component.ts index b79f669..2b74034 100644 --- a/src/app/user-management/change-password/change-password.component.ts +++ b/src/app/user-management/change-password/change-password.component.ts @@ -122,7 +122,8 @@ constructor(private fb: FormBuilder, private httpURIService: HttpURIService, pri oldPassword: form.get('oldPassword')?.value || null, // confirmPassword: form.get('confirmPassword')?.value || null, newPassword: form.get('newPassword')?.value, - userId: this.storageService.getItem('USER_ID') + userId: this.storageService.getItem('USER_ID'), + porOrgaCode: this.storageService.getItem('POR_ORGACODE') }; } onSubmit(){ diff --git a/src/app/user-management/reset-password/reset-password.component.ts b/src/app/user-management/reset-password/reset-password.component.ts index c810314..88eb407 100644 --- a/src/app/user-management/reset-password/reset-password.component.ts +++ b/src/app/user-management/reset-password/reset-password.component.ts @@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common'; import { PasswordHideShowComponent } from '../../shared/components/password-hide-show/password-hide-show.component'; import { URIKey } from '../../utils/uri-enums'; import { HttpURIService } from '../../app.http.uri.service'; +import { StorageService } from '../../shared/services/storage.service'; @Component({ selector: 'app-reset-password', @@ -20,11 +21,13 @@ export class ResetPasswordComponent implements OnInit{ @ViewChild('psh1') passwordHideShow1?: PasswordHideShowComponent; @ViewChild('psh2') passwordHideShow2?: PasswordHideShowComponent; - constructor(private fb: FormBuilder, private httpURIService: HttpURIService){} - + constructor(private fb: FormBuilder, private httpURIService: HttpURIService, private storageService: StorageService){} + ngOnInit(): void { + const userIdValue = this.storageService.getItem('USER_ID') this.resetPasswordForm = this.fb.group({ - userId: ['', Validators.required], + + userId: [userIdValue || '', Validators.required], newPassword: ['', [Validators.required, Validators.minLength(6)]], confirmPassword: ['', [Validators.required, Validators.minLength(6)]] }, @@ -76,7 +79,8 @@ export class ResetPasswordComponent implements OnInit{ const payload = { userId: this.resetPasswordForm.value.userId, - newPassword: this.resetPasswordForm.value.newPassword + newPassword: this.resetPasswordForm.value.newPassword, + porOrgaCode: this.storageService.getItem('POR_ORGACODE') }; this.httpURIService.requestPOST(URIKey.RESET_PASSWORD_URI, payload) .subscribe(); diff --git a/src/app/user-management/setup-user/setup-user.component.ts b/src/app/user-management/setup-user/setup-user.component.ts index 34aadff..4463e17 100644 --- a/src/app/user-management/setup-user/setup-user.component.ts +++ b/src/app/user-management/setup-user/setup-user.component.ts @@ -9,6 +9,7 @@ import { UserSetupService } from '../../services/user-setup.service'; import { UserFilterPipe } from '../../shared/pipes/userFilterPipe'; import { FormBuilder, Validators, FormGroup } from '@angular/forms'; import { ButtonManagementService } from '../../services/button-management.service'; +import { StorageService } from '../../shared/services/storage.service'; @Component({ @@ -39,7 +40,8 @@ export class SetupUserComponent implements OnInit { constructor( private userService: UserSetupService, private fb: FormBuilder, - private buttonManagementService: ButtonManagementService + private buttonManagementService: ButtonManagementService, + private storageService: StorageService ){} get users$(){ @@ -77,8 +79,10 @@ export class SetupUserComponent implements OnInit { userFullname: this.userForm.value.userFullname, email: `${this.userForm.value.userId}@dummy.com`, role: 'ADMIN', - defaultPassword: this.userForm.value.defaultPassword + porOrgacode: this.storageService.getItem('POR_ORGACODE'), + password: this.userForm.value.defaultPassword } + this.userService.addUser(newUser).subscribe({ next: () => { this.userService.loadUsers(); diff --git a/src/app/utils/uri-enums.ts b/src/app/utils/uri-enums.ts index c72670d..d0143cd 100644 --- a/src/app/utils/uri-enums.ts +++ b/src/app/utils/uri-enums.ts @@ -11,5 +11,6 @@ export enum URIKey { GET_ALL_USER_URI = "GET_ALL_USER_URI", RESET_PASSWORD_URI = "RESET_PASSWORD_URI", CHANGE_PASSWORD_URI = "CHANGE_PASSWORD_URI", - THIRD_PARTY_REGISTER_URI = "THIRD_PARTY_REGISTER_URI" + THIRD_PARTY_REGISTER_URI = "THIRD_PARTY_REGISTER_URI", + TRANSACTION_LOGS = "TRANSACTION_LOGS" } \ No newline at end of file diff --git a/src/assets/data/app.uri.json b/src/assets/data/app.uri.json index 17fbb50..3b2861d 100644 --- a/src/assets/data/app.uri.json +++ b/src/assets/data/app.uri.json @@ -49,7 +49,7 @@ }, { "Id" : "ENTITY_RESET_PASSWORD_URI", - "URI": "/user/resetPassword", + "URI": "/authentication/reset-password", "UUID": "RESET_PASSWORD_URI" }, { @@ -66,6 +66,11 @@ "Id" : "ENTITY_THIRD_PARTY_REGISTER_URI", "URI": "/user/thirdPartyRegisteration", "UUID": "THIRD_PARTY_REGISTER_URI" + }, + { + "Id": "ENTITY_TRANSACTION_LOGS", + "URI": "/transaction/logs", + "UUID": "TRANSACTION_LOGS" } ] } diff --git a/src/assets/i18n/Arabic.json b/src/assets/i18n/Arabic.json index a645000..2fd7716 100644 --- a/src/assets/i18n/Arabic.json +++ b/src/assets/i18n/Arabic.json @@ -188,6 +188,19 @@ "purpdescPlaceholder": "أدخل وصف الغرض", "transactionDetails": "تفاصيل المعاملة", "lengthExceed":" الطول تجاوز ", + "transactionLogs": "سجلات المعاملات", + "loadingTransactionLogs": "جاري تحميل سجلات المعاملات...", + "noTransactionLogsFound": "لم يتم العثور على سجلات معاملات.", + "logID": "معرف السجل", + "organization": "المنظمة", + "transactionID": "معرف المعاملة", + "drAccount": "حساب المدين", + "crAccount": "حساب الدائن", + "paymentMode": "وسيلة الدفع", + "channel": "القناة", + "createdAt": "تم الإنشاء في", + "refresh": "تحديث", + "loading": "جاري التحميل", "invalidField": "ادخال غير صحيح", "action": "اجراء", "confirmDelete":"هل أنت متأكد أنك تريد حذف؟", diff --git a/src/assets/i18n/English.json b/src/assets/i18n/English.json index 9fbc5fd..dddf514 100644 --- a/src/assets/i18n/English.json +++ b/src/assets/i18n/English.json @@ -188,6 +188,19 @@ "transactionDetails": "Transaction Details", "invalidField": "Invalid Input", "lengthExceed": "Length exceeded", + "transactionLogs": "Transaction Logs", + "loadingTransactionLogs": "Loading transaction logs...", + "noTransactionLogsFound": "No transaction logs found.", + "logID": "Log ID", + "organization": "Organization", + "transactionID": "Transaction ID", + "drAccount": "DR Account", + "crAccount": "CR Account", + "paymentMode": "Payment Mode", + "channel": "Channel", + "createdAt": "Created At", + "refresh": "Refresh", + "loading": "Loading", "action": "Action", "recordNotFound": "Record not found", "confirmDelete":"Are you sure you want to delete?", diff --git a/src/styles.scss b/src/styles.scss index b902077..bb59838 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -12,6 +12,13 @@ border-style: dotted; opacity: 0.5; } + .table-light { + + th { + background-color: #155183 !important; + + } + } table { width: 100% !important;