ADD error headling to supplier.js and profitCenter.js

This commit is contained in:
E98Developer 2026-03-29 07:51:42 +02:00
parent e3ecda2f3e
commit 1f28044046
7 changed files with 28 additions and 12 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=e8e72c61f1eed7ccaa5bd55f8edc43da", "/js/app.js": "/js/app.js?id=8eebbb7cc03522e40f2a774f36c0d6b0",
"/js/admin.js": "/js/admin.js?id=2324b5d3c13edd33c62f910a1d8ef0c2", "/js/admin.js": "/js/admin.js?id=4b9d03c88a5090900218d5b5c5063a28",
"/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

@ -572,10 +572,14 @@ window.ProfitCenterAdmin=function (options,ProfitCenterItem) {
debug($(CSSSelectorForm)); debug($(CSSSelectorForm));
if ($(CSSSelectorForm)[0].checkValidity() === false) { if ($(CSSSelectorForm)[0].checkValidity() === false) {
console.log('validaton false'); console.log('validaton false');
$(CSSSelectorForm).addClass('was-validated');
$(CSSSelectorForm)[0].reportValidity();
Toast.create({ title: "Validációs hiba!", message: "Kérjük, töltse ki a kötelező mezőket!", status: TOAST_STATUS.DANGER, timeout: 5000 });
event.stopPropagation(); event.stopPropagation();
return; return;
} else { } else {
console.log('validaton ok'); console.log('validaton ok');
$(CSSSelectorForm).removeClass('was-validated');
//do your ajax submition here //do your ajax submition here
} }
let ajaxData=root.formDataToDataObjectAPICall(CSSSelectorForm); let ajaxData=root.formDataToDataObjectAPICall(CSSSelectorForm);
@ -615,7 +619,7 @@ window.ProfitCenterAdmin=function (options,ProfitCenterItem) {
//Opts.onAfterInitViewDetails=root.autofillDetails; //Opts.onAfterInitViewDetails=root.autofillDetails;
Opts.dataTable.orderDirective=[0, 'desc']; Opts.dataTable.orderDirective=[0, 'desc'];
Toast.create("Sikeres rögzítés!", ajaxData.get('name')+" nevű beszálllító elmentve", TOAST_STATUS.SUCCESS,5000); Toast.create({ title: "Sikeres rögzítés!", message: ajaxData.get('name')+" nevű profitcenter elmentve", status: TOAST_STATUS.SUCCESS, timeout: 5000 });
APP.loadMainContent(Opts.URL.index+'?init=0',root.initViewList); APP.loadMainContent(Opts.URL.index+'?init=0',root.initViewList);
} }
} }

View File

@ -9,6 +9,12 @@ if(typeof Supplier==='undefined'){
if(typeof this.contact ==="undefined"){ if(typeof this.contact ==="undefined"){
this.contact=[]; this.contact=[];
} }
if(typeof this.canSee ==="undefined"){
this.canSee=1;
}
if(typeof this.canSeeInOrder ==="undefined"){
this.canSeeInOrder=1;
}
console.log('Supplier constructor called'); console.log('Supplier constructor called');
}; };
}; };
@ -138,10 +144,14 @@ window.SupplierAdmin=function (options,SupplierItem) {
event.preventDefault(); event.preventDefault();
if ($(CSSSelectorForm+' input[name="canSeeInOrder"]').val()==1 && $(CSSSelectorForm)[0].checkValidity() === false) { if ($(CSSSelectorForm+' input[name="canSeeInOrder"]').val()==1 && $(CSSSelectorForm)[0].checkValidity() === false) {
console.log('validaton false'); console.log('validaton false');
$(CSSSelectorForm).addClass('was-validated');
$(CSSSelectorForm)[0].reportValidity();
Toast.create({ title: "Validációs hiba!", message: "Kérjük, töltse ki a kötelező mezőket!", status: TOAST_STATUS.DANGER, timeout: 5000 });
event.stopPropagation(); event.stopPropagation();
return; return;
} else { } else {
console.log('validaton ok'); console.log('validaton ok');
$(CSSSelectorForm).removeClass('was-validated');
//do your ajax submition here //do your ajax submition here
} }
let ajaxData=root.formDataToDataObjectAPICall(CSSSelectorForm); let ajaxData=root.formDataToDataObjectAPICall(CSSSelectorForm);

View File

@ -97,9 +97,11 @@ window.initRadioButtons=function (Options){
$.extend(Opts, Options); $.extend(Opts, Options);
let activeValue = $('.customRadioBtnGroup .active').data('title'); $('.customRadioBtnGroup .active').each(function() {
let target = $('.customRadioBtnGroup .active').data('toggle'); let activeValue = $(this).data('title');
$('input[name='+target+']').prop('value', activeValue); let target = $(this).data('toggle');
$('input[name='+target+']').prop('value', activeValue);
});
$('.customRadioBtnGroup a').unbind('click'); $('.customRadioBtnGroup a').unbind('click');
$('.customRadioBtnGroup a').bind('click',function(){ $('.customRadioBtnGroup a').bind('click',function(){

View File

@ -267,7 +267,7 @@ class="form-control" id="openHours"
<a class="btn btn-primary btn-sm active" data-toggle="canSee" data-title="1">Igen</a> <a class="btn btn-primary btn-sm active" data-toggle="canSee" data-title="1">Igen</a>
<a class="btn btn-primary btn-sm notActive" data-toggle="canSee" data-title="0">Nem</a> <a class="btn btn-primary btn-sm notActive" data-toggle="canSee" data-title="0">Nem</a>
</div> </div>
<input type="hidden" name="canSee" > <input type="hidden" name="canSee" value="1">
</div> </div>
</div> </div>
@ -280,7 +280,7 @@ class="form-control" id="openHours"
<a class="btn btn-primary btn-sm active" data-toggle="canSeeInOrder" data-title="1">Igen</a> <a class="btn btn-primary btn-sm active" data-toggle="canSeeInOrder" data-title="1">Igen</a>
<a class="btn btn-primary btn-sm notActive" data-toggle="canSeeInOrder" data-title="0">Nem</a> <a class="btn btn-primary btn-sm notActive" data-toggle="canSeeInOrder" data-title="0">Nem</a>
</div> </div>
<input type="hidden" name="canSeeInOrder" > <input type="hidden" name="canSeeInOrder" value="1">
</div> </div>
</div> </div>
@ -293,7 +293,7 @@ class="form-control" id="openHours"
<a class="btn btn-primary btn-sm active" data-toggle="hooreycaDataActive" data-title="1">Igen</a> <a class="btn btn-primary btn-sm active" data-toggle="hooreycaDataActive" data-title="1">Igen</a>
<a class="btn btn-primary btn-sm notActive" data-toggle="hooreycaDataActive" data-title="0">Nem</a> <a class="btn btn-primary btn-sm notActive" data-toggle="hooreycaDataActive" data-title="0">Nem</a>
</div> </div>
<input type="hidden" name="hooreycaDataActive" > <input type="hidden" name="hooreycaDataActive" value="1">
</div> </div>
</div> </div>