This commit is contained in:
2023-10-12 21:18:03 +07:00
parent e7678c0e5e
commit 36efa12651
24 changed files with 378 additions and 256 deletions

View File

@@ -15,138 +15,6 @@ export interface MENU {
}
export const MENU: MENU[] = [
// {
// name: 'ประเมินราคา/ค่ามัดจำ',
// link: 'appraisal',
// permission: 'appraisal',
// icon: 'bi bi-ui-checks',
// params: [],
// badge: '',
// type: 'collapsable',
// children: [
// {
// name: 'ประเมินราคาครั้งที่ 1',
// link: 'appraisal/1st-time',
// permission: 'appraisal-1st-time',
// type: 'link',
// icon: '',
// params: [],
// badge: '',
// children: [
// {
// name: 'ประวัติการสร้างใบเสนอราคา',
// link: 'appraisal/1st-time/history',
// permission: 'appraisal-1st-time-history',
// notShowing: true,
// children: [
// {
// name: 'ใบเสนอราคา',
// link: 'appraisal/1st-time/history/pdf',
// permission: 'appraisal-1st-time-pdf',
// notShowing: true,
// }
// ]
// },
// ]
// },
// {
// name: 'ประเมินราคาครั้งที่ 2',
// link: 'appraisal/2nd-time',
// permission: 'appraisal-2nd-time',
// type: 'link',
// icon: '',
// params: [],
// badge: '',
// },
// {
// name: 'ประเมินราคาครั้งที่ 3',
// link: 'appraisal/3rd-time',
// permission: 'appraisal-3rd-time',
// type: 'link',
// icon: '',
// params: [],
// badge: '',
// },
// ]
// },
// {
// name: 'การเงิน',
// link: 'finance',
// permission: 'finance',
// icon: 'bi bi-coin',
// params: [],
// badge: '',
// type: 'collapsable',
// children: [
// {
// name: 'รับชำระเงิน/ใบเสร็จรับเงิน',
// link: 'finance/payment',
// permission: 'payment',
// type: 'link',
// icon: '',
// params: [],
// badge: '',
// children: [
// {
// name: 'ใบเสร็จรับเงิน',
// link: 'finance/payment/paid/pdf',
// permission: 'finance-payment-pdf',
// notShowing: true,
// }
// ]
// },
// {
// name: 'การแจ้งหนี้/ตั้งเจ้าหนี้',
// link: 'finance/invoice',
// permission: 'invoice',
// type: 'link',
// icon: '',
// params: [],
// badge: '',
// },
// {
// name: 'การจ่ายชำระเงิน',
// link: 'finance/paying',
// permission: 'paying',
// type: 'link',
// icon: '',
// params: [],
// badge: '',
// },
// ]
// },
// {
// name: 'สัญญา',
// link: 'contract',
// permission: 'contract',
// icon: 'bi bi-file-earmark-text-fill',
// params: [],
// badge: '',
// type: 'collapsable',
// children: [
// {
// name: 'ทำสัญญา',
// link: 'contract/make',
// permission: 'contract-make',
// type: 'link',
// icon: '',
// params: [],
// badge: '',
// },
// {
// name: 'อนุมัติสัญญา',
// link: 'contract/approved',
// permission: 'contract-approved',
// type: 'link',
// icon: '',
// params: [],
// badge: '',
// }
// ]
// },
{
name: 'Manage',
link: 'manage',
@@ -157,49 +25,34 @@ export const MENU: MENU[] = [
type: 'collapsable',
children: [
{
name: 'Manage KYC',
name: 'KYC',
link: 'manage/kyc',
permission: 'manage-kyc',
type: 'link',
icon: '',
params: [],
badge: '',
// children: [
// {
// name: 'ประวัติการสร้างใบเสนอราคา',
// link: 'appraisal/1st-time/history',
// permission: 'appraisal-1st-time-history',
// notShowing: true,
// children: [
// {
// name: 'ใบเสนอราคา',
// link: 'appraisal/1st-time/history/pdf',
// permission: 'appraisal-1st-time-pdf',
// notShowing: true,
// }
// ]
// },
// ]
},
// {
// name: 'ประเมินราคาครั้งที่ 2',
// link: 'appraisal/2nd-time',
// permission: 'appraisal-2nd-time',
// type: 'link',
// icon: '',
// params: [],
// badge: '',
// },
// {
// name: 'ประเมินราคาครั้งที่ 3',
// link: 'appraisal/3rd-time',
// permission: 'appraisal-3rd-time',
// type: 'link',
// icon: '',
// params: [],
// badge: '',
// },
]
},
{
name: 'Report',
link: 'report',
permission: 'report',
icon: 'bi bi-file-bar-graph',
params: [],
badge: '',
type: 'collapsable',
children: [
{
name: 'Transactions',
link: 'report/transactions',
permission: 'transactions',
type: 'link',
icon: '',
params: [],
badge: '',
},
]
},
];

View File

@@ -31,11 +31,19 @@ const routes: Routes = [
children: [
{
path: 'kyc',
// loadChildren: () => import('./pages/appraisal/1st-time/appraisal-1st-time.module').then(m => m.Appraisal1stTimeModule)
loadChildren: () => import('./pages/manage/kyc/kyc.module').then(m => m.KycModule)
},
]
},
{
path: 'report',
children: [
{
path: 'transactions',
loadChildren: () => import('./pages/report/transactions/transactions.module').then(m => m.TransactionsModule)
},
]
},
{
path: 'not-found',
loadChildren: () => import('./pages/errors/errors.module').then(m => m.ErrorsModule)

View File

@@ -1,7 +1,7 @@
<div class="auth">
<div class="auth-wrap">
<div class="auth-logo">
<img src="./assets/images/logo-b.png" />
<img class="logo-auth" src="./assets/images/logo-b.png" />
</div>
<div class="auth-card">
@@ -9,10 +9,10 @@
<form #ngf="ngForm" (ngSubmit)="onSubmit(ngf)">
<div class="auth-card-body">
<mat-form-field>
<input matInput type="text" name="username" [(ngModel)]="dataForm.username" #username="ngModel"
<input matInput type="text" name="loginname" [(ngModel)]="dataForm.loginname" #loginname="ngModel"
placeholder="Username" required>
<i matSuffix class="bi bi-person-circle"></i>
<mat-error *ngIf="isFieldValid(ngf, username)">กรุณากรอกข้อมูล</mat-error>
<mat-error *ngIf="isFieldValid(ngf, loginname)">กรุณากรอกข้อมูล</mat-error>
</mat-form-field>
<div style="height: 10px;"></div>
<mat-form-field>

View File

@@ -1,9 +1,10 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { AppService } from '../../app.service';
import { lastValueFrom } from "rxjs";
import { EAction, EText } from "../../@config/app";
import { environment } from "../../../environments/environment";
import { AuthService } from 'src/app/core/service/auth/auth.service';
import { catchError, lastValueFrom, tap, throwError } from 'rxjs';
import { EAction, EText } from 'src/app/@config/app';
@Component({
@@ -19,7 +20,8 @@ export class LoginComponent implements OnInit {
constructor(
private router: Router,
private appService: AppService,
private route: ActivatedRoute
private route: ActivatedRoute,
private authService: AuthService
) {
}
@@ -28,30 +30,19 @@ export class LoginComponent implements OnInit {
if (!environment.production) {
this.dataForm = {
username: 'admin',
password: 'password@1',
password: 'admin',
}
}
}
async onSubmit(form: any) {
if (!form.valid) return false;
const dataForm = {
username: this.dataForm.username,
password: this.dataForm.password,
userType: 'ADMIN'
};
try {
// console.log(this.apiUrl)
// const result = await lastValueFrom(this.appService.post(this.apiUrl, dataForm));
// this.appService.setAuth(result.data);
// this.appService.setToken(result.accessToken);
await lastValueFrom(this.authService.login(this.dataForm));
return this.router.navigate(['/pages']);
} catch (err) {
return this.appService.message(EAction.ERROR, EText.NO_DATA);
}
}

View File

@@ -1,44 +1,37 @@
import { OidcAuthService } from 'src/app/core/oidc/oidc.service';
import { Injectable } from '@angular/core';
import {
HttpRequest,
HttpHandler,
HttpEvent,
HttpInterceptor
HttpRequest,
HttpHandler,
HttpEvent,
HttpInterceptor
} from '@angular/common/http';
import { Observable, throwError } from 'rxjs';
import { catchError, finalize } from 'rxjs/operators';
import { Router } from '@angular/router';
import { NgProgress } from 'ngx-progressbar';
import { ApplicationSecurityService } from '../service/security/application-security.service';
@Injectable()
export class TokenIntercepterInterceptor implements HttpInterceptor {
constructor(
private odicSV: OidcAuthService,
private router: Router,
private progress: NgProgress,
private appTokenSV: ApplicationSecurityService
) {
}
constructor(
private router: Router,
) {
}
intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
const isRegisterSubjectAPI = request.url.includes('rsu-reg-api')
const customReq = request.clone({
setHeaders:{
Authorization: request.url.includes('app_tokens') ? `${this.odicSV.getAuthorizationHeaderValue()}` : `Bearer ${this.appTokenSV.getToken()}`
}
});
this.progress.ref('progressBar').start()
return next.handle(customReq).pipe(
finalize(() => this.progress.ref('progressBar').complete()),
catchError(err => {
if (err.status == 401) {
this.router.navigate(['./'],{ replaceUrl: true })
}
return throwError(err)
})
);
}
intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
const customReq = request.clone({
setHeaders: {
// Authorization: request.url.includes('app_tokens') ? `${this.odicSV.getAuthorizationHeaderValue()}` : `Bearer ${this.appTokenSV.getToken()}`
}
});
return next.handle(customReq)
// return next.handle(customReq).pipe(
// finalize(() => this.progress.ref('progressBar').complete()),
// catchError(err => {
// if (err.status == 401) {
// this.router.navigate(['./'], { replaceUrl: true })
// }
// return throwError(err)
// })
// );
}
}

View File

@@ -0,0 +1,20 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { BaseService } from 'src/app/core/base/base-service';
@Injectable({
providedIn: 'root'
})
export class AuthService extends BaseService{
constructor(
public http: HttpClient
) {
super('/common/user_login', http)
}
login(payload : {'loginname': string , 'password' : string}){
return this.http.get(`${this.prefix}/common/user_login/login/${payload.loginname}/${payload.password}`)
}
}

View File

@@ -2,8 +2,6 @@ import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { AppService } from '../../app.service';
import { MENU } from "../../@config/menus";
import { lastValueFrom } from "rxjs";
import { environment } from 'src/environments/environment';
@Component({
selector: 'app-pages-layouts',
@@ -24,7 +22,6 @@ export class PagesLayoutsComponent implements OnInit {
constructor(
private app: AppService,
private router: Router,
private activatedRoute: ActivatedRoute,
public changeDetectorRef: ChangeDetectorRef,
) {

View File

@@ -0,0 +1 @@
<app-list [kycList]="kyc$ | async"></app-list>

View File

@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TransactionsContainer } from './transactions.container';
describe('TransactionsContainer', () => {
let component: TransactionsContainer;
let fixture: ComponentFixture<TransactionsContainer>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ TransactionsContainer ]
})
.compileComponents();
fixture = TestBed.createComponent(TransactionsContainer);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,17 @@
import { Component } from '@angular/core';
import { Observable } from 'rxjs';
import { KycService } from 'src/app/core/service/manage/kyc.service';
@Component({
selector: 'app-transactions',
templateUrl: './transactions.container.html',
styleUrls: ['./transactions.container.scss']
})
export class TransactionsContainer {
kyc$ = new Observable();
constructor(
private kycService: KycService
) {
this.kyc$ = this.kycService.getAll();
}
}

View File

@@ -0,0 +1,136 @@
<div class="card card-table">
<div class="card-filter text-right">
<div class="card-filter-section grid grid-cols-12 gap-4 md:gap-2 items-center">
<div class="col-span-2 xl:col-span-3 xl:order-2">
<mat-form-field>
<i matTextPrefix class="bi bi-search"></i>
<input matInput placeholder="ชื่อผู้รับเงิน">
</mat-form-field>
</div>
<div class="col-span-2 xl:col-span-3 xl:order-2">
<mat-form-field>
<i matTextPrefix class="bi bi-search"></i>
<input matInput placeholder="ชื่อผู้ชำระเงิน">
</mat-form-field>
</div>
<div class="col-span-2 xl:col-span-3 xl:order-2">
<mat-form-field>
<i matTextPrefix class="bi bi-search"></i>
<input matInput placeholder="วันที่ชำระ">
</mat-form-field>
</div>
<div class="col-span-2 xl:col-span-3 xl:order-2">
<mat-form-field>
<i matTextPrefix class="bi bi-search"></i>
<input matInput placeholder="ถึงวันที่">
</mat-form-field>
</div>
</div>
</div>
<div class="card-body">
<div class="table-wrap">
<table class="table table-main" mat-table [dataSource]="kycList" matSort>
<tr mat-header-row *matHeaderRowDef="['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15']"></tr>
<tr mat-row *matRowDef="let row; columns: ['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15'];"></tr>
<ng-container matColumnDef="1">
<th mat-header-cell *matHeaderCellDef class="tac" mat-sort-header>ลำดับ</th>
<td mat-cell *matCellDef="let item" width="150" class="tac">{{item.code}}</td>
</ng-container>
<ng-container matColumnDef="2">
<th mat-header-cell *matHeaderCellDef class="tal">Phone</th>
<td mat-cell *matCellDef="let item" class="" style="min-width: 200px;">
{{item.name }}
</td>
</ng-container>
<ng-container matColumnDef="3">
<th mat-header-cell *matHeaderCellDef class="tal" mat-sort-header>ID</th>
<td mat-cell *matCellDef="let item" class="">{{item?.masterProductBrand.name }}</td>
</ng-container>
<ng-container matColumnDef="4">
<th mat-header-cell *matHeaderCellDef class="tal" mat-sort-header>PayeeFullname</th>
<td mat-cell *matCellDef="let item" class="">{{item?.masterProductBrand.name }}</td>
</ng-container>
<ng-container matColumnDef="5">
<th mat-header-cell *matHeaderCellDef class="tal" width="150">PayerFullname</th>
<td mat-cell *matCellDef="let item" class="">{{item.size }}</td>
</ng-container>
<ng-container matColumnDef="6">
<th mat-header-cell *matHeaderCellDef class="tal" width="150">InvoiceID</th>
<td mat-cell *matCellDef="let item" class="">{{item.weight }}</td>
</ng-container>
<ng-container matColumnDef="7">
<th mat-header-cell *matHeaderCellDef class="tal" width="150">ref 1</th>
<td mat-cell *matCellDef="let item" class="">{{item.color }}</td>
</ng-container>
<ng-container matColumnDef="8">
<th mat-header-cell *matHeaderCellDef class="tal" width="150">ref 2</th>
<td mat-cell *matCellDef="let item" class="">{{item.year }}</td>
</ng-container>
<ng-container matColumnDef="9">
<th mat-header-cell *matHeaderCellDef class="tal" width="150" mat-sort-header>ref 3</th>
<td mat-cell *matCellDef="let item" class="">
<div class="b-color-orange"> {{item.price | number : '1.2-2'}}</div>
</td>
</ng-container>
<ng-container matColumnDef="10">
<th mat-header-cell *matHeaderCellDef class="tal" width="150" mat-sort-header>paymentStatus</th>
<td mat-cell *matCellDef="let item" class="">
<div class="b-color-green"> {{item.latestPrice | number : '1.2-2' }}</div>
</td>
</ng-container>
<ng-container matColumnDef="11">
<th mat-header-cell *matHeaderCellDef width="80">payment Channel</th>
<td mat-cell *matCellDef="let item">
<div class="action flex justify-center">
<div class="item">
<i class="bi bi-file-earmark-text icon-doc"></i>
</div>
</div>
</td>
</ng-container>
<ng-container matColumnDef="12">
<th mat-header-cell *matHeaderCellDef class="tal" width="150" mat-sort-header>จำนวนเงิน</th>
<td mat-cell *matCellDef="let item" class="">
<div class="b-color-green"> {{item.latestPrice | number : '1.2-2' }}</div>
</td>
</ng-container>
<ng-container matColumnDef="13">
<th mat-header-cell *matHeaderCellDef class="tal" width="150" mat-sort-header>Create by</th>
<td mat-cell *matCellDef="let item" class="">
<div class="b-color-green"> {{item.latestPrice | number : '1.2-2' }}</div>
</td>
</ng-container>
<ng-container matColumnDef="14">
<th mat-header-cell *matHeaderCellDef class="tal" width="150" mat-sort-header>Update by</th>
<td mat-cell *matCellDef="let item" class="">
<div class="b-color-green"> {{item.latestPrice | number : '1.2-2' }}</div>
</td>
</ng-container>
<ng-container matColumnDef="15">
<th mat-header-cell *matHeaderCellDef width="80">More Detail</th>
<td mat-cell *matCellDef="let item">
<div class="action flex justify-center">
<div class="item">
<i class="bi bi-file-earmark-text icon-doc"></i>
</div>
</div>
</td>
</ng-container>
</table>
</div>
<!-- <div *ngIf="dataSourceCount === 0" class="no-data"></div> -->
<mat-paginator [pageSizeOptions]="[5,10,20]" showFirstLastButtons (page)="getData($event)"></mat-paginator>
</div>
</div>

View File

@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ListComponent } from './list.component';
describe('ListComponent', () => {
let component: ListComponent;
let fixture: ComponentFixture<ListComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ListComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(ListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,17 @@
import { Component, Input } from '@angular/core';
@Component({
selector: 'app-list',
templateUrl: './list.component.html',
styleUrls: ['./list.component.scss']
})
export class ListComponent {
@Input() kycList: any = [];
constructor() {
}
getData(event: any) {
}
}

View File

@@ -0,0 +1,16 @@
import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';
@Component({
selector: 'app-transactions-router',
template: '<router-outlet></router-outlet>',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class TransactionsRouter implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

View File

@@ -0,0 +1,35 @@
import { NgOptimizedImage } from "@angular/common";
import { RouterModule, Routes } from "@angular/router";
import { AppSharedModule } from "src/app/app.shared";
import { NgModule } from "@angular/core";
import { ListComponent } from "./presenter/list/list.component";
import { TransactionsRouter } from "./router/router";
import { TransactionsContainer } from "./container/transactions/transactions.container";
const routes: Routes = [
{
path: '',
component: TransactionsRouter,
children: [
{
path: '',
component: TransactionsContainer
}
]
}
]
@NgModule({
declarations: [
TransactionsRouter,
TransactionsContainer,
ListComponent
],
imports: [
AppSharedModule,
NgOptimizedImage,
RouterModule.forChild(routes)
]
})
export class TransactionsModule { }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 60 KiB

View File

@@ -1,5 +1,5 @@
export const environment = {
production: false,
hideForm: false,
APIURL: 'https://cathaypay.71dev.com/cathaypay-api/api'
APIURL: 'https://cathaypay.71dev.com/cathaypay-api'
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 149 KiB

BIN
src/favicon2.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -7,8 +7,11 @@
.auth-logo {
height: 140px;
}
.logo-auth {
width: 150px;
}
.auth-heading {
margin-top: -20px;
margin-bottom: 20px;
text-align: left;
font-size: 20px;

View File

@@ -1,33 +1,22 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": false,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "ES2022",
"module": "ES2022",
"useDefineForClassFields": false,
"lib": [
"ES2022",
"dom"
]
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "es2020",
"moduleResolution": "node",
"experimentalDecorators": true,
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
]
}
}
}