Avoided click event bubbling for nested buttons

Signed-off-by: cris-technikum <hainberg@technikum-wien.at>
This commit is contained in:
Cris
2021-02-22 16:12:15 +01:00
committed by cris-technikum
parent cf5ee6afa3
commit 4ebd5a85bb
4 changed files with 54 additions and 30 deletions
@@ -41,10 +41,13 @@ $(function(){
});
// Approve Anrechnungen
$("#approveAnrechnungDetail-approve-anrechnung-confirm").click(function(){
$("#approveAnrechnungDetail-approve-anrechnung-confirm").click(function(e){
// Avoid form redirecting automatically
event.preventDefault();
e.preventDefault();
// Avoid bubbling click event to sibling break button
e.stopImmediatePropagation();
// Get form data
let form_data = $('form').serializeArray();
@@ -102,7 +105,13 @@ $(function(){
});
// Reject Anrechnungen
$("#approveAnrechnungDetail-reject-anrechnung-confirm").click(function(){
$("#approveAnrechnungDetail-reject-anrechnung-confirm").click(function(e){
// Avoid form redirecting automatically
e.preventDefault();
// Avoid bubbling click event to sibling break button
e.stopImmediatePropagation();
let begruendung = $('#approveAnrechnungDetail-begruendung').val();
@@ -113,9 +122,6 @@ $(function(){
return;
}
// Avoid form redirecting automatically
event.preventDefault();
// Get form data
let form_data = $('form').serializeArray();
@@ -161,10 +167,10 @@ $(function(){
});
// Request Recommendation for Anrechnungen
$("#approveAnrechnungDetail-request-recommendation").click(function(){
$("#approveAnrechnungDetail-request-recommendation").click(function(e){
// Avoid form redirecting automatically
event.preventDefault();
e.preventDefault();
// Get form data
let form_data = $('form').serializeArray();
@@ -206,10 +212,10 @@ $(function(){
});
// Request Recommendation for Anrechnungen
$("#approveAnrechnungDetail-withdraw-anrechnung-approvement").click(function(){
$("#approveAnrechnungDetail-withdraw-anrechnung-approvement").click(function(e){
// Avoid form redirecting automatically
event.preventDefault();
e.preventDefault();
if(!confirm(FHC_PhrasesLib.t("anrechnung", "genehmigungAblehnungWirklichZuruecknehmen")))
{
@@ -221,10 +221,13 @@ $(function(){
});
// Approve Anrechnungen
$("#approveAnrechnungUebersicht-approve-anrechnungen-confirm").click(function(){
$("#approveAnrechnungUebersicht-approve-anrechnungen-confirm").click(function(e){
// Avoid form redirecting automatically
event.preventDefault();
e.preventDefault();
// Avoid bubbling click event to sibling break button
e.stopImmediatePropagation();
// Get selected rows data
let selected_data = $('#tableWidgetTabulator').tabulator('getSelectedData')
@@ -293,7 +296,13 @@ $(function(){
});
// Reject Anrechnungen
$("#approveAnrechnungUebersicht-reject-anrechnungen-confirm").click(function(){
$("#approveAnrechnungUebersicht-reject-anrechnungen-confirm").click(function(e){
// Avoid form redirecting automatically
e.preventDefault();
// Avoid bubbling click event to sibling break button
e.stopImmediatePropagation();
let begruendung = $('#approveAnrechnungUebersicht-begruendung').val();
@@ -323,9 +332,6 @@ $(function(){
return;
}
// Avoid form redirecting automatically
event.preventDefault();
// Prepare data object for ajax call
let data = {
'data': selected_data
@@ -364,10 +370,10 @@ $(function(){
});
// Request Recommendation for Anrechnungen
$("#approveAnrechnungUebersicht-request-recommendation").click(function(){
$("#approveAnrechnungUebersicht-request-recommendation").click(function(e){
// Avoid form redirecting automatically
event.preventDefault();
e.preventDefault();
// Get selected rows data
let selected_data = $('#tableWidgetTabulator').tabulator('getSelectedData');
@@ -47,10 +47,13 @@ $(function(){
});
// Recommend Anrechnung
$("#reviewAnrechnungDetail-recommend-anrechnung-confirm").click(function(){
$("#reviewAnrechnungDetail-recommend-anrechnung-confirm").click(function(e){
// Avoid form redirecting automatically
event.preventDefault();
e.preventDefault();
// Avoid bubbling click event to sibling break button
e.stopImmediatePropagation();
// Get form data
let form_data = $('form').serializeArray();
@@ -108,7 +111,13 @@ $(function(){
});
// Dont recommend Anrechnung
$("#reviewAnrechnungDetail-dont-recommend-anrechnung-confirm").click(function(){
$("#reviewAnrechnungDetail-dont-recommend-anrechnung-confirm").click(function(e){
// Avoid form redirecting automatically
e.preventDefault();
// Avoid bubbling click event to sibling break button
e.stopImmediatePropagation();
let begruendung = $('#reviewAnrechnungDetail-begruendung').val();
@@ -119,9 +128,6 @@ $(function(){
return;
}
// Avoid form redirecting automatically
event.preventDefault();
// Get form data
let form_data = $('form').serializeArray();
@@ -219,10 +219,13 @@ $(function(){
});
// Recommend Anrechnungen
$("#reviewAnrechnungUebersicht-recommend-anrechnungen-confirm").click(function(){
$("#reviewAnrechnungUebersicht-recommend-anrechnungen-confirm").click(function(e){
// Avoid form redirecting automatically
event.preventDefault();
e.preventDefault();
// Avoid bubbling click event to sibling break button
e.stopImmediatePropagation();
// Get selected rows data
let selected_data = $('#tableWidgetTabulator').tabulator('getSelectedData')
@@ -292,7 +295,13 @@ $(function(){
});
// Dont recommend Anrechnungen
$("#reviewAnrechnungUebersicht-dont-recommend-anrechnungen-confirm").click(function(){
$("#reviewAnrechnungUebersicht-dont-recommend-anrechnungen-confirm").click(function(e){
// Avoid form redirecting automatically
e.preventDefault();
// Avoid bubbling click event to sibling break button
e.stopImmediatePropagation();
let begruendung = $('#reviewAnrechnungUebersicht-begruendung').val();
@@ -322,9 +331,6 @@ $(function(){
return;
}
// Avoid form redirecting automatically
event.preventDefault();
// Prepare data object for ajax call
let data = {
'data': selected_data