WEB-367 Creating duplicate Accounting Rules causes Javascript errors that the user shouldn't see 1:1 (#2898)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, inject } from '@angular/core';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
|
||||
import { Router, ActivatedRoute, RouterLink } from '@angular/router';
|
||||
|
||||
@@ -33,6 +35,8 @@ export class CreateRuleComponent implements OnInit {
|
||||
private accountingService = inject(AccountingService);
|
||||
private route = inject(ActivatedRoute);
|
||||
private router = inject(Router);
|
||||
private snackBar = inject(MatSnackBar);
|
||||
private translateService = inject(TranslateService);
|
||||
|
||||
/** Accounting rule form. */
|
||||
accountingRuleForm: UntypedFormGroup;
|
||||
@@ -45,13 +49,6 @@ export class CreateRuleComponent implements OnInit {
|
||||
/** Credit tag data. */
|
||||
creditTagData: any;
|
||||
|
||||
/**
|
||||
* Retrieves the offices, gl accounts, debit tags and credit tags data from `resolve`.
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {AccountingService} accountingService Accounting Service.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor() {
|
||||
this.route.data.subscribe((data: { accountingRulesTemplate: any }) => {
|
||||
this.officeData = data.accountingRulesTemplate.allowedOffices;
|
||||
@@ -141,14 +138,42 @@ export class CreateRuleComponent implements OnInit {
|
||||
}
|
||||
delete accountingRule.debitRuleType;
|
||||
delete accountingRule.creditRuleType;
|
||||
this.accountingService.createAccountingRule(accountingRule).subscribe((response: any) => {
|
||||
this.router.navigate(
|
||||
[
|
||||
'../view',
|
||||
response.resourceId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
this.accountingService.createAccountingRule(accountingRule).subscribe({
|
||||
next: (response: any) => {
|
||||
this.router.navigate(
|
||||
[
|
||||
'../view',
|
||||
response.resourceId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
},
|
||||
error: (err) => {
|
||||
const duplicateMsg = this.translateService.instant('errors.accountingRule.duplicateName');
|
||||
if (
|
||||
err?.error?.defaultUserMessage?.includes('Duplicate entry') ||
|
||||
(typeof err?.error?.message === 'string' && err.error.message.includes('Duplicate entry')) ||
|
||||
(typeof err?.error === 'string' && err.error.includes('Duplicate entry'))
|
||||
) {
|
||||
this.snackBar.open(duplicateMsg, 'Close', {
|
||||
duration: 7000,
|
||||
verticalPosition: 'top',
|
||||
horizontalPosition: 'right',
|
||||
panelClass: 'custom-snackbar-top-right'
|
||||
});
|
||||
} else {
|
||||
this.snackBar.open(
|
||||
err?.error?.defaultUserMessage || err?.error?.message || 'An error occurred. Please try again.',
|
||||
'Close',
|
||||
{
|
||||
duration: 7000,
|
||||
verticalPosition: 'top',
|
||||
horizontalPosition: 'right',
|
||||
panelClass: 'custom-snackbar-top-right'
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
"Logged in as": "Přihlášen jako",
|
||||
"Remember me": "Zapamatuj si mě",
|
||||
"errors": {
|
||||
"accountingRule": {
|
||||
"duplicateName": "Omlouváme se, ale účetní pravidlo s tímto názvem již existuje."
|
||||
},
|
||||
"error.resource.notImplemented.type": "Nenaimplementovaná chyba",
|
||||
"error.resource.notImplemented.message": "Funkce není implementována!",
|
||||
"linkedSavingsAccountOwnership": "Propojený spořicí účet nepatří vybranému klientovi.",
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
"Logged in as": "Angemeldet als",
|
||||
"Remember me": "Erinnere dich an mich",
|
||||
"errors": {
|
||||
"accountingRule": {
|
||||
"duplicateName": "Entschuldigung, aber eine Buchungsregel mit diesem Namen existiert bereits."
|
||||
},
|
||||
"error.resource.notImplemented.type": "Nicht implementierter Fehler",
|
||||
"error.resource.notImplemented.message": "Nicht implementierte Funktion!",
|
||||
"linkedSavingsAccountOwnership": "Verknüpftes Sparkonto gehört nicht zum ausgewählten Kunden.",
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
"error.resource.notImplemented.type": "Not Implemented Error",
|
||||
"error.resource.notImplemented.message": "Not implemented functionality!",
|
||||
"errors": {
|
||||
"accountingRule": {
|
||||
"duplicateName": "Sorry, but an Accounting Rule with this Name exists already."
|
||||
},
|
||||
"linkedSavingsAccountOwnership": "Linked savings account does not belong to the selected client.",
|
||||
"clientNotInGSIM": "Client with ID {{id}} is not present in GSIM.",
|
||||
"Capitalized Income amount adjusted already adjusted": "Capitalized Income amount already adjusted",
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
"Logged in as": "Conectado como",
|
||||
"Remember me": "Recordar me",
|
||||
"errors": {
|
||||
"accountingRule": {
|
||||
"duplicateName": "Lo sentimos, pero ya existe una regla contable con este nombre."
|
||||
},
|
||||
"error.resource.notImplemented.type": "Error no implementado",
|
||||
"error.resource.notImplemented.message": "¡Funcionalidad no implementada!",
|
||||
"linkedSavingsAccountOwnership": "La cuenta de ahorro vinculada no pertenece al cliente seleccionado.",
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
"Logged in as": "Conectado como",
|
||||
"Remember me": "Recordar me",
|
||||
"errors": {
|
||||
"accountingRule": {
|
||||
"duplicateName": "Lo sentimos, pero ya existe una regla contable con este nombre."
|
||||
},
|
||||
"error.resource.notImplemented.type": "Error no implementado",
|
||||
"error.resource.notImplemented.message": "¡Funcionalidad no implementada!",
|
||||
"linkedSavingsAccountOwnership": "La cuenta de ahorro vinculada no pertenece al cliente seleccionado.",
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
"Logged in as": "connecté en tant que",
|
||||
"Remember me": "Souviens-toi de moi",
|
||||
"errors": {
|
||||
"accountingRule": {
|
||||
"duplicateName": "Désolé, mais une règle comptable portant ce nom existe déjà."
|
||||
},
|
||||
"error.resource.notImplemented.type": "Erreur non implémentée",
|
||||
"error.resource.notImplemented.message": "Fonctionnalité non implémentée !",
|
||||
"linkedSavingsAccountOwnership": "Le compte d'épargne lié n'appartient pas au client sélectionné.",
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
"Logged in as": "Collegato come",
|
||||
"Remember me": "Ricordati di me",
|
||||
"errors": {
|
||||
"accountingRule": {
|
||||
"duplicateName": "Spiacenti, ma esiste già una regola contabile con questo nome."
|
||||
},
|
||||
"error.resource.notImplemented.type": "Errore non implementato",
|
||||
"error.resource.notImplemented.message": "Funzionalità non implementata!",
|
||||
"linkedSavingsAccountOwnership": "Il conto di risparmio collegato non appartiene al cliente selezionato.",
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
"Logged in as": "다음 계정으로 로그인됨",
|
||||
"Remember me": "날 기억해",
|
||||
"errors": {
|
||||
"accountingRule": {
|
||||
"duplicateName": "죄송합니다. 이미 동일한 이름의 회계 규칙이 존재합니다."
|
||||
},
|
||||
"error.resource.notImplemented.type": "구현되지 않은 오류",
|
||||
"error.resource.notImplemented.message": "구현되지 않은 기능입니다!",
|
||||
"linkedSavingsAccountOwnership": "연결된 저축 계좌가 선택한 클라이언트에 속하지 않습니다.",
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
"Logged in as": "prisijungęs kaip",
|
||||
"Remember me": "Prisimink mane",
|
||||
"errors": {
|
||||
"accountingRule": {
|
||||
"duplicateName": "Atsiprašome, bet apskaitos taisyklė su šiuo pavadinimu jau egzistuoja."
|
||||
},
|
||||
"error.resource.notImplemented.type": "Neįdiegta klaida",
|
||||
"error.resource.notImplemented.message": "Funkcionalumas neįdiegtas!",
|
||||
"linkedSavingsAccountOwnership": "Susieta taupomoji sąskaita nepriklauso pasirinktam klientui.",
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
"Logged in as": "ielogojies Kā",
|
||||
"Remember me": "Atceries mani",
|
||||
"errors": {
|
||||
"accountingRule": {
|
||||
"duplicateName": "Atvainojiet, bet grāmatvedības noteikums ar šo nosaukumu jau pastāv."
|
||||
},
|
||||
"error.resource.notImplemented.type": "Neieviesta kļūda",
|
||||
"error.resource.notImplemented.message": "Funkcionalitāte nav ieviesta!",
|
||||
"linkedSavingsAccountOwnership": "Saistītais krājkonts nepieder izvēlētajam klientam.",
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
"Logged in as": "को रूपमा लग इन गरियो",
|
||||
"Remember me": "मलाई सम्झनुहोस्",
|
||||
"errors": {
|
||||
"accountingRule": {
|
||||
"duplicateName": "माफ गर्नुहोस्, यो नामको लेखा नियम पहिले नै अवस्थित छ।"
|
||||
},
|
||||
"error.resource.notImplemented.type": "लागू नभएको त्रुटि",
|
||||
"error.resource.notImplemented.message": "कार्यक्षमता लागू गरिएको छैन!",
|
||||
"linkedSavingsAccountOwnership": "लिंक गरिएको बचत खाता चयनित ग्राहकको होइन।",
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
"Logged in as": "logado como",
|
||||
"Remember me": "Lembre de mim",
|
||||
"errors": {
|
||||
"accountingRule": {
|
||||
"duplicateName": "Desculpe, mas já existe uma regra contabilística com este nome."
|
||||
},
|
||||
"error.resource.notImplemented.type": "Erro não implementado",
|
||||
"error.resource.notImplemented.message": "Funcionalidade não implementada!",
|
||||
"linkedSavingsAccountOwnership": "A conta poupança vinculada não pertence ao cliente selecionado.",
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
"Logged in as": "Imeingia kama",
|
||||
"Remember me": "Nikumbuke",
|
||||
"errors": {
|
||||
"accountingRule": {
|
||||
"duplicateName": "Samahani, lakini Kanuni ya Uhasibu yenye jina hili tayari ipo."
|
||||
},
|
||||
"error.resource.notImplemented.type": "Hitilafu ya Kukamilika Haijatimizwa",
|
||||
"error.resource.notImplemented.message": "Utendakazi haujatekelezwa!",
|
||||
"linkedSavingsAccountOwnership": "Akaunti ya akiba iliyounganishwa haimilikiwi na mteja aliyechaguliwa.",
|
||||
|
||||
+9
-10
@@ -1,11 +1,3 @@
|
||||
// Version 1
|
||||
|
||||
/*
|
||||
* Entry point of global application style.
|
||||
* Component-specific style should not go here and be included directly as part of the components.
|
||||
*/
|
||||
|
||||
// Import Default Theme for MifosX
|
||||
@use 'theme/mifosx-theme';
|
||||
@use 'theme/pictonblue-yellowgreen' as *;
|
||||
@use 'theme/indigo-pink' as *;
|
||||
@@ -17,13 +9,20 @@
|
||||
@use 'lightgallery/scss/lg-thumbnail' as *;
|
||||
@use 'lightgallery/scss/lg-zoom' as *;
|
||||
@use 'lightgallery/scss/lg-fullscreen' as *;
|
||||
@use 'app/core/error-handler/error-handler.component';
|
||||
|
||||
// Global Imports
|
||||
|
||||
/* You can add global styles to this file, and also import other style files */
|
||||
|
||||
// Error Handler Service Styles
|
||||
@use 'app/core/error-handler/error-handler.component';
|
||||
.custom-snackbar-top-right {
|
||||
top: 48px !important;
|
||||
right: 24px !important;
|
||||
left: auto !important;
|
||||
transform: none !important;
|
||||
position: fixed !important;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.scrollbar-styling {
|
||||
scrollbar-width: thin;
|
||||
|
||||
Reference in New Issue
Block a user