fix Error toaster phase1

This commit is contained in:
E98Developer 2026-03-29 07:03:43 +02:00
parent bfcde03084
commit eb88812d89
7 changed files with 30 additions and 16 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"/js/app.js": "/js/app.js?id=c3305cf2e0efb767261d2b2b14965bd2", "/js/app.js": "/js/app.js?id=b2b26ba4c8485e78de1ad23b8c72997d",
"/js/admin.js": "/js/admin.js?id=da5d82ea896b3250811b365e143abfc4", "/js/admin.js": "/js/admin.js?id=a3f796dee735ea8029b653e812781e63",
"/js/module.js": "/js/module.js?id=9baa3aeb550477277796c6ebeff868c4", "/js/module.js": "/js/module.js?id=9baa3aeb550477277796c6ebeff868c4",
"/js/components.js": "/js/components.js?id=34668cee8ac371c98657beffcff579b8", "/js/components.js": "/js/components.js?id=34668cee8ac371c98657beffcff579b8",
"/css/app.css": "/css/app.css?id=11474616a7ef31af1acf43a25d65f4b6", "/css/app.css": "/css/app.css?id=11474616a7ef31af1acf43a25d65f4b6",

View File

@ -171,6 +171,7 @@ window.SupplierAdmin=function (options,SupplierItem) {
}, },
success:function (data){ success:function (data){
debug('d1: Save success ');
debug(data); debug(data);
if(data.success==true){ if(data.success==true){

View File

@ -182,10 +182,11 @@ window.select2CreateTag=function (params){
window.ajaxErrorHandler= function (xhr, ajaxOptions, thrownError){ window.ajaxErrorHandler= function (xhr, ajaxOptions, thrownError){
debug(this); debug(this);
debug(xhr); console.error(xhr);
debug(ajaxOptions); console.error(ajaxOptions);
debug(thrownError); console.error(thrownError);
if (xhr.responseJSON.errors) { if (xhr.responseJSON.errors) {
console.error("d2---------------");
if("jsonapi" in xhr.responseJSON){ if("jsonapi" in xhr.responseJSON){
ajaxErrorFieldHandlerJsonAPI(xhr.responseJSON.errors); ajaxErrorFieldHandlerJsonAPI(xhr.responseJSON.errors);
}else{ }else{
@ -194,8 +195,10 @@ window.ajaxErrorHandler= function (xhr, ajaxOptions, thrownError){
}else{ }else{
if(xhr.status==404){ if(xhr.status==404){
console.error("d3---------------");
ajaxErrorFieldHandler({'detail':'Nincs ilyen elem.'}); ajaxErrorFieldHandler({'detail':'Nincs ilyen elem.'});
}else{ }else{
console.error("d4---------------");
ajaxErrorFieldHandler({'detail':'Általános hiba.'}); ajaxErrorFieldHandler({'detail':'Általános hiba.'});
} }
} }
@ -203,6 +206,7 @@ window.ajaxErrorHandler= function (xhr, ajaxOptions, thrownError){
} }
window.ajaxErrorFieldHandlerJsonAPI= function (errors, container) { window.ajaxErrorFieldHandlerJsonAPI= function (errors, container) {
console.error("d6---------------");
let toastBodyHtml = ''; let toastBodyHtml = '';
let toastTitle = 'Hiba'; let toastTitle = 'Hiba';
console.error(errors); console.error(errors);
@ -216,21 +220,28 @@ window.ajaxErrorFieldHandlerJsonAPI= function (errors, container) {
if("detail" in value){ if("detail" in value){
toastBodyHtml += '<div>' + value.detail + '<div>'; toastBodyHtml += '<div>' + value.detail + '<div>';
} }
Toast.create(toastTitle, toastBodyHtml, TOAST_STATUS.DANGER, 10000); Toast.create({
title: toastTitle,
message: toastBodyHtml,
status: TOAST_STATUS.DANGER, // SUCCESS (zöld)
timeout: 10000
});
}); });
} }
window.ajaxErrorFieldHandler = function (errors, container) { window.ajaxErrorFieldHandler = function (errors, container) {
console.error("d5---------------");
console.error(errors);
let toastBodyHtml = ''; let toastBodyHtml = '';
$.each(errors, function (index, value) { $.each(errors, function (index, value) {
toastBodyHtml += '<div>' + value + '<div>'; toastBodyHtml += '<div>' + value + '<div>';
}); });
Toast.create("Hiba!", toastBodyHtml, TOAST_STATUS.DANGER, 10000);
/* Toast.create({
Toast.fire({ title: "Hiba!",
icon: 'error', message: toastBodyHtml,
html: toastBodyHtml status: TOAST_STATUS.DANGER, // SUCCESS (zöld)
timeout: 10000
}); });
*/
} }
$.ajaxSetup({ $.ajaxSetup({
error:ajaxErrorHandler, error:ajaxErrorHandler,

View File

@ -92,7 +92,7 @@
}); });
/*
window.ajaxErrorFieldHandler = function (errors, container) { window.ajaxErrorFieldHandler = function (errors, container) {
let toastBodyHtml = ''; let toastBodyHtml = '';
$.each(errors, function (index, value) { $.each(errors, function (index, value) {
@ -100,7 +100,7 @@
}); });
Toast.create("Hiba!", toastBodyHtml, TOAST_STATUS.DANGER, 10000); Toast.create("Hiba!", toastBodyHtml, TOAST_STATUS.DANGER, 10000);
} }
*/
/* /*
if(!$.fn.jstree){ if(!$.fn.jstree){

View File

@ -98,6 +98,7 @@
/*
window.ajaxErrorFieldHandler = function (errors, container) { window.ajaxErrorFieldHandler = function (errors, container) {
let toastBodyHtml = ''; let toastBodyHtml = '';
$.each(errors, function (index, value) { $.each(errors, function (index, value) {
@ -105,6 +106,7 @@
}); });
Toast.create("Hiba!", toastBodyHtml, TOAST_STATUS.DANGER, 10000); Toast.create("Hiba!", toastBodyHtml, TOAST_STATUS.DANGER, 10000);
} }
*/
/* /*