import debounce from "../utils/debounce"; /** * ButtonController class that handles the enabling and disabling of the "Place Order" button. * It uses debouncing to prevent excessive triggering of the button's enable/disable state. */ class ButtonController { /** * Constructor for the ButtonController class. * It initializes debounced versions of the disable and enable button functions. */ constructor() { // Gebruik een debounced versie van de disable en enable functies this.disableButton = debounce(this.disableButton.bind(this), 500); // Debounced disable button function this.enableButton = debounce(this.enableButton.bind(this), 500); // Debounced enable button function } /** * Disables the "Place Order" button and applies styles to indicate that it's disabled. */ disableButton() { jQuery("#place_order").prop("disabled", true); // Disable the button jQuery("#place_order").css("background-color", "#ccc"); // Change background to grey when disabled jQuery("#place_order").css("color", "#666"); // Change text color to a lighter grey when disabled } /** * Enables the "Place Order" button and restores its styles to the enabled state. */ enableButton() { jQuery("#place_order").prop("disabled", false); // Enable the button jQuery("#place_order").css("background-color", "#000"); // Set background color to black when enabled jQuery("#place_order").css("color", "#fff"); // Set text color to white when enabled } } export default ButtonController;