  

<?php $__env->startSection('pageTitle', 'FRCS Verification'); ?>
<?php $__env->startSection('content'); ?>
  <div class="container">

    <!-- Outer Row -->
    <div class="row justify-content-center">

      <div class="col-xl-10 col-lg-12 col-md-9">

        <div class="card o-hidden border-0 shadow-lg my-5">
          <div class="card-body p-0">
            <!-- Nested Row within Card Body -->
            <div class="row">
              <div class="offset-lg-2 col-lg-8">
                <div class="p-5">
                  <div class="text-center">
                    <h1 class="h4 text-danger mb-4">FRCS Authentication</h1>
                  </div>
		            <form class="form-horizontal"  method="post" action="<?php echo e(url('/pac.change.status')); ?>" id="form-pac_code">
		            <div class="alert" id="pac_alert" style="display: none;">
		                <span id="pac_alert_message"></span>
		            </div>
		            <input type="hidden" name="status" value="<?php echo e($status); ?>">
		            <input type="hidden" name="id" value="<?php echo e($uuid); ?>">
		            <?php echo e(csrf_field()); ?>

		                <p>Please enter PAC code in order to process the invoice</p>
		            
		                <div class="form-group" id="div-pac_code">

		                    <div class="col-md-10">
		                        <input id="pac_code" type="password" class="form-control" name="pac_code" autocomplete="off">
		                                <strong id="error_pac_code"></strong>
		                        
		                    </div>
		                </div>

		                <div class="form-group">
		                    <div class="col-md-6 col-md-offset-4">
		                        <button type="submit" class="btn btn-primary"><i class="fa fa-cog"></i> 
		                            Process
		                        </button>
		                    </div>
		                </div>

		            </form>
                </div>
              </div>
            </div>
          </div>
        </div>

      </div>

    </div>

  </div>
<script src=""></script>
	<button  style="display: none;" class="btn button btn-block login process_invoice" type="submit" 
	    id="taxcore_sign_element"
	    data-taxcore-vsdc-url="<?php echo e(config('app.firca_url')); ?>"
	    data-taxcore-input-id="invoiceRequest"
	    data-taxcore-output-id="results"
	    data-taxcore-invoice-request=""
	    data-taxcore-debug="true"
	    data-taxcore-signed-invoice-response="">
	</button>
<script type="text/javascript">
	    $('#form-pac_code').submit(function(e){
	      	e.preventDefault();
	      	$.ajax({
	      		type:'POST',
	      		data:$(this).serialize(),
	      		url:"<?php echo e(url('pac.auth')); ?>",
	      		beforeSend:function(){
	      				$('#pac_code').removeClass('is-invalid');
	      				$('#error_pac_code').removeClass('invalid-feedback');
	      				$('#error_pac_code').html('');
	      		},
	      		success:function(data)
	      		{	
	      			if(data.url)
	      			{
	      				window.location.href = data.url;      				

	      			}

	      			if(data.errors)
	      			{
	      				$('#pac_code').addClass('is-invalid');
	      				$('#error_pac_code').addClass('invalid-feedback');
	      				$('#error_pac_code').html(data.errors);
	      			}
	      		},
	      		error:function(data)
	      		{
	      			var obj, errors;
	      			obj = jQuery.parseJSON(data.responseText);
	      			errors = obj.errors;

	      			if(errors.pac_code)
	      			{
	      				$('#pac_code').addClass('is-invalid');
	      				$('#error_pac_code').addClass('invalid-feedback');
	      				$('#error_pac_code').html(errors.pac_code);
	      			}
	      		}
	      	});
	      });




window.addEventListener('load', function() {
	let script = document.createElement('script');
	script.src = "<?php echo e(config('app.firca_js')); ?>"; // no such script
	document.head.append(script);

	script.onload  = function(data) {
		console.log(data);
	  alert("script loaded"); // Error loading https://example.com/404.js
	};

	script.onerror = function(data) {
		console.log(data);
	  alert("Error loading " + this.src); // Error loading https://example.com/404.js
	};
});

</script>


<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\clouddev\local\resources\views/invoices/pac_auth.blade.php ENDPATH**/ ?>