<!DOCTYPE html>

<html lang="<?php echo e(app()->getLocale()); ?>">
<head>
    <meta name="csrf-token" content="<?php echo e(csrf_token()); ?>">

    <script src="<?php echo e(asset('assets/js/jquery3.4.1.min.js')); ?>"></script>

    <style>
        .select2-container {
            z-index: 99999999;
        }

        label {
            margin-top: 10px;
            text-align: left;
        }

        .fa-check {
            color: #00a65a;
        }

        .jconfirm.jconfirm-modern .jconfirm-box div.jconfirm-content {
            text-align: unset;
        }
    </style>
    <?php
        $branch = getBranch();
    ?>
    <?php echo $__env->yieldContent('style'); ?>
</head>

<body>

<?php Fun::lang()?>
<?php echo $__env->yieldContent('content'); ?>

<script src="<?php echo e(asset('assets/js/jquery-confirm.js')); ?>"></script>
<script src="<?php echo e(asset('assets/js/jquery.form.js')); ?>"></script>
<script  src="<?php echo e(asset('assets/plugin/date-picker/bootstrap-datepicker.js')); ?>"></script>
<script src="<?php echo e(asset('assets/js/select2/select2.min.js')); ?>"></script>
<script src="<?php echo e(asset('assets/js/printThis.js')); ?>"></script>
<script src="<?php echo e(asset('assets/js/jquery.toast.min.js')); ?>"></script>
<script src="<?php echo e(asset('assets/js/jquery-ui.js')); ?>"></script>

<script>
    $(document).ready(function () {
        $('.jconfirm-content-pane').find('input').attr('autocomplete', 'off');
        $(".date_picker").datepicker({
            format: 'dd-mm-yyyy',
            todayHighlight: true,
            autoclose: true,
        });
        let buttons = $(document).find('input[type=submit],button,button:not(.click_close_form)');

        $('.jform').ajaxForm({
            beforeSend: function () {
                buttons.prop('disabled', true);
            },
            uploadProgress: function (event, position, total, percentComplete) {
                $(document).find('.percentage_number').text(percentComplete+'%');
                $(document).find('progress').val(percentComplete);
            },
            success: function (data) {
                console.log('jform')
                $('.show_percentage').fadeOut();
                $('.loading_btn').hide();
                if (data.input_name) {
                    $(document).find(`select[name="${data.input_name}"]`).append(`<option value="${data.value}">${data.text}</option>`).val(data.value).change();
                    $(document).find('.click_close_form').trigger('click');
                    return
                }
                console.log(data.status)
                if (data.status === "success" || data === 'ok' || data.status === 'ok') {
                    $.toast({
                        heading: 'Success',
                        text: 'Record Inserted successful ....',
                        position: 'top-right',
                        icon: 'success',
                        hideAfter: 9000,
                    });
                    if (data.route) {
                        window.location.replace(data.route);
                    }
                    else {
                        try {
                            if (data.reload) {
                                window.location.reload();
                            } else {
                                console.log('reload')
                                if(data.customer_data){
                                    let html = `<option value="${data.customer_data.id}">${data.customer_data.name}</option>`;
                                    $(document).find('.search_customer').html(html);
                                    search_customer();
                                    console.log(1)
                                }else{
                                    // getTable();
                                    console.log('2')
                                    window.location.href = '<?php echo e(route('production-packing.index')); ?>'
                                }
                            }
                        }
                        catch (e) {
                            //do something


                        }




                    }
                } else {
                    $.toast({
                        heading: 'Warning',
                        text: 'Something Wrong ....',
                        position: 'top-right',
                        icon: 'danger',
                        hideAfter: 5000,
                    });
                }
                setTimeout(function () {
                    buttons.prop('disabled', false);
                },3000);
            },
            error: function (xhr, textStatus, errorThrown) {
                alertErrorFormController(xhr,);
                setTimeout(function () {
                    $('button').prop('disabled', false)
                }, 3000)
            },
        });
    });
</script>
<?php echo $__env->yieldContent('jq'); ?>

</body>


</html>





<?php /**PATH /home/nsowos/public_html/shr-brand/resources/views/layouts/jform.blade.php ENDPATH**/ ?>