<script>
  $(document).on("click",".fa-check", function () {
    console.log("ok");
    $(this).parent().parent().parent().removeClass("hilite-info-text");
    $(this).parent().parent().parent().removeClass("hilite-warning-text");
    $(this).parent().parent().parent().addClass("hilite-success-text");
    $(this).parent().parent().siblings(".l11").text("Accepté")
  });


  $(document).on("click", ".fa-times", function () {
    $(this).parent().parent().parent().removeClass("hilite-info-text");
    $(this).parent().parent().parent().removeClass("hilite-success-text");
    $(this).parent().parent().parent().addClass("hilite-warning-text");
    $(this).parent().parent().siblings(".l11").text("Refusée")
  });



    var html5QrcodeScanner = null;
       
    $(document).on("click","[name='scan']",function(){
      console.log("clicked");
      document.getElementsByName("scanPlaceHolder")[0].innerHTML = '<div id="qr-reader" style="width: 600px"></div>'
     var html5QrcodeScanner = new Html5QrcodeScanner(
      "qr-reader", { fps: 10, qrbox: 250 });
    html5QrcodeScanner.render(onScanSuccess,onScanError);
    })

    function onScanSuccess(decodedText, decodedResult) {
        // $("[name='rack'] input").val(decodedText);
        // var scope = angular.element(document.querySelector("[name='product'] input")).scope()
        // $("[name='product'] input").val(decodedText);

        console.log(document.querySelector("[name='productHolder']"));
        angular.element(document.querySelector('[name="productHolder"]')).scope().setValue(decodedText,true);
        html5QrcodeScanner.clear();
    }

  function onScanError(errorMessage) {
    console.log(errorMessage);
      // handle on error condition, with error message
  }



</script>