{extends file="list.tpl"}

{block addFilter}
   <script>
      $(document).ready(function() {
         $('input[name=over_supply]').click(function () {
             const id_position = $(this).data('id-position');
             const id_product = $(this).data('id-product');
             const id_variation = $(this).data('id-variation');

             var value;
             if ($(this).is(':checked')) {
                 value = 'Y';
             } else {
                 value = 'N';
             }

             console.log(id_position, id_product, id_variation, value);

             $.ajax({
                 method: "GET",
                 url: "./launch.php?s=ajax.php&type=positionsOverSupply",
                 data: { id_position: id_position, id_product: id_product, id_variation: id_variation, value: value }
             }).done(function( data ) {
                showInfoMessage('Uloženo', 'success');
             });
         });
      });
   </script>
{/block}

