-accouting Wep
All checks were successful
Build Docker Image / Build Docker Image (push) Successful in 8m54s

This commit is contained in:
x2Skyz
2025-11-21 15:01:21 +07:00
parent 1c7729ab99
commit 45259f7b8d
21 changed files with 590 additions and 350 deletions

View File

@@ -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>

View File

@@ -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';

View File

@@ -1 +1 @@
<app-main-dashboard></app-main-dashboard>
<app-main-dashboard (saveEventSubmit)="OnSaveSubmit($event)"></app-main-dashboard>

View File

@@ -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';