
<?php $__env->startSection('title', 'Blogs'); ?>
<?php $__env->startSection('content'); ?>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Create Broadcast </title>
    <!-- Bootstrap 4 CSS -->
    <link rel='stylesheet' href='https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css'>

    <!-- <link id="bs-css" href="https://netdna.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet"> -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css">
    <link id="bsdp-css" href="https://unpkg.com/bootstrap-datepicker@1.9.0/dist/css/bootstrap-datepicker3.min.css" rel="stylesheet">
    <!-- Select 2 -->
    <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet" />
    <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/js/select2.min.js"></script>

    <link href="<?php echo e(asset('assets/css/CreateBroadCast.css')); ?>" rel="stylesheet">

    <style>
        .preview-box {
            border-radius: 10px;
            min-height: 65vh;
            padding: 20px;
            margin-left: 30px;
            margin-right: 30px;
            background-color: rgb(248, 243, 236);
            text-align: start;
            display: flex;
            flex-direction: column;
            /* gap: 2px; */

        }

        .inside-box {
            margin: 10px;
            /* min-height: 100%; */
            gap: 10px;
            line-height: 25px;
            padding: 20px;
            border-top-right-radius: 8px;
            border-bottom-left-radius: 8px;
            border-bottom-right-radius: 8px;
            font-size: 13px;
            background-color: white;
            text-align: start;
        }

        .inside-box-document {
            margin: 10px;
            /* min-height: 100%; */
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
            line-height: 25px;
            padding: 20px;
            border-top-right-radius: 8px;
            border-bottom-left-radius: 8px;
            border-bottom-right-radius: 8px;
            font-size: 13px;
            background-color: white;
            text-align: start;
        }

        #footer_text {
            color: gray;
            font-size: 11px;
        }

        .URLHtml {
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        #QUICK_REPLY {
            display: flex;
            flex-direction: row;
            margin-left: 10px;
            margin-right: 10px;
            gap: 5px;
        }

        .QUICK_REPLY_CARD {
            width: 100%;
            padding: 20px;
            border-radius: 8px;
            font-size: 13px;
            background-color: white;
            text-align: center;
        }

        .next-button {
            position: absolute;
            left: 15px;
            bottom: 10px;
        }

        #error {
            position: absolute;
            left: 20px;
            bottom: 60px;
            color: red;
        }

        #second_error {
            color: red;
        }


        .custom-file {
            margin-top: 70px;
        }

        .select2.select2-container .select2-selection .select2-selection__arrow {
            background: #f8f8f8;
            border-left: 1px solid #ccc;
            -webkit-border-radius: 0 3px 3px 0;
            -moz-border-radius: 0 3px 3px 0;
            border-radius: 0 3px 3px 0;
            height: 45px;
            width: 45px;
        }


        .select2-selection__rendered {
            margin: 8px;
        }

        .select2-selection {
            height: 47px !important;
            border-color: #ced4da !important;
        }

        @media  only screen and (min-width: 800px) {
            #url_input {
                position: absolute;
                left: 20px;
                top: 130px
            }

            #document_name {
                position: absolute;
                line-height: 20px;
            }
        }

        #file-upload {
            display: none;
        }

        .custom-file-upload {
            border: 1px solid #ccc;
            display: inline-block;
            padding: 6px 12px;
            cursor: pointer;
        }
    </style>

</head>

<body>


    <main>
        <article>

            <!-- Start Multiform HTML -->
            <section class="multi_step_form">
                <form id="msform" enctype="multipart/form-data" method="POST" action="<?php echo e(URL::to('/user/broadcast/submitForm')); ?>">
                    <?php echo csrf_field(); ?>
                    <!-- progressbar -->
                    <div style=" position: relative;left: 15%;">
                        <ul id="progressbar">
                            <li class="active">Step 1</li>
                            <li>Step 2</li>
                        </ul>
                    </div>
                    <!-- fieldsets -->
                    <fieldset style="padding: 10px;">
                        <div class="form-row">
                            <div class="col-md-6 input">
                                <div class="form-group">
                                    <input type="text" name="broadcast_name" id="broadcast_name" class="form-control" placeholder="Broadcast name">
                                    <input type="text" value="1" name="check_broadcast_name" id="check_broadcast_name" class="form-control" placeholder="Broadcast name" hidden>
                                </div>
                                <div class="form-group">
                                    <select id="live_search" name="live_search" class="live_search form-control">
                                    </select>
                                </div>
                                <div class="form-grou" id="url_input">
                                    <div id="url_input_file" style="display: none;">
                                        <label for="file-upload" class="custom-file-upload">
                                            <i class="fa fa-cloud-upload"></i> Upload Document
                                        </label>
                                        <input id="file-upload" name="media_document" type="file" />
                                    </div>
                                    <div id="url_input_image" style="display: none;">
                                        <label for="file-upload" class="custom-file-upload">
                                            <i class="fa fa-cloud-upload"></i> Upload Image
                                        </label>
                                        <input id="file-upload" name="media_image" type="image/*" />
                                    </div>
                                    <div id="url_input_video" style="display: none;">
                                        <label for="file-upload" class="custom-file-upload">
                                            <i class="fa fa-cloud-upload"></i> Upload Image
                                        </label>
                                        <input id="file-upload" name="media_image" type="video/*" />
                                    </div>
                                    <div id="document_name"></div>
                                </div>


                            </div>
                            <div class="col-md-6">
                                <div class="preview-box">
                                    <span style="margin: 10px;font-size: 16px;">Preview</span>
                                    <div class="" id="message"> </div>
                                    <div id="QUICK_REPLY"></div>
                                </div>
                            </div>
                        </div>
                        <div id="error"></div>
                        <button type="button" class="next action-button next-button" data-myvar="foo">Next</button>
                        <input type="text" name="header_format" id="header_format" hidden>
                        <div id="page_number" data-myvar="1"></div>
                    </fieldset>
                    <fieldset style="margin-left: 20px;">
                        <div class="input-group">

                            <div class="custom-file col-md-12">
                                <input type="file" name="csv_file" class="custom-file-input" id="upload" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel">
                                <label class="custom-file-labe btn btn-outline-success" for="upload" style="
                                        background-position: top;
                                        background-size: 10px 1px;
                                        background-repeat: repeat-x;
                                        border-color: green;
                                        border-width: 1.5px;
                                        border-style: dashed;
                                ">
                                    <span class="fa fa-save fa-fw"></span>
                                    Import Contacts</label>
                                <a href="<?php echo e(asset('assets/broadcast_asset/sample.xlsx')); ?>" download id="" style="margin-left: 20px; margin-top: -10px; text-decoration: underline;"> Download sample format for contact upload</a>
                                <input id="csv_validate" name="csv" value="0" />
                            </div>
                            <div id="file_name" style="margin-left: 20px;margin-bottom: 20px"></div>

                            <div class="form-group col-md-12" style="position: relative;right:33%;top:50%">
                                <div id="group1" style="display: flex;flex-direction: column;justify-content: flex-start;">
                                    <div style="margin-left: -106px;margin-bottom: 20px">
                                        <input type="radio" value="1" name="send" onclick="handleRadio(this);" checked>
                                        <label style="margin-left: 10px;">Send it now</label>
                                    </div>
                                    <div>
                                        <input type="radio" value="2" name="send" onclick="handleRadio(this);">
                                        <label style="margin-left: 10px;">Schedule for a specific time</label>
                                    </div>
                                </div>

                            </div>

                            <div id="dates" style="display: none;" class="row col-md-12">
                                <div class="form-grou col-md-4">
                                    <input type="date" name="date" id="date" class="form-control">
                                </div>
                                <div class="form-grou col-md-4 input-append bootstrap-timepicker">
                                    <input type="text" name="time" id="time" readonly class="form-control">
                                </div>

                            </div>
                            <div id="second_error"></div>
                            <div id="params-message" style="position: absolute;left: 10px;"></div>
                        </div>
                        <input type="text" id="params-count" hidden>
                        <button type="button" style="position: absolute;left: 10px;" class="action-button previous previous_button">Back</button>
                        <button type="button" style="position: absolute;left: 150px;" id="add" class="nex action-button" onclick="functionToExecute()">Add Broadcast</button>
                    </fieldset>

                </form>
            </section>
            <!-- END Multiform HTML -->
        </article>
    </main>




</body>

</html>




<!-- jQuery -->
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
<!-- Bootstrap JS -->
<script src='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta/js/bootstrap.min.js'></script>
<!-- jQuery Easing JS -->
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js'></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-timepicker/0.5.2/js/bootstrap-timepicker.min.js" integrity="sha512-2xXe2z/uA+2SyT/sTSt9Uq4jDKsT0lV4evd3eoE/oxKih8DSAsOF6LUb+ncafMJPAimWAXdu9W+yMXGrCVOzQA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>


<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-timepicker/0.5.2/js/bootstrap-timepicker.js" integrity="sha512-tlmsbYa/wD9/w++n4nY5im2NEhotYXO3k7WP9/ds91gJk3IqkIXy9S0rdMTsU4n7BvxCR3G4LW2fQYdZedudmg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-timepicker@0.5.2/css/bootstrap-timepicker.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-timepicker@0.5.2/css/bootstrap-timepicker.min.css">

<style>
    @media  screen and (min-width: 768px) {
        #myModal .modal-dialog {
            width: 70%;
            border-radius: 5px;
        }
    }
</style>

<script type="text/javascript">
    $(document).ready(function() {
        $('#time').timepicker({
            // defaultTime: 'current',
            minuteStep: 15,
            showInputs: false,
            icons: {
                up: 'fa fa-angle-up',
                down: 'fa fa-angle-down'
            },

            // disableFocus: true,
            // template: 'dropdown'
        });

        $('.live_search').select2({
            containerCss: "form-control",
            placeholder: 'Select a Template',
            ajax: {
                url: "<?php echo e(URL::to('/user/broadcast/show')); ?>",
                dataType: 'json',
                delay: 250,
                processResults: function(data) {
                    return {
                        results: $.map(data, function(item) {
                            return {
                                text: item.template_name,
                                id: item.id
                            }
                        })
                    };
                },
                cache: true
            }
        });
    });
    $(function() {
        $('#datetimepicker1').datepicker({
            format: "mm/dd/yy",
            weekStart: 0,
            calendarWeeks: true,
            autoclose: true,
            todayHighlight: true,
            orientation: "auto"
        });
    });
    $('#datetimepicker1').change(res => {
        const date = document.getElementById('date').value;
        console.log(date);
    })
</script>


<script>
    function first_validtion() {
        let validtion = true;
        const broadcast_name = document.getElementById('broadcast_name').value;
        const live_search = document.getElementById('live_search').value;
        const header_format = document.getElementById('header_format').value;
        console.log(header_format);
        if (!broadcast_name) {
            validtion = false
        }
        if (!live_search) {
            validtion = false
        }
        if (header_format === "DOCUMENT") {
            console.log(validtion);
            const url = document.getElementById('file-upload').value;
            console.log(url);
            if (!url)
                validtion = false
        }
        if (header_format === "IMAGE") {
            console.log(validtion);
            const url = document.getElementById('file-upload').value;
            console.log(url);
            if (!url)
                validtion = false
        }

        return validtion;
    }

    function functionToExecute() {
        const csv_validate = document.getElementById('csv_validate').value;
        console.log(csv_validate);
        if (csv_validate == 0) {
            return document.getElementById('second_error').innerHTML = "Please import file"
        } else {
            document.getElementById('second_error').innerHTML = ""
        }
        if (csv_validate == 1) {
            return document.getElementById('second_error').innerHTML = "File header is not same"
        } else {
            document.getElementById('second_error').innerHTML = ""
        }
        if (csv_validate == 2) {
            return document.getElementById('second_error').innerHTML = "FIle maximum row length is 500"
        } else {
            document.getElementById('second_error').innerHTML = ""
        }
        // $.ajax({
        //     headers: {
        //         'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        //     },
        //     type: 'GET',
        //     url: "<?php echo e(URL::to('/user/broadcast/createBroadCast')); ?>",
        //     data: {
        //         'id': 12112
        //     },
        //     dataType: 'json', //return data will be json
        //     success: function(result) {},
        //     error: function(error) {
        //         alert('failure: data is missing!');
        //         console.log(error.message);
        //     }
        // });
        $('#msform').submit();

    }



    (function($) {
        "use strict";

        //* Form js
        function verificationForm() {
            //jQuery time
            var current_fs, next_fs, previous_fs; //fieldsets
            var left, opacity, scale; //fieldset properties which we will animate
            var animating; //flag to prevent quick multi-click glitches

            $(".next").click(function() {
                const ref = document.getElementById("page_number")
                const page_number = ref.dataset.myvar
                const check_broadcast_name = document.getElementById('check_broadcast_name').value;

                if (check_broadcast_name == 1) {
                    return;
                }
                let validation = true;
                if (page_number == 1) {
                    validation = first_validtion();
                }
                if (!validation) {
                    return document.getElementById("error").innerHTML = "Please fill all data";
                } else {
                    document.getElementById("error").innerHTML = "";
                }
                if (animating) return false;
                animating = true;

                current_fs = $(this).parent();
                next_fs = $(this).parent().next();



                //activate next step on progressbar using the index of next_fs
                $("#progressbar li").eq($("fieldset").index(next_fs)).addClass("active");

                //show the next fieldset
                next_fs.show();
                //hide the current fieldset with style
                current_fs.animate({
                    opacity: 0
                }, {
                    step: function(now, mx) {
                        //as the opacity of current_fs reduces to 0 - stored in "now"
                        //1. scale current_fs down to 80%
                        scale = 1 - (1 - now) * 0.2;
                        //2. bring next_fs from the right(50%)
                        left = (now * 50) + "%";
                        //3. increase opacity of next_fs to 1 as it moves in
                        opacity = 1 - now;
                        current_fs.css({
                            'transform': 'scale(' + scale + ')',
                            'position': 'absolute'
                        });
                        next_fs.css({
                            'left': left,
                            'opacity': opacity
                        });
                    },
                    duration: 800,
                    complete: function() {
                        current_fs.hide();
                        animating = false;
                    },
                    //this comes from the custom easing plugin
                    easing: 'easeInOutBack'
                });
            });

            $(".previous").click(function() {
                if (animating) return false;
                animating = true;

                current_fs = $(this).parent();
                previous_fs = $(this).parent().prev();

                //de-activate current step on progressbar
                $("#progressbar li").eq($("fieldset").index(current_fs)).removeClass("active");

                //show the previous fieldset
                previous_fs.show();
                //hide the current fieldset with style
                current_fs.animate({
                    opacity: 0
                }, {
                    step: function(now, mx) {
                        //as the opacity of current_fs reduces to 0 - stored in "now"
                        //1. scale previous_fs from 80% to 100%
                        scale = 0.8 + (1 - now) * 0.2;
                        //2. take current_fs to the right(50%) - from 0%
                        left = ((1 - now) * 50) + "%";
                        //3. increase opacity of previous_fs to 1 as it moves in
                        opacity = 1 - now;
                        current_fs.css({
                            'left': left
                        });
                        previous_fs.css({
                            'transform': 'scale(' + scale + ')',
                            'opacity': opacity
                        });
                    },
                    duration: 800,
                    complete: function() {
                        current_fs.hide();
                        animating = false;
                    },
                    //this comes from the custom easing plugin
                    easing: 'easeInOutBack'
                });
            });

            $(".submit").click(function() {
                return false;
            })
        };

        //* Add Phone no select
        function phoneNoselect() {
            if ($('#msform').length) {
                // $("#phone").intlTelInput();
                // $("#phone").intlTelInput("setNumber", "+880");
            };
        };
        //* Select js
        function nice_Select() {
            if ($('.product_select').length) {
                $('select').niceSelect();
            };
        };
        /*Function Calls*/
        verificationForm();
        phoneNoselect();
        nice_Select();
    })(jQuery);
</script>

<script type="text/javascript">
    function create() {
        ajax_submit_create('broadcast');
    }

    $(document).ready(function() {
        // View Form
        $("#manage_all").on("click", ".view", function() {
            var id = $(this).attr('id');
            ajax_submit_view('blogs', id)
        });

        // Edit Form
        $("#manage_all").on("click", ".edit", function() {
            var id = $(this).attr('id');
            ajax_submit_edit('blogs', id)
        });


        // Delete
        $("#manage_all").on("click", ".delete", function() {
            var id = $(this).attr('id');
            ajax_submit_delete('blogs', id)
        });

    });

    Date.prototype.toDateInputValue = (function() {
        var local = new Date(this);
        local.setMinutes(this.getMinutes() - this.getTimezoneOffset());
        return local.toJSON().slice(0, 10);
    });
    let now = new Date();
    $('#time').val(now.getHours() + ":" + now.getMinutes());
    $('#date').val(new Date().toDateInputValue());


    $(".custom-file-input").on('change', function(e) {
        const file_name = e.target.files[0].name;
        document.getElementById('file_name').innerHTML = file_name

        var files = e.target.files; // FileList object
        var xl2json = new ExcelToJSON();
        xl2json.parseExcel(files[0]);

    });
    $("#file-upload").on('change', function(e) {
        const file_name = e.target.files[0].name;
        if (e.target.files[0]) {
            return document.getElementById('document_name').innerHTML = file_name
        }
        return document.getElementById('document_name').innerHTML = ""
    });
    $("#broadcast_name").on('change', function(e) {
        const value = $("#broadcast_name").val();
        if (value) {
            $.ajax({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                },
                type: 'POST',
                url: "<?php echo e(URL::to('/user/broadcast/checkUniqueBroadcast')); ?>",
                data: {
                    value
                },
                dataType: 'json', //return data will be json
                success: function(result) {
                    if (result.length > 0) {
                        document.getElementById('check_broadcast_name').value = "1";
                        document.getElementById('error').innerHTML = "Broadcaste name already exist"
                    } else {
                        document.getElementById('check_broadcast_name').value = "0";
                        document.getElementById('error').innerHTML = ""
                    }
                },
                error: function() {
                    alert('failure: data is missing!');
                }
            });
        }
    });

    function handleRadio(myRadio) {
        currentValue = myRadio.value;
        if (currentValue === "2") {
            return document.getElementById("dates").style.display = ""; //show
        }
        return document.getElementById("dates").style.display = "none"; //hide
    }


    $(document).on('change', '#live_search', function() {
        var template_id = $(this).val();
        var a = $(this).parent();
        $.ajax({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            },
            type: 'POST',
            url: "<?php echo e(URL::to('/user/template/gettemplatecontent')); ?>",
            data: {
                'id': template_id
            },
            dataType: 'json', //return data will be json
            success: function(result) {
                const data = result.id;
                console.log(data);
                let QuickHtml = ""
                let URLHtml = ""
                if (data.button_type === "URL") {
                    URLHtml = `
                <hr/>
                <div class="URLHtml">
                <a href="#"> ${JSON.parse(data.button_text)[0] ? JSON.parse(data.button_text)[0].text : ''}</a>
                <a href="#"> ${JSON.parse(data.button_text)[1] ? JSON.parse(data.button_text)[1].text: ''}</a>
                </div>
                `;
                }
                if (data.button_type === "QUICK_REPLY") {
                    QuickHtml = `
                <div class="QUICK_REPLY_CARD">
                <span>${JSON.parse(data.button_text)[0].text}</span>
                </div>
                <div class="QUICK_REPLY_CARD">
                <a href="#">${JSON.parse(data.button_text)[1].text}</a>
                </div>
                `;
                    document.getElementById("QUICK_REPLY").innerHTML = QuickHtml
                } else
                    document.getElementById("QUICK_REPLY").innerHTML = ""
                // this regular expression will find the {} in text area, double bracket causing error so we opt single bracket
                var regex = new RegExp(/{(.*?)\}/, 'g');
                var paramsCount = (data.body_text.match(regex) || []).length;
                document.getElementById('params-count').value = paramsCount;
                document.getElementById('params-message').innerHTML = `You need ${paramsCount} params in csv file`;

                const text = data.body_text.length > 400 ? data.body_text.slice(0, 400) + " " + `<a href="#">...read more</a>` : data.body_text

                const documenthtml = `<div class="inside-box-document" id="message">
                <img style="text-align:cetner;" width="100px" src="https://cdn1.iconfinder.com/data/icons/files-documents-set-4/512/20-512.png"/>
               <p style=" white-space: pre-line;"> ${text} </p></div>`
                const texthtml = `<div class="inside-box" id="message"><b>${data.hader_text}</b> <p style=" white-space: pre-line;"> ${text} </p>
                <span id="footer_text">${data.footer_text}</span>
                ${URLHtml}
                </div>`
                // console.log(data);

                if (!data.hader_format) {
                    document.getElementById("header_format").value = data.hader_format;
                    document.getElementById("url_input").style.display = "none";
                    return document.getElementById("message").innerHTML = texthtml;
                }
                if (data.hader_format.toLowerCase() === "text") {
                    document.getElementById("header_format").value = data.hader_format;
                    document.getElementById("url_input").style.display = "none";
                    return document.getElementById("message").innerHTML = texthtml;
                }
                // const url_input = `<input type="text" id="url" name="url" class="form-control" placeholder="Document url">`
                // const url_input = ``
                if (data.hader_format.toLowerCase() === "video") {
                    document.getElementById("url_input_video").style.display = "";
                } else if (data.hader_format.toLowerCase() === "image") {
                    // document.getElementById("url_input").style.display = "";
                    document.getElementById("url_input_image").style.display = "";
                } else {
                    document.getElementById("url_input").style.display = "";
                    document.getElementById("url_input_file").style.display = "";
                }

                document.getElementById("header_format").value = data.hader_format;
                // document.getElementById("url_input").innerHTML = url_input;
                return document.getElementById("message").innerHTML = documenthtml;
            },
            error: function() {
                alert('failure: data is missing!');
            }
        });
    });
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.8.0/jszip.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.8.0/xlsx.js"></script>
<script>
    var ExcelToJSON = function() {

        this.parseExcel = function(file) {
            var reader = new FileReader();

            reader.onload = function(e) {
                var data = e.target.result;
                var workbook = XLSX.read(data, {
                    type: 'binary'
                });
                workbook.SheetNames.forEach(function(sheetName) {
                    // Here is your object
                    var XL_row_object = XLSX.utils.sheet_to_row_object_array(workbook.Sheets[sheetName]);
                    var json_object = JSON.stringify(XL_row_object);
                    const obj = JSON.parse(json_object)
                    const result = Object.keys(Object.assign({}, ...obj));
                    const header = ['Phone_Number']
                    const paramsCount = document.getElementById('params-count').value;
                    if (paramsCount > 0) {
                        for (let i = 1; i <= paramsCount; i++) {
                            header.push(`Param_${i}`)
                        }
                    }
                    if (obj.length == 0) {
                        return;
                    }

                    if (JSON.stringify(header) != JSON.stringify(result)) {
                        return document.getElementById('csv_validate').value = 1
                    }
                    if (result.length > 500) {
                        return document.getElementById('csv_validate').value = 2
                    }
                    // console.log(obj);
                    document.getElementById('csv_validate').value = 3
                    jQuery('#xlx_json').val(json_object);
                })
            };

            reader.onerror = function(ex) {
                console.log(ex);
            };

            reader.readAsBinaryString(file);
        };
    };
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('backend.layouts.user_master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH F:\lunar\xamp7.3\htdocs\lancer\chatbox\resources\views/backend/user/broadcast/createBroadCast.blade.php ENDPATH**/ ?>