Fix: Error messages were not properly captured in the frontend.
Feature: F5,6,7 to change between Receipt, Payment and Journal voucher.
This commit is contained in:
@ -1,8 +1,6 @@
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from . import to_camel
|
||||
|
||||
from . import Daf
|
||||
from . import Daf, to_camel
|
||||
|
||||
|
||||
class AttendanceType(BaseModel):
|
||||
|
||||
@ -2,11 +2,9 @@ import uuid
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from . import to_camel
|
||||
from . import Daf, to_camel
|
||||
from .product import ProductLink
|
||||
|
||||
from . import Daf
|
||||
|
||||
|
||||
class Batch(BaseModel):
|
||||
id_: uuid.UUID | None = None
|
||||
|
||||
@ -2,9 +2,7 @@ import uuid
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from . import to_camel
|
||||
|
||||
from . import Daf
|
||||
from . import Daf, to_camel
|
||||
|
||||
|
||||
class Incentive(BaseModel):
|
||||
|
||||
@ -2,11 +2,9 @@ import uuid
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from . import to_camel
|
||||
from . import Daf, to_camel
|
||||
from .batch import Batch
|
||||
|
||||
from . import Daf
|
||||
|
||||
|
||||
class Inventory(BaseModel):
|
||||
id_: uuid.UUID | None = None
|
||||
|
||||
@ -2,9 +2,7 @@ import uuid
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from . import to_camel
|
||||
|
||||
from . import Daf
|
||||
from . import Daf, to_camel
|
||||
|
||||
|
||||
class IssueGridItem(BaseModel):
|
||||
|
||||
@ -2,12 +2,10 @@ import uuid
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from . import to_camel
|
||||
from . import Daf, to_camel
|
||||
from .account import AccountLink
|
||||
from .cost_centre import CostCentreLink
|
||||
|
||||
from . import Daf
|
||||
|
||||
|
||||
class Journal(BaseModel):
|
||||
id_: uuid.UUID | None = None
|
||||
|
||||
@ -2,9 +2,7 @@ import uuid
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from . import to_camel
|
||||
|
||||
from . import Daf
|
||||
from . import Daf, to_camel
|
||||
|
||||
|
||||
class ProductSku(BaseModel):
|
||||
|
||||
@ -2,11 +2,9 @@ import uuid
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from . import to_camel
|
||||
from . import Daf, to_camel
|
||||
from .product import ProductLink
|
||||
|
||||
from . import Daf
|
||||
|
||||
|
||||
class RateContractItem(BaseModel):
|
||||
id_: uuid.UUID | None = None
|
||||
|
||||
@ -2,11 +2,9 @@ import uuid
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from . import to_camel
|
||||
from . import Daf, to_camel
|
||||
from .product import ProductLink
|
||||
|
||||
from . import Daf
|
||||
|
||||
|
||||
class RecipeItem(BaseModel):
|
||||
id_: uuid.UUID | None = None
|
||||
|
||||
@ -3,7 +3,6 @@ import uuid
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from . import to_camel
|
||||
|
||||
from .permission import PermissionItem
|
||||
|
||||
|
||||
|
||||
@ -36,8 +36,8 @@ build-backend = "poetry.core.masonry.api"
|
||||
|
||||
[tool.ruff]
|
||||
line-length = 120
|
||||
# Assume Python 3.12.
|
||||
target-version = "py312"
|
||||
# Assume Python 3.13.
|
||||
target-version = "py313"
|
||||
exclude = [
|
||||
".eggs",
|
||||
".git",
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { AfterViewInit, Component, ElementRef, inject, OnInit, ViewChild } from '@angular/core';
|
||||
import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, inject, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
|
||||
import { MatButton } from '@angular/material/button';
|
||||
import { MatCard, MatCardActions, MatCardContent, MatCardHeader, MatCardTitle } from '@angular/material/card';
|
||||
@ -38,6 +38,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||
private router = inject(Router);
|
||||
private snackBar = inject(MatSnackBar);
|
||||
private cs = inject(CookieService);
|
||||
private cd = inject(ChangeDetectorRef);
|
||||
|
||||
@ViewChild('nameElement', { static: true }) nameElement!: ElementRef<HTMLInputElement>;
|
||||
form: FormGroup<{
|
||||
@ -87,6 +88,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||
if (error.status === 401 && error.error.detail === 'Client is not registered') {
|
||||
this.showOtp = true;
|
||||
this.clientId = this.cs.getCookie('client_id');
|
||||
this.cd.detectChanges();
|
||||
}
|
||||
this.snackBar.open(error.error.details, 'Danger');
|
||||
},
|
||||
|
||||
@ -20,13 +20,13 @@ export const authInterceptor: HttpInterceptorFn = (req, next) => {
|
||||
if (req.url.includes('/refresh')) {
|
||||
inject(AuthService).logout();
|
||||
}
|
||||
return throwError(() => new Error(err));
|
||||
return throwError(() => err);
|
||||
}
|
||||
// If error status is different than 401 we want to skip refresh token
|
||||
// So we check that and throw the error if it's the case
|
||||
if (err.status !== 401) {
|
||||
const error = err.error.message || err.error.detail || err.statusText;
|
||||
return throwError(() => new Error(error));
|
||||
return throwError(() => error);
|
||||
}
|
||||
// auto logout if 401 response returned from api
|
||||
inject(AuthService).logout();
|
||||
@ -46,7 +46,7 @@ export const authInterceptor: HttpInterceptorFn = (req, next) => {
|
||||
inject(Router).navigate(['login']);
|
||||
}
|
||||
});
|
||||
return throwError(() => new Error(err));
|
||||
return throwError(() => err);
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
@ -132,6 +132,23 @@ export class JournalComponent implements OnInit, AfterViewInit {
|
||||
this.dateElement.nativeElement.select();
|
||||
}
|
||||
|
||||
@HostListener('window:keydown.f5', ['$event'])
|
||||
redirectToPayment(event: KeyboardEvent) {
|
||||
event.preventDefault();
|
||||
this.router.navigate(['payment']);
|
||||
}
|
||||
|
||||
@HostListener('window:keydown.f6', ['$event'])
|
||||
redirectToReciept(event: KeyboardEvent) {
|
||||
event.preventDefault();
|
||||
this.router.navigate(['receipt']);
|
||||
}
|
||||
|
||||
@HostListener('window:keydown.f7', ['$event'])
|
||||
redirectToJournal(event: KeyboardEvent) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
@HostListener('window:keydown.control.s', ['$event'])
|
||||
saveListner(event: KeyboardEvent) {
|
||||
event.preventDefault();
|
||||
|
||||
@ -132,6 +132,27 @@ export class PaymentComponent implements OnInit, AfterViewInit {
|
||||
this.dateElement.nativeElement.select();
|
||||
}
|
||||
|
||||
@HostListener('window:keydown.f5', ['$event'])
|
||||
redirectToPayment(event: KeyboardEvent) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
@HostListener('window:keydown.f6', ['$event'])
|
||||
redirectToReciept(event: KeyboardEvent) {
|
||||
event.preventDefault();
|
||||
this.router.navigate(['receipt'], {
|
||||
queryParams: {
|
||||
a: this.form.controls.paymentAccount.value,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@HostListener('window:keydown.f7', ['$event'])
|
||||
redirectToJournal(event: KeyboardEvent) {
|
||||
event.preventDefault();
|
||||
this.router.navigate(['journal']);
|
||||
}
|
||||
|
||||
@HostListener('window:keydown.control.s', ['$event'])
|
||||
saveListner(event: KeyboardEvent) {
|
||||
event.preventDefault();
|
||||
|
||||
@ -132,6 +132,27 @@ export class ReceiptComponent implements OnInit, AfterViewInit {
|
||||
this.dateElement.nativeElement.select();
|
||||
}
|
||||
|
||||
@HostListener('window:keydown.f5', ['$event'])
|
||||
redirectToPayment(event: KeyboardEvent) {
|
||||
event.preventDefault();
|
||||
this.router.navigate(['payment'], {
|
||||
queryParams: {
|
||||
a: this.form.controls.receiptAccount.value,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@HostListener('window:keydown.f6', ['$event'])
|
||||
redirectToReciept(event: KeyboardEvent) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
@HostListener('window:keydown.f7', ['$event'])
|
||||
redirectToJournal(event: KeyboardEvent) {
|
||||
event.preventDefault();
|
||||
this.router.navigate(['journal']);
|
||||
}
|
||||
|
||||
@HostListener('window:keydown.control.s', ['$event'])
|
||||
saveListner(event: KeyboardEvent) {
|
||||
event.preventDefault();
|
||||
|
||||
Reference in New Issue
Block a user