<form id="ajax">
<input type="text" name="order_id"  id="inv" readonly hidden>
    <?php echo csrf_field(); ?>
    <div class="row gutters">
        <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
            
            <!-- Field wrapper start -->
            <div class="field-wrapper">
                <div class="input-group">
                    <select lass="form-control" name="name" Required class="select-single js-states" title="Select Product Category">
                        <option disabled selected>select option</option>
                        <?php $__currentLoopData = $house_person; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $person): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo $person->name .  "-" . $person ->id; ?>"><?php echo e(@strtoupper($person->name)); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>
                <div class="field-placeholder">Beneficiary<span class="text-danger">*</span></div>
            </div>
            <!-- Field wrapper end -->

        </div>


        <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
            
            <!-- Field wrapper start -->
            <div class="field-wrapper">
                <div class="input-group">
                    <textarea name="comment" required></textarea>
                </div>
                <div class="field-placeholder">Comment</div>
            </div>
            <!-- Field wrapper end -->

        </div>

        <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
            <button class="btn btn-primary">Submit</button>
        </div>
    </div>
</form>



    <script>
         $("#ajax").on('submit', function(event) {
            event.preventDefault();
            $.ajax({
                type: "post",
                url: "<?php echo e(route('onHouse')); ?>",
                dataType: "json",
                data: $('#ajax').serialize(),
                success: function(data){
                    $("#ajax")[0].reset();
                    const Toast = Swal.mixin({
                    toast: true,
                    position: 'top-end',
                    showConfirmButton: false,
                    timer: 3000,
                    timerProgressBar: true,
                    didOpen: (toast) => {
                        toast.addEventListener('mouseenter', Swal.stopTimer)
                        toast.addEventListener('mouseleave', Swal.resumeTimer)
                    }
                    })

                    Toast.fire({
                    icon: 'success',
                    title: 'On the Hosue forms Created Successfully, Continue With the Invoice'
                    })
                    
                    
                },
                error: function(data){
                    Swal.fire({
                    icon: 'error',
                    title: 'Oops...',
                    text: 'Something went wrong!',
                    footer: '<a href="">Why do I have this issue?</a>'
                    })
                }
            });
        });


    </script><?php /**PATH /home2/morttacy/morttsonsposfiles/resources/views/inc/onhouse.blade.php ENDPATH**/ ?>