1(function($) { 2 $(document).ready(function() { 3 $(".btn-primary.addToMyBidList").on("click", function(e) { 4 $this = $(this); 5 e.preventDefault(); 6 $.ajax({ 7 url: window.location.origin + "/?type=3344", 8 contentType: "application/json", 9 type: "GET", 10 data: { 11 "propertyId": $(this).data("propertyId"), 12 }, 13 success: function (data) { 14 var $updateFormFE = $this.closest(".update_formFE"); 15 16 // Hide ALL fieldsets (both offline bidding options and add to bid list button) 17 $updateFormFE.find("fieldset").hide(); 18 19 // Find the approval div anywhere in the update_formFE container 20 var approvalDiv = $updateFormFE.find(".approval"); 21 22 if(approvalDiv.length === 0) { 23 // If approval div doesn't exist, create it 24 var propertyId = $this.data("propertyId"); 25 var eventId = $this.hasClass('event-colors-D') ? 'D' : 26 $this.hasClass('event-colors-W') ? 'W' : 27 $this.hasClass('event-colors-S') ? 'S' : 28 $this.hasClass('event-colors-N') ? 'N' : 29 $this.hasClass('event-colors-P') ? 'P' : 'D'; 30 var approvalHtml = '<div class="approval">' + 31 'Bitte haben Sie etwas Geduld, wir prüfen Ihre Unterlagen und werden sie freischalten<br>' + 32 '<a href="/meine-gebote.html">Meine Gebotsliste</a><br>' + 33 '<a href="#" class="removeBidRequest removeBidRequestDetailView event-colors-' + eventId + '" data-property-id="' + propertyId + '">' + 34 '<i class="fa fa-times"></i> Anfrage zurückziehen' + 35 '</a>' + 36 '</div>'; 37 $updateFormFE.find(".form-row").first().append(approvalHtml); 38 39 // Reinitialize the remove button handler for the newly created button 40 initRemoveBidRequestHandler(); 41 } else { 42 // Approval div exists (could be server-rendered), just make sure it's visible 43 approvalDiv.show().css('display', 'block'); 44 } 45 }, 46 }); 47 }); 48 49 $(".btn-primary.downloadApprovalPdf").on("click", function (e) { 50 e.preventDefault(); 51 let form = $(this).closest("form"); 52 53 // Find checked checkboxes using the name attribute (most reliable) 54 var checkedBoxes = form.find('input[name="bidlist[]"]:checked'); 55 56 // Fallback to other selectors if needed 57 if (checkedBoxes.length === 0) { 58 checkedBoxes = form.find('input[type="checkbox"]:checked'); 59 } 60 if (checkedBoxes.length === 0) { 61 checkedBoxes = form.find('.approvalRequestCheckbox:checked'); 62 } 63 64 // Also try global scope (all forms) 65 if (checkedBoxes.length === 0) { 66 checkedBoxes = $('input[name="bidlist[]"]:checked'); 67 } 68 69 // Validate selection 70 if (checkedBoxes.length === 0) { 71 alert("Bitte wählen Sie mindestens ein Objekt aus."); 72 return; 73 } 74 75 if (checkedBoxes.length > 3) { 76 alert("Sie können maximal 3 Objekte auswählen."); 77 return; 78 } 79 80 // Collect selected object IDs 81 var selectedObjects = []; 82 checkedBoxes.each(function() { 83 selectedObjects.push($(this).val()); 84 }); 85 86 // Create query parameters for online bid form 87 var queryParams = $.param({ 88 objectIds: selectedObjects.join(','), 89 offlineBidType: 'online' 90 }); 91 92 // Redirect to download the online bid form 93 window.location.href = `${window.location.origin}/?type=3344&${queryParams}`; 94 }); 95 96 $(".btn-primary.bidBySelf, .btn-primary.bidByPhone, .btn-primary.bidByEmail, .btn-primary.bidByFixedBid").on("click", function (e) { 97 $this = $(this); 98 e.preventDefault(); 99 const objectId = $(this).data("objectId"); 100 const offlineBidType = $(this).data("offlineBidType"); 101 const queryParams = $.param({ 102 objectId: objectId, 103 offlineBidType: offlineBidType, 104 }); 105 window.location.href = `${window.location.origin}/?type=3344&${queryParams}`; 106 }); 107 108 // Handle remove bid request button (for waiting approval state) 109 function initRemoveBidRequestHandler() { 110 $(".removeBidRequest").off("click").on("click", function(e) { 111 e.preventDefault(); 112 const $button = $(this); 113 const propertyId = $button.data("propertyId"); 114 115 $.ajax({ 116 url: window.location.origin + "/?type=3345", 117 contentType: "application/json", 118 type: "GET", 119 data: { 120 "propertyId": propertyId, 121 }, 122 success: function (response) { 123 // Reload the page to get fresh state from server 124 location.reload(); 125 }, 126 error: function() { 127 // Even on error, reload to ensure correct state 128 location.reload(); 129 } 130 }); 131 }); 132 } 133 134 // Initialize on page load 135 initRemoveBidRequestHandler(); 136 137 // On page load, ensure correct state is displayed 138 // Force fieldsets to be visible if approval div is hidden (fixes back button cache issue) 139 $(".update_formFE").each(function() { 140 var $container = $(this); 141 var $approvalDiv = $container.find(".approval"); 142 var $fieldsets = $container.find("fieldset"); 143 144 // If approval div has display:none inline style, it means user no longer has pending request 145 // Show fieldsets in this case 146 if ($approvalDiv.length > 0 && $approvalDiv.attr('style') && $approvalDiv.attr('style').indexOf('display: none') !== -1) { 147 // Approval div is explicitly hidden, ensure fieldsets are shown 148 $approvalDiv.hide(); 149 $fieldsets.show(); 150 } else if ($approvalDiv.length > 0 && $approvalDiv.find(".removeBidRequest").length > 0 && $approvalDiv.is(':visible')) { 151 // Approval div is visible with remove button, hide fieldsets 152 $approvalDiv.show(); 153 $fieldsets.hide(); 154 } else if ($fieldsets.length > 0) { 155 // Default: ensure fieldsets are visible 156 $fieldsets.show(); 157 } 158 }); 159 160 161 }); 162})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.