[update]
This commit is contained in:
19
src/app/@common/utils/thaidate.pipe.ts
Normal file
19
src/app/@common/utils/thaidate.pipe.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { Pipe, PipeTransform } from '@angular/core';
|
||||||
|
|
||||||
|
@Pipe({
|
||||||
|
name: 'thaidate',
|
||||||
|
pure :true
|
||||||
|
})
|
||||||
|
export class ThaidatePipe implements PipeTransform {
|
||||||
|
|
||||||
|
transform(value: string): string {
|
||||||
|
if(!value) return '-'
|
||||||
|
let date = new Date(value).toLocaleDateString('th-TH', {
|
||||||
|
year: 'numeric',
|
||||||
|
month: 'short',
|
||||||
|
day: 'numeric',
|
||||||
|
})
|
||||||
|
return date
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
// ANGULAR
|
// ANGULAR
|
||||||
import { LOCALE_ID, NgModule } from "@angular/core";
|
import { Injectable, LOCALE_ID, NgModule } from "@angular/core";
|
||||||
import { CommonModule } from "@angular/common";
|
import { CommonModule, registerLocaleData } from "@angular/common";
|
||||||
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
||||||
|
|
||||||
// MATERIAL
|
// MATERIAL
|
||||||
@@ -10,7 +10,7 @@ import { MatSortModule } from "@angular/material/sort";
|
|||||||
import { MatProgressSpinnerModule } from "@angular/material/progress-spinner";
|
import { MatProgressSpinnerModule } from "@angular/material/progress-spinner";
|
||||||
import { MatCardModule } from "@angular/material/card";
|
import { MatCardModule } from "@angular/material/card";
|
||||||
import { MatDatepickerModule } from "@angular/material/datepicker";
|
import { MatDatepickerModule } from "@angular/material/datepicker";
|
||||||
import { MatNativeDateModule, MatRippleModule } from "@angular/material/core";
|
import { DateAdapter, MAT_DATE_FORMATS, MatNativeDateModule, MatRippleModule, NativeDateAdapter } from "@angular/material/core";
|
||||||
import { MatProgressBarModule } from "@angular/material/progress-bar";
|
import { MatProgressBarModule } from "@angular/material/progress-bar";
|
||||||
import { MatButtonToggleModule } from "@angular/material/button-toggle";
|
import { MatButtonToggleModule } from "@angular/material/button-toggle";
|
||||||
import { MatGridListModule } from "@angular/material/grid-list";
|
import { MatGridListModule } from "@angular/material/grid-list";
|
||||||
@@ -40,7 +40,36 @@ import { CanDirective } from "./utils/can.directive";
|
|||||||
import { AllowRoleDirective } from "./utils/allow-role.directives";
|
import { AllowRoleDirective } from "./utils/allow-role.directives";
|
||||||
import { CurrencyInputMaskDirective } from "./@common/utils/CurrencyInputMask";
|
import { CurrencyInputMaskDirective } from "./@common/utils/CurrencyInputMask";
|
||||||
import { NumberOnlyDirective } from "./@common/utils/NumberOnlyDirective";
|
import { NumberOnlyDirective } from "./@common/utils/NumberOnlyDirective";
|
||||||
|
import { ThaidatePipe } from "./@common/utils/thaidate.pipe";
|
||||||
|
import localeTh from '@angular/common/locales/th';
|
||||||
|
registerLocaleData(localeTh)
|
||||||
|
@Injectable()
|
||||||
|
export class AppDateAdapter extends NativeDateAdapter {
|
||||||
|
format(date: Date, displayFormat: Object): string {
|
||||||
|
let monthNamesThai = ["ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.","ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค"];
|
||||||
|
date.setHours(7)
|
||||||
|
let day: string = date.getDate().toLocaleString()
|
||||||
|
day = +day < 10 ? '0' + day : day;
|
||||||
|
let year = date.getFullYear();
|
||||||
|
return `${day}/${monthNamesThai[date.getMonth()]}/${year + 543}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const PICK_FORMATS = {
|
||||||
|
parse: {
|
||||||
|
dateInput: {
|
||||||
|
month: 'short',
|
||||||
|
year: 'numeric',
|
||||||
|
day: 'numeric'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
display: {
|
||||||
|
dateInput: 'input',
|
||||||
|
monthYearLabel: { day: 'numeric', year: 'numeric', month: 'long' },
|
||||||
|
dateA11yLabel: { year: 'numeric', month: 'long', day: 'numeric' },
|
||||||
|
monthYearA11yLabel: { year: 'numeric', month: 'long' }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const MAT = [
|
const MAT = [
|
||||||
MatAutocompleteModule,
|
MatAutocompleteModule,
|
||||||
@@ -104,7 +133,8 @@ const PIPES = [
|
|||||||
DateFormat,
|
DateFormat,
|
||||||
DateDiff,
|
DateDiff,
|
||||||
CurrencyInputMaskDirective,
|
CurrencyInputMaskDirective,
|
||||||
NumberOnlyDirective
|
NumberOnlyDirective,
|
||||||
|
ThaidatePipe
|
||||||
];
|
];
|
||||||
|
|
||||||
const PROVIDERS: any = [
|
const PROVIDERS: any = [
|
||||||
@@ -112,7 +142,10 @@ const PROVIDERS: any = [
|
|||||||
provide: MAT_FORM_FIELD_DEFAULT_OPTIONS,
|
provide: MAT_FORM_FIELD_DEFAULT_OPTIONS,
|
||||||
useValue: appearance
|
useValue: appearance
|
||||||
},
|
},
|
||||||
{ provide: LOCALE_ID, useValue: "en-GB" }
|
{ provide: LOCALE_ID, useValue: 'th-TH' },
|
||||||
|
{ provide: MAT_DATE_FORMATS, useValue: PICK_FORMATS },
|
||||||
|
{ provide: DateAdapter, useClass: AppDateAdapter },
|
||||||
|
// { provide: LOCALE_ID, useValue: "en-GB" }
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
|||||||
@@ -1 +1,4 @@
|
|||||||
<app-list [kycList]="kyc$ | async"></app-list>
|
<app-list
|
||||||
|
(edit)="edit($event)"
|
||||||
|
[kycList]="kyc$ | async">
|
||||||
|
</app-list>
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
import { Component } from '@angular/core';
|
import { ChangeDetectorRef, Component } from '@angular/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable, catchError, switchMap, tap, throwError } from 'rxjs';
|
||||||
|
import { IDialogConfig, CDialogConfig } from 'src/app/@common/interface/Dialog';
|
||||||
|
import { EAction, EText } from 'src/app/@config/app';
|
||||||
import { KycService } from 'src/app/core/service/common/kyc.service';
|
import { KycService } from 'src/app/core/service/common/kyc.service';
|
||||||
|
import { DialogComponent } from '../../presenter/dialog/dialog.component';
|
||||||
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
|
import { AppService } from 'src/app/app.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-kyc',
|
selector: 'app-kyc',
|
||||||
@@ -8,10 +13,34 @@ import { KycService } from 'src/app/core/service/common/kyc.service';
|
|||||||
styleUrls: ['./kyc.container.scss']
|
styleUrls: ['./kyc.container.scss']
|
||||||
})
|
})
|
||||||
export class KycContainer {
|
export class KycContainer {
|
||||||
|
dialogConfig: IDialogConfig = CDialogConfig
|
||||||
kyc$ = new Observable();
|
kyc$ = new Observable();
|
||||||
constructor(
|
constructor(
|
||||||
private kycService: KycService
|
private kycService: KycService,
|
||||||
|
private dialog: MatDialog,
|
||||||
|
private appService: AppService,
|
||||||
|
private cdr: ChangeDetectorRef
|
||||||
) {
|
) {
|
||||||
this.kyc$ = this.kycService.getAll();
|
this.kyc$ = this.kycService.getAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
edit(uid){
|
||||||
|
this.dialogConfig.data.action = EAction.UPDATE;
|
||||||
|
this.dialogConfig.data.ids = uid
|
||||||
|
const dialogRef = this.dialog.open(DialogComponent,this.dialogConfig);
|
||||||
|
const edit$ = dialogRef.afterClosed().pipe(
|
||||||
|
switchMap((res) => {
|
||||||
|
if(res === 'success'){
|
||||||
|
return this.kyc$ = this.kycService.getAll().pipe(
|
||||||
|
catchError((err) => {
|
||||||
|
this.appService.message(EAction.ERROR, EText.ERROR);
|
||||||
|
return throwError(() => err)
|
||||||
|
}),
|
||||||
|
tap(() => this.cdr.detectChanges())
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
return edit$.subscribe();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { KycRouter } from "./router/router";
|
|||||||
import { KycContainer } from "./container/kyc/kyc.container";
|
import { KycContainer } from "./container/kyc/kyc.container";
|
||||||
import { NgModule } from "@angular/core";
|
import { NgModule } from "@angular/core";
|
||||||
import { ListComponent } from "./presenter/list/list.component";
|
import { ListComponent } from "./presenter/list/list.component";
|
||||||
|
import { DialogComponent } from './presenter/dialog/dialog.component';
|
||||||
|
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
@@ -24,7 +25,8 @@ const routes: Routes = [
|
|||||||
declarations: [
|
declarations: [
|
||||||
KycRouter,
|
KycRouter,
|
||||||
KycContainer,
|
KycContainer,
|
||||||
ListComponent
|
ListComponent,
|
||||||
|
DialogComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
AppSharedModule,
|
AppSharedModule,
|
||||||
|
|||||||
@@ -0,0 +1,91 @@
|
|||||||
|
<form [formGroup]="form" class="dialog-main form-dialog" autocomplete="off">
|
||||||
|
<div class="dialog-main">
|
||||||
|
<div class="dialog-header flex justify-between">
|
||||||
|
<h2>More Detail</h2>
|
||||||
|
<mat-icon mat-dialog-close class="cursor-pointer">clear</mat-icon>
|
||||||
|
</div>
|
||||||
|
<div class="dialog-body">
|
||||||
|
<div class="grid grid-cols-12 gap-4 md:gap-2 ">
|
||||||
|
<div class="col-span-full">
|
||||||
|
<div class="lg:flex lg:flex-col grid grid-cols-9 gap-2">
|
||||||
|
<mat-label class="col-span-1 lg:text-left lg:self-auto text-right self-center mr-4">เลขประจำตัวประชาชน</mat-label>
|
||||||
|
<mat-form-field class="col-span-7">
|
||||||
|
<input matInput required formControlName="id_card" readonly type="text">
|
||||||
|
</mat-form-field>
|
||||||
|
<span class="col-span-1"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-span-full">
|
||||||
|
<div class="lg:flex lg:flex-col grid grid-cols-9 gap-2">
|
||||||
|
<mat-label class="col-span-1 lg:text-left lg:self-auto text-right self-center mr-4">คำนำหน้าชื่อ</mat-label>
|
||||||
|
<mat-form-field class="col-span-7">
|
||||||
|
<input matInput required formControlName="prefix_name" readonly type="text">
|
||||||
|
</mat-form-field>
|
||||||
|
<span class="col-span-1"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-span-full">
|
||||||
|
<div class="lg:flex lg:flex-col grid grid-cols-9 gap-2">
|
||||||
|
<mat-label class="col-span-1 lg:text-left lg:self-auto text-right self-center mr-4">ชื่อ</mat-label>
|
||||||
|
<mat-form-field class="col-span-7">
|
||||||
|
<input matInput required formControlName="first_name" readonly type="text">
|
||||||
|
</mat-form-field>
|
||||||
|
<span class="col-span-1"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-span-full">
|
||||||
|
<div class="lg:flex lg:flex-col grid grid-cols-9 gap-2">
|
||||||
|
<mat-label class="col-span-1 lg:text-left lg:self-auto text-right self-center mr-4">นามสกุล</mat-label>
|
||||||
|
<mat-form-field class="col-span-7">
|
||||||
|
<input matInput required formControlName="last_name" readonly type="text">
|
||||||
|
</mat-form-field>
|
||||||
|
<span class="col-span-1"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-span-full">
|
||||||
|
<div class="lg:flex lg:flex-col grid grid-cols-9 gap-2">
|
||||||
|
<mat-label class="col-span-1 lg:text-left lg:self-auto text-right self-center mr-4">เกิดวันที่</mat-label>
|
||||||
|
<mat-form-field class="col-span-7">
|
||||||
|
<input matInput formControlName="birth_date" [matDatepicker]="birthdate" readonly />
|
||||||
|
<mat-datepicker-toggle [for]="birthdate" disabled matSuffix></mat-datepicker-toggle>
|
||||||
|
<mat-datepicker #birthdate></mat-datepicker>
|
||||||
|
</mat-form-field>
|
||||||
|
<span class="col-span-1"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-span-full">
|
||||||
|
<div class="lg:flex lg:flex-col grid grid-cols-9 gap-2">
|
||||||
|
<mat-label class="col-span-1 lg:text-left lg:self-auto text-right self-center mr-4">วันบัตรหมดอายุ</mat-label>
|
||||||
|
<mat-form-field class="col-span-7">
|
||||||
|
<input matInput formControlName="exp_date" [matDatepicker]="expdate" readonly />
|
||||||
|
<mat-datepicker-toggle [for]="expdate" disabled matSuffix></mat-datepicker-toggle>
|
||||||
|
<mat-datepicker #expdate></mat-datepicker>
|
||||||
|
</mat-form-field>
|
||||||
|
<span class="col-span-1"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-span-full">
|
||||||
|
<div class="lg:flex lg:flex-col grid grid-cols-9 gap-2">
|
||||||
|
<mat-label class="col-span-1 lg:text-left lg:self-auto text-right self-center mr-4">เลขหลังบัตร</mat-label>
|
||||||
|
<mat-form-field class="col-span-7">
|
||||||
|
<input matInput required formControlName="code_back_card" readonly type="text">
|
||||||
|
</mat-form-field>
|
||||||
|
<span class="col-span-1"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<button type="submit" mat-raised-button class="btn btn-green" (click)="status(true)" [disabled]="form.invalid">Approve</button>
|
||||||
|
<button type="button" class="btn btn-red" (click)="status(false)">Reject</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<!-- <pre>{{form.getRawValue() | json}}</pre> -->
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { DialogComponent } from './dialog.component';
|
||||||
|
|
||||||
|
describe('DialogComponent', () => {
|
||||||
|
let component: DialogComponent;
|
||||||
|
let fixture: ComponentFixture<DialogComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ DialogComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(DialogComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
import { Location } from '@angular/common';
|
||||||
|
import { ChangeDetectorRef, Component, Inject, OnInit } from '@angular/core';
|
||||||
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||||
|
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||||
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
|
import { tap, catchError, throwError } from 'rxjs';
|
||||||
|
import { IDialogConfigData } from 'src/app/@common/interface/Dialog';
|
||||||
|
import { EAction, EText } from 'src/app/@config/app';
|
||||||
|
import { AppService } from 'src/app/app.service';
|
||||||
|
import { BaseForm } from 'src/app/core/base/base-form';
|
||||||
|
import { KycService } from 'src/app/core/service/common/kyc.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-dialog',
|
||||||
|
templateUrl: './dialog.component.html',
|
||||||
|
styleUrls: ['./dialog.component.scss']
|
||||||
|
})
|
||||||
|
export class DialogComponent extends BaseForm implements OnInit {
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
public dialogRef: MatDialogRef<DialogComponent>,
|
||||||
|
@Inject(MAT_DIALOG_DATA) public dialog: IDialogConfigData,
|
||||||
|
public router: Router,
|
||||||
|
public activatedRoute: ActivatedRoute,
|
||||||
|
public fb: FormBuilder,
|
||||||
|
public location: Location,
|
||||||
|
public kycService: KycService,
|
||||||
|
public appService: AppService,
|
||||||
|
public cdr: ChangeDetectorRef
|
||||||
|
) {
|
||||||
|
super(router, activatedRoute, fb, location)
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
if (this.dialog.action === EAction.UPDATE){
|
||||||
|
this.state = 'edit';
|
||||||
|
this.getData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
createForm(): FormGroup<any> {
|
||||||
|
return this.fb.group({
|
||||||
|
kyc_uid: null,
|
||||||
|
id_card: null,
|
||||||
|
code_back_card: null,
|
||||||
|
exp_date: null,
|
||||||
|
prefix_name: null,
|
||||||
|
first_name: null,
|
||||||
|
last_name: null,
|
||||||
|
birth_date: [null],
|
||||||
|
phone: [null],
|
||||||
|
email: null,
|
||||||
|
image_front_url: [null],
|
||||||
|
image_back_url: [null],
|
||||||
|
is_pass: null,
|
||||||
|
status_id: [null],
|
||||||
|
created_by: null,
|
||||||
|
created_datetime: null,
|
||||||
|
updated_by: null,
|
||||||
|
updated_datetime: null,
|
||||||
|
owner_agency_uid: null
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
getData() {
|
||||||
|
if (!this.dialog.ids) this.appService.message(EAction.INFO, EText.NO_DATA);
|
||||||
|
return this.kycService.get(this.dialog.ids).pipe(
|
||||||
|
tap((res) => this.form.patchValue(res)),
|
||||||
|
tap(() => this.cdr.detectChanges()),
|
||||||
|
catchError((err) => {
|
||||||
|
this.appService.message(EAction.ERROR, EText.ERROR);
|
||||||
|
return throwError(() => err)
|
||||||
|
})
|
||||||
|
).subscribe()
|
||||||
|
}
|
||||||
|
|
||||||
|
status(isApprove: boolean){
|
||||||
|
const form = this.form.getRawValue();
|
||||||
|
form.is_pass = isApprove;
|
||||||
|
const save$ = this.kycService.update2(form)
|
||||||
|
return save$.pipe(
|
||||||
|
tap(() => this.appService.message(EAction.SUCCESS, EText.UPDATE)),
|
||||||
|
tap(() => this.dialogRef.close('success')),
|
||||||
|
catchError((err) => {
|
||||||
|
this.appService.message(EAction.ERROR, EText.ERROR);
|
||||||
|
return throwError(() => err)
|
||||||
|
})
|
||||||
|
).subscribe()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,13 +5,13 @@
|
|||||||
<div class="col-span-3 md:col-span-5 md:order-2">
|
<div class="col-span-3 md:col-span-5 md:order-2">
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<i matTextPrefix class="bi bi-search"></i>
|
<i matTextPrefix class="bi bi-search"></i>
|
||||||
<input matInput placeholder="เลขบัตรประชาชน/เลขหลังบัตร">
|
<input matInput placeholder="เลขบัตรประชาชน/เลขหลังบัตร" [(ngModel)]="query.card" (ngModelChange)="onFilterCard($event)">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-span-5 md:col-span-7 md:order-2">
|
<div class="col-span-5 md:col-span-7 md:order-2">
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<i matTextPrefix class="bi bi-search"></i>
|
<i matTextPrefix class="bi bi-search"></i>
|
||||||
<input matInput placeholder="ชื่อ-นามสกุล">
|
<input matInput placeholder="ชื่อ-นามสกุล" [(ngModel)]="query.name" (ngModelChange)="onFilterName($event)">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -24,80 +24,81 @@
|
|||||||
<tr mat-row *matRowDef="let row; columns: ['1','2','3','4','5','6','7','8','9','10','11','12'];"></tr>
|
<tr mat-row *matRowDef="let row; columns: ['1','2','3','4','5','6','7','8','9','10','11','12'];"></tr>
|
||||||
|
|
||||||
<ng-container matColumnDef="1">
|
<ng-container matColumnDef="1">
|
||||||
<th mat-header-cell *matHeaderCellDef class="tac" mat-sort-header>ลำดับ</th>
|
<th mat-header-cell *matHeaderCellDef class="tac">ลำดับ</th>
|
||||||
<td mat-cell *matCellDef="let item" width="150" class="tac">{{item.code}}</td>
|
<td mat-cell *matCellDef="let item; let i = index;" width="150" class="tac">{{getIndex(i)}}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="2">
|
<ng-container matColumnDef="2">
|
||||||
<th mat-header-cell *matHeaderCellDef class="tal">เลขบัตรประชาชน</th>
|
<th mat-header-cell *matHeaderCellDef class="tac">เลขบัตรประชาชน</th>
|
||||||
<td mat-cell *matCellDef="let item" class="" style="min-width: 200px;">
|
<td mat-cell *matCellDef="let item" class="tac" style="min-width: 200px;">
|
||||||
{{item.name }}
|
{{item.id_card}}
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="3">
|
<ng-container matColumnDef="3">
|
||||||
<th mat-header-cell *matHeaderCellDef class="tal" mat-sort-header>เลขหลังบัตร</th>
|
<th mat-header-cell *matHeaderCellDef class="tac">เลขหลังบัตร</th>
|
||||||
<td mat-cell *matCellDef="let item" class="">{{item?.masterProductBrand.name }}</td>
|
<td mat-cell *matCellDef="let item" class="tac">{{item.code_back_card}}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="4">
|
<ng-container matColumnDef="4">
|
||||||
<th mat-header-cell *matHeaderCellDef class="tal" width="150">วันหมดอายุ</th>
|
<th mat-header-cell *matHeaderCellDef class="tal" width="150">วันหมดอายุ</th>
|
||||||
<td mat-cell *matCellDef="let item" class="">{{item.size }}</td>
|
<td mat-cell *matCellDef="let item" class="">{{item.exp_date | thaidate}}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="5">
|
<ng-container matColumnDef="5">
|
||||||
<th mat-header-cell *matHeaderCellDef class="tal" width="150">คำนำหน้า</th>
|
<th mat-header-cell *matHeaderCellDef class="tac" width="150">คำนำหน้า</th>
|
||||||
<td mat-cell *matCellDef="let item" class="">{{item.weight }}</td>
|
<td mat-cell *matCellDef="let item" class="tac">{{item.prefix_name}}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
|
||||||
<ng-container matColumnDef="6">
|
<ng-container matColumnDef="6">
|
||||||
<th mat-header-cell *matHeaderCellDef class="tal" width="150">ชื่อ</th>
|
<th mat-header-cell *matHeaderCellDef class="tal" width="150">ชื่อ</th>
|
||||||
<td mat-cell *matCellDef="let item" class="">{{item.color }}</td>
|
<td mat-cell *matCellDef="let item" class="">{{item.first_name}}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="7">
|
<ng-container matColumnDef="7">
|
||||||
<th mat-header-cell *matHeaderCellDef class="tal" width="150">นามสกุล</th>
|
<th mat-header-cell *matHeaderCellDef class="tal" width="150">นามสกุล</th>
|
||||||
<td mat-cell *matCellDef="let item" class="">{{item.year }}</td>
|
<td mat-cell *matCellDef="let item" class="">{{item.last_name}}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="8">
|
<ng-container matColumnDef="8">
|
||||||
<th mat-header-cell *matHeaderCellDef class="tal" width="150" mat-sort-header>วัน เดือน ปีเกิด</th>
|
<th mat-header-cell *matHeaderCellDef class="tal" width="150">วัน เดือน ปีเกิด</th>
|
||||||
<td mat-cell *matCellDef="let item" class="">
|
<td mat-cell *matCellDef="let item" class="">
|
||||||
<div class="b-color-orange"> {{item.price | number : '1.2-2'}}</div>
|
<div> {{item.birth_date | thaidate}}</div>
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container matColumnDef="9">
|
<ng-container matColumnDef="9">
|
||||||
<th mat-header-cell *matHeaderCellDef class="tal" width="150" mat-sort-header>เบอร์โทรศัพท์</th>
|
<th mat-header-cell *matHeaderCellDef class="tal" width="150">เบอร์โทรศัพท์</th>
|
||||||
<td mat-cell *matCellDef="let item" class="">
|
<td mat-cell *matCellDef="let item" class="">
|
||||||
<div class="b-color-green"> {{item.latestPrice | number : '1.2-2' }}</div>
|
<div> {{item.phone}}</div>
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container matColumnDef="10">
|
<ng-container matColumnDef="10">
|
||||||
<th mat-header-cell *matHeaderCellDef width="80">E-mail</th>
|
<th mat-header-cell *matHeaderCellDef class="tac" width="150">E-mail</th>
|
||||||
<td mat-cell *matCellDef="let item">
|
<td mat-cell *matCellDef="let item" class="tac">
|
||||||
<div class="action flex justify-center">
|
<div> {{item.email}}</div>
|
||||||
<div class="item">
|
|
||||||
<i class="bi bi-file-earmark-text icon-doc"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container matColumnDef="11">
|
<ng-container matColumnDef="11">
|
||||||
<th mat-header-cell *matHeaderCellDef class="tal" width="150" mat-sort-header>More Detail</th>
|
<th mat-header-cell *matHeaderCellDef class="tac" width="150">More Detail</th>
|
||||||
<td mat-cell *matCellDef="let item" class="">
|
<td mat-cell *matCellDef="let item" class="tac">
|
||||||
<div class="b-color-green"> {{item.latestPrice | number : '1.2-2' }}</div>
|
<div class="action flex justify-center">
|
||||||
|
<div class="item cursor-pointer">
|
||||||
|
<i class="bi bi-pencil-square icon-edit mr-2" (click)="onEdit(item.kyc_uid)"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container matColumnDef="12">
|
<ng-container matColumnDef="12">
|
||||||
<th mat-header-cell *matHeaderCellDef class="tal" width="150" mat-sort-header>สถานะ</th>
|
<th mat-header-cell *matHeaderCellDef class="tac" width="150">สถานะ</th>
|
||||||
<td mat-cell *matCellDef="let item" class="">
|
<td mat-cell *matCellDef="let item" class="tac">
|
||||||
<div class="b-color-green"> {{item.latestPrice | number : '1.2-2' }}</div>
|
<div *ngIf="item.is_pass" class="status status-active">Approve</div>
|
||||||
|
<div *ngIf="!item.is_pass" class="status status-disabled">Reject</div>
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div *ngIf="dataSourceCount === 0" class="no-data"></div> -->
|
<!-- <div *ngIf="dataSourceCount === 0" class="no-data"></div> -->
|
||||||
<mat-paginator [pageSizeOptions]="[5,10,20]" showFirstLastButtons (page)="getData($event)"></mat-paginator>
|
<mat-paginator [pageSizeOptions]="[5,10,20]" showFirstLastButtons></mat-paginator>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,17 +1,52 @@
|
|||||||
import { Component, Input } from '@angular/core';
|
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
||||||
|
import { Subject, debounceTime, distinctUntilChanged } from 'rxjs';
|
||||||
|
import { BaseList } from 'src/app/core/base/base-list';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-list',
|
selector: 'app-list',
|
||||||
templateUrl: './list.component.html',
|
templateUrl: './list.component.html',
|
||||||
styleUrls: ['./list.component.scss']
|
styleUrls: ['./list.component.scss']
|
||||||
})
|
})
|
||||||
export class ListComponent {
|
export class ListComponent extends BaseList implements OnChanges {
|
||||||
@Input() kycList: any = [];
|
@Input() kycList: any = [];
|
||||||
|
@Output() edit = new EventEmitter();
|
||||||
|
@Output() search = new EventEmitter();
|
||||||
|
query = {
|
||||||
|
name: null,
|
||||||
|
card: null
|
||||||
|
}
|
||||||
|
name: string;
|
||||||
|
filterCard: Subject<string> = new Subject<string>();
|
||||||
constructor() {
|
constructor() {
|
||||||
|
super()
|
||||||
|
this.filterCard.pipe(
|
||||||
|
debounceTime(500),
|
||||||
|
distinctUntilChanged()
|
||||||
|
).subscribe(() => this.onSearch())
|
||||||
}
|
}
|
||||||
|
|
||||||
getData(event: any) {
|
ngOnChanges(): void {
|
||||||
|
this.kycList = this.updateMatTable(this.kycList? this.kycList:[])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onEdit(uid){
|
||||||
|
this.edit.emit(uid)
|
||||||
|
}
|
||||||
|
|
||||||
|
onFilterCard($event) {
|
||||||
|
// this.filterCard.next($event);
|
||||||
|
const filterValue = this.query.card;
|
||||||
|
this.kycList.filter = filterValue.trim().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
onFilterName($event){
|
||||||
|
const filterValue = this.query.name;
|
||||||
|
this.kycList.filter = filterValue.trim().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
onSearch(){
|
||||||
|
const filterValue = this.query.card;
|
||||||
|
this.kycList.filter = filterValue.trim().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ export class BannerContainer {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
return of([]);
|
||||||
})
|
})
|
||||||
).subscribe()
|
).subscribe()
|
||||||
}
|
}
|
||||||
@@ -57,6 +58,7 @@ export class BannerContainer {
|
|||||||
tap(() => this.cdr.detectChanges())
|
tap(() => this.cdr.detectChanges())
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
return of([]);
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
return edit$.subscribe();
|
return edit$.subscribe();
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
<div class="lg:flex lg:flex-col grid grid-cols-9 gap-2">
|
<div class="lg:flex lg:flex-col grid grid-cols-9 gap-2">
|
||||||
<mat-label class="col-span-1 lg:text-left lg:self-auto text-right self-center mr-4">แนบรูป</mat-label>
|
<mat-label class="col-span-1 lg:text-left lg:self-auto text-right self-center mr-4">แนบรูป</mat-label>
|
||||||
<div class="col-span-7">
|
<div class="col-span-7">
|
||||||
<div class="list-images" style="min-height: auto !important;" *ngIf="data">
|
<div class="list-images" style="min-height: auto !important;">
|
||||||
<div class=" grid grid-cols-12 gap-2 md:gap-2 items-center">
|
<div class=" grid grid-cols-12 gap-2 md:gap-2 items-center">
|
||||||
<div class="col-span-2 md:col-span-4">
|
<div class="col-span-2 md:col-span-4">
|
||||||
<div class="flex justify-center items-center list-images-item">
|
<div class="flex justify-center items-center list-images-item">
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import { BannerService } from 'src/app/core/service/common/banner.service';
|
|||||||
styleUrls: ['./dialog.component.scss']
|
styleUrls: ['./dialog.component.scss']
|
||||||
})
|
})
|
||||||
export class DialogComponent extends BaseForm implements OnInit {
|
export class DialogComponent extends BaseForm implements OnInit {
|
||||||
data = false;
|
|
||||||
constructor(
|
constructor(
|
||||||
public dialogRef: MatDialogRef<DialogComponent>,
|
public dialogRef: MatDialogRef<DialogComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) public dialog: IDialogConfigData,
|
@Inject(MAT_DIALOG_DATA) public dialog: IDialogConfigData,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ChangeDetectorRef, Component } from '@angular/core';
|
import { ChangeDetectorRef, Component } from '@angular/core';
|
||||||
import { Observable, catchError, filter, switchMap, tap, throwError } from 'rxjs';
|
import { Observable, catchError, filter, of, switchMap, tap, throwError } from 'rxjs';
|
||||||
import { IDialogConfig, CDialogConfig } from 'src/app/@common/interface/Dialog';
|
import { IDialogConfig, CDialogConfig } from 'src/app/@common/interface/Dialog';
|
||||||
import { EAction, EText } from 'src/app/@config/app';
|
import { EAction, EText } from 'src/app/@config/app';
|
||||||
import { PromotionService } from 'src/app/core/service/common/promotion.service';
|
import { PromotionService } from 'src/app/core/service/common/promotion.service';
|
||||||
@@ -37,6 +37,7 @@ export class PromotionContainer {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
return of([]);
|
||||||
})
|
})
|
||||||
).subscribe()
|
).subscribe()
|
||||||
}
|
}
|
||||||
@@ -55,6 +56,7 @@ export class PromotionContainer {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
return of([]);
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
return edit$.subscribe()
|
return edit$.subscribe()
|
||||||
|
|||||||
@@ -99,6 +99,18 @@ mat-label{
|
|||||||
// material
|
// material
|
||||||
// --------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.mat-calendar-previous-button::after, .mat-calendar-next-button::after {
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
position: absolute;
|
||||||
|
content: "";
|
||||||
|
margin: 10.5px !important;
|
||||||
|
border: 0 solid currentColor;
|
||||||
|
border-top-width: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
.mat-body, .mat-body-2, .mat-typography .mat-body, .mat-typography .mat-body-2, .mat-typography {
|
.mat-body, .mat-body-2, .mat-typography .mat-body, .mat-typography .mat-body-2, .mat-typography {
|
||||||
font: 400 14px/20px $fontFamily !important;
|
font: 400 14px/20px $fontFamily !important;
|
||||||
}
|
}
|
||||||
@@ -692,18 +704,28 @@ iframe {
|
|||||||
.btn-submit {
|
.btn-submit {
|
||||||
background: #624DE3 !important;
|
background: #624DE3 !important;
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: #5a45e3 !important;
|
background: #5a45e3 !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-green {
|
||||||
|
background: green !important;
|
||||||
|
color: #fff !important;
|
||||||
|
transition: all 300ms;
|
||||||
|
&:hover {
|
||||||
|
background: #5a45e3 !important;
|
||||||
|
transition: all 300ms;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.btn-red {
|
.btn-red {
|
||||||
background: #A30D11 !important;
|
background: #A30D11 !important;
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
|
transition: all 300ms;
|
||||||
&:hover {
|
&:hover {
|
||||||
background: #A30D11 !important;
|
transition: all 300ms;
|
||||||
|
background: gray !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user