-accouting Wep
All checks were successful
Build Docker Image / Build Docker Image (push) Successful in 8m54s
All checks were successful
Build Docker Image / Build Docker Image (push) Successful in 8m54s
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
} @else if(mode == "forgot-password"){
|
||||
<app-login-forgot (otpEventSubmit)="onOtpSendSubmit($event)" (otpVerifyEventSubmit)="onVerifySubmit($event)"></app-login-forgot>
|
||||
}
|
||||
<!-- @else {
|
||||
|
||||
} -->
|
||||
@else if(mode == "register"){
|
||||
<app-login-register (registeredEventSubmit)="onRegisterSubmit($event)"></app-login-register>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -14,7 +14,7 @@ import { finalize } from 'rxjs/operators';
|
||||
export class LoginContentComponent implements OnInit {
|
||||
@ViewChild(LoginForgotComponent) loginForgotComponent!: LoginForgotComponent;
|
||||
@ViewChild(LoginPageComponent) loginPageComponent!: LoginPageComponent;
|
||||
mode: 'forgot-password' | 'default' = 'default';
|
||||
mode: 'forgot-password' | 'register' | 'default' = 'default';
|
||||
|
||||
constructor(
|
||||
private generalService: GeneralService,
|
||||
@@ -27,6 +27,8 @@ export class LoginContentComponent implements OnInit {
|
||||
|
||||
if (param === 'forgot-password') {
|
||||
this.mode = 'forgot-password';
|
||||
}else if(param === 'register'){
|
||||
this.mode = 'register';
|
||||
} else {
|
||||
// this.router.navigate(['/login']); // This can cause navigation loops
|
||||
this.mode = 'default';
|
||||
@@ -57,6 +59,7 @@ export class LoginContentComponent implements OnInit {
|
||||
if (result.code === '200' && result.data?.token) {
|
||||
this.generalService.trowApi(result);
|
||||
localStorage.setItem('access_token', result.data.token);
|
||||
localStorage.setItem('username', result.data.usrthinam);
|
||||
this.router.navigate(['main/dashboard']);
|
||||
} else {
|
||||
const errorMessage = result.message_th || result.message || 'Sign-in failed.';
|
||||
@@ -76,6 +79,28 @@ export class LoginContentComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
onRegisterSubmit(value: any){
|
||||
const uri = '/api/login/register';
|
||||
const request = {
|
||||
username: value.username,
|
||||
password: value.password,
|
||||
email: value.email
|
||||
};
|
||||
|
||||
this.generalService.postRequest(uri, request).subscribe({
|
||||
next: (result: any) => {
|
||||
if (result.code === '200') { }
|
||||
else {
|
||||
this.generalService.trowApi(result);
|
||||
}
|
||||
},
|
||||
error: (error: any) => {
|
||||
this.generalService.trowApi(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
onOtpSendSubmit(value: any){
|
||||
let uri = '/api/login/otp/send';
|
||||
|
||||
@@ -1 +1 @@
|
||||
<app-main-dashboard></app-main-dashboard>
|
||||
<app-main-dashboard (saveEventSubmit)="OnSaveSubmit($event)"></app-main-dashboard>
|
||||
|
||||
@@ -20,7 +20,7 @@ export class MainDashboardContentComponent implements OnInit {
|
||||
summary: {
|
||||
totalIncome: '',
|
||||
totalExpense: '',
|
||||
netProfit: '',
|
||||
netProfit: 0,
|
||||
profitRate: '',
|
||||
adjustedProfitRate: '',
|
||||
period: ''
|
||||
@@ -67,7 +67,27 @@ export class MainDashboardContentComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
OnSaveSubmit(value: any){
|
||||
const uri = '/api/web/accountingAdd';
|
||||
let request = value
|
||||
this.generalService.postRequest(uri, request).subscribe({
|
||||
next: (result: any) => {
|
||||
if (result.code === '200') {
|
||||
this.generalService.trowApi(result);
|
||||
// this.myActData = result.data;
|
||||
// this.dashboardStateService.setStateAccountResult(this.myActData);
|
||||
}else{
|
||||
this.generalService.trowApi(result);
|
||||
}
|
||||
},
|
||||
error: (error: any) => {
|
||||
this.generalService.trowApi(error);
|
||||
},
|
||||
complete: () => {
|
||||
this.ngOnInit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
OnSetupDashboard(value: any, setupFirst: boolean): void {
|
||||
const uri = '/api/web/accountingSetup';
|
||||
|
||||
Reference in New Issue
Block a user