Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	Update templates/cart.html
Browse files- templates/cart.html +14 -5
    	
        templates/cart.html
    CHANGED
    
    | @@ -297,13 +297,22 @@ | |
| 297 | 
             
                    function proceedToOrder() {
         | 
| 298 | 
             
                        let couponCheckbox = document.getElementById('couponCheckbox');
         | 
| 299 | 
             
                        let couponDropdown = document.getElementById('couponDropdown');
         | 
| 300 | 
            -
                        let selectedCoupon =  | 
| 301 |  | 
| 302 | 
            -
                        if (couponCheckbox | 
| 303 | 
            -
                             | 
| 304 | 
            -
             | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 305 | 
             
                        }
         | 
| 306 | 
            -
             | 
| 307 | 
             
                        fetch('/checkout', {
         | 
| 308 | 
             
                            method: 'POST',
         | 
| 309 | 
             
                            headers: { 'Content-Type': 'application/json' },
         | 
|  | |
| 297 | 
             
                    function proceedToOrder() {
         | 
| 298 | 
             
                        let couponCheckbox = document.getElementById('couponCheckbox');
         | 
| 299 | 
             
                        let couponDropdown = document.getElementById('couponDropdown');
         | 
| 300 | 
            +
                        let selectedCoupon = ""; // Default to empty coupon
         | 
| 301 |  | 
| 302 | 
            +
                        if (couponCheckbox && couponCheckbox.checked) {
         | 
| 303 | 
            +
                            if (couponDropdown) {
         | 
| 304 | 
            +
                                selectedCoupon = couponDropdown.value.trim();
         | 
| 305 | 
            +
                            
         | 
| 306 | 
            +
                                // Prevent checkout if no coupon is selected
         | 
| 307 | 
            +
                                if (!selectedCoupon) {
         | 
| 308 | 
            +
                                    alert("Please select a valid coupon before proceeding.");
         | 
| 309 | 
            +
                                    return;
         | 
| 310 | 
            +
                                }
         | 
| 311 | 
            +
                            } else {
         | 
| 312 | 
            +
                                alert("Error: Coupon dropdown not found.");
         | 
| 313 | 
            +
                                return;
         | 
| 314 | 
            +
                            }
         | 
| 315 | 
             
                        }
         | 
|  | |
| 316 | 
             
                        fetch('/checkout', {
         | 
| 317 | 
             
                            method: 'POST',
         | 
| 318 | 
             
                            headers: { 'Content-Type': 'application/json' },
         | 
