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/admin.js": "/js/admin.js?id=da5d82ea896b3250811b365e143abfc4",
"/js/app.js": "/js/app.js?id=b2b26ba4c8485e78de1ad23b8c72997d",
"/js/admin.js": "/js/admin.js?id=a3f796dee735ea8029b653e812781e63",
"/js/module.js": "/js/module.js?id=9baa3aeb550477277796c6ebeff868c4",
"/js/components.js": "/js/components.js?id=34668cee8ac371c98657beffcff579b8",
"/css/app.css": "/css/app.css?id=11474616a7ef31af1acf43a25d65f4b6",

View File

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

View File

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

View File

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

View File

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