 

        <!-- Optional JavaScript -->
        <!-- jQuery first, then Popper.js, then Bootstrap JS -->
        <script src="assets/js/jq.js"></script>
        <script src="assets/js/bootstrap.bundle.js"></script>



        <script>
            document.addEventListener("DOMContentLoaded", function(event) {

 
                function cartClick() {
                    let button = this;
                    button.classList.add('clicked');
                }

                var itemtoappend = '';
                var toappend = false;
                var cartitemscount = 0;

                $('[id*="sendme"]').submit(function(e) { 
                    e.preventDefault();
                    var $form = $(this);
                    var id = $form.attr('id');
                    console.log(id);
                    var frm = $('#' + id);
                    var data = {};
                    $.each(this, function(i, v) {
                        var input = $(v);
                        data['name'] = input.val();
                        delete data["undefined"];
                    });
                    
                    
                    
                    
                    
                    var ppppss = getFormData('#' + id);

                    $.post("addprotocart.php", ppppss,
                            function(datas, status) {
                                $kkk = JSON.parse(datas);
                                 
                                if($kkk.msg == 2){
                                    
                                toappend = true;

                                    
                                itemtoappend = $kkk.count;
                                cartitemscount = $kkk.cartcount;
                                    
                                    
                                    
                                const cartButtons = document.querySelectorAll('.cart-button');
                                $('#' + id + " .cart-button").addClass('clicked');

                                $('#' + id + ' .cart-button').prop('disabled', true);
                                setTimeout(function() {
                                    $('#' + id + " .cart-button").removeClass('clicked');
                                    $('#' + id + ' .cart-button').prop('disabled', false);
                                }, 3000);

 

                            }

                            }).done(function() { 
                        
                              
                              if(toappend){
                                   $("#collapsecartlist").html(itemtoappend);
                                   $("#cartitemcountbadge").html(cartitemscount);
                              }
                        
                             
                             
                        
                        })
                        .fail(function() { 
                        })
                        .always(function() { 
                        });
                });

                function getFormData(dom_query) {
                    var out = {};
                    var s_data = $(dom_query).serializeArray(); 
                    for (var i = 0; i < s_data.length; i++) {
                        var record = s_data[i];
                        out[record.name] = record.value;
                    }
                    return out;
                }

                
                                (function($) {
  $.fn.inputFilter = function(inputFilter) {
	  
    return this.on("input keydown keyup mousedown mouseup select contextmenu drop", function() {
		 if(this.value == "."){
			this.value = "0.";
		}
      if (inputFilter(this.value)) {
        this.oldValue = this.value;
        this.oldSelectionStart = this.selectionStart;
        this.oldSelectionEnd = this.selectionEnd;
      } else if (this.hasOwnProperty("oldValue")) {
        this.value = this.oldValue;
        this.setSelectionRange(this.oldSelectionStart, this.oldSelectionEnd);
      } else {
        this.value = "";
      }
    });
  };
}(jQuery));




// Install input filters.
$("#intTextBox").inputFilter(function(value) {
  return /^-?\d*$/.test(value); });
$("#uintTextBox").inputFilter(function(value) {
  return /^\d*$/.test(value); });
$("#intLimitTextBox").inputFilter(function(value) {
  return /^\d*$/.test(value) && (value === "" || parseInt(value) <= 500); });
$("#floatTextBox").inputFilter(function(value) {
  return /^-?\d*[.,]?\d*$/.test(value); });
$(".currencyTextBox").inputFilter(function(value) {
  return /^-?\d*[.,]?\d{0,3}$/.test(value) && (value === "" || parseInt(value) <= 1000);});
$("#latinTextBox").inputFilter(function(value) {
  return /^[a-z]*$/i.test(value); });
$("#hexTextBox").inputFilter(function(value) {
  return /^[0-9a-f]*$/i.test(value); });
                
                
                
                

            });
            
            
            
            
            
        $(function() {
            $(document).on('click', '[id*="showinfo-"]', function(e) {
                    e.preventDefault();
                    var $finfomod = $(this);
                    var idinfo = $finfomod.attr('id').split('showinfo-')[1];
                    console.log(idinfo);
                
                   $.post( "getinfo.php", { infid: idinfo})
                    .done(function( data ) {
                         console.log(data);
					     $("#infomodaldata").html(data);
                         $('#infomodal').modal('show');
                    });
                
                
                 
            });
        });

        </script>



</body>

</html>
