VaKeR CYBER ARMY
Logo of a company Server : Apache
System : Linux host44.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
User : vapecompany ( 2719)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /proc/thread-self/root/home/vapecompany/demo.vapecompany.com.bd/resources/views/backend/ctoreject/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/thread-self/root/home/vapecompany/demo.vapecompany.com.bd/resources/views/backend/ctoreject/edit.blade.php
@extends('backend.layout.app')
@section('content')
      <style type="text/css">
          .btn-file {
                position: initial;
                overflow: hidden;
            }
            .btn-file input[type=file] {
                position: absolute;
                top: 0;
                right: 0;
                min-width: 100%;
                min-height: 100%;
                font-size: 100px;
                text-align: right;
                filter: alpha(opacity=0);
                opacity: 0;
                outline: none;
                background: white;
                cursor: inherit;
                display: block;
            }

            #img-upload{
               width: 100%;
               height: 100%
            }
            #img-container{
                width: 100px;
                height: 100px;
                margin: 10px 0;
                border: 1px solid;
            }
            #checkerr .text-danger{
                position: absolute;
                top: 80px;
            }
            #imgerr label{
                    top: 32px;
                    position: absolute;
                    left: 105px;
            }

            /*new image upload css*/
            .upload-img-box {
                background-color: #f5f5f5;
                border: 1px solid #aaa;
                border-radius: 5px;
                height: 150px;
                position: relative;
            }
            .upload-img-box img {
                width: 100%;
                height: auto;
                max-height: 100%;
                margin: auto;
                display: block;
                z-index: 5;
                position: absolute;
                object-fit: cover;
                top: 50%;
                left: 50%;
                transform: translate(-50%, -50%);
            }
            .upload-img-box input[type="file"] {
                position: absolute;
                top: 0;
                left: 0;
                right: 0;
                bottom: 0;
                opacity: 0;
                z-index: 10;
                width: 100%;
                cursor: pointer;
            }
            .upload-img-box-icon {
                color: #666;
                text-align: center;
                position: absolute;
                left: 50%;
                top: 50%;
                transform: translate(-50%, -50%);
            }
            .tablegrid{
                border-bottom: 1px solid #eee;
                padding-bottom: 10px;

            }
            .noborder{
                border: 1px solid #fff;
            }
            a{
                 padding: 0 1vh;
            }
            /*end image upload css*/


      </style>
        <!-- ============================================================== -->
        <!-- Page wrapper  -->
        <!-- ============================================================== -->
        <div class="page-wrapper">
            <!-- ============================================================== -->
            <!-- Bread crumb and right sidebar toggle -->
            <!-- ============================================================== -->
            <div class="page-breadcrumb">
                <div class="row">
                    <div class="col-5 align-self-center">
                        <h4 class="page-title">Edit Central To Customer</h4>
                        <div class="d-flex align-items-center">
                            <nav aria-label="breadcrumb">
                                <ol class="breadcrumb">
                                    <li class="breadcrumb-item"><a href="#">Chalan</a></li>
                                    <li class="breadcrumb-item active" aria-current="page">Central To Customer</li>
                                </ol>
                            </nav>
                        </div>
                    </div>

                </div>
            </div>
            <!-- ============================================================== -->
            <!-- End Bread crumb and right sidebar toggle -->
            <!-- ============================================================== -->
            <!-- ============================================================== -->
            <!-- Container fluid  -->
            <!-- ============================================================== -->
            <div class="container-fluid">
                <!-- ============================================================== -->
                <!-- Start Page Content -->
                <!-- ============================================================== -->
                <div class="row">
                    <div class="col-12">

                        <div class="card">
                            <div class="card-body">
                                <form id="addRequisition" type="POST">
                                    @csrf
                                    <h4 class="card-title">Edit Central To Customer</h4>
                                     @include('backend.layout.verror_message')
                                    <div class="form-group row">
                                        <label for="brand" class="col-sm-3 text-right control-label col-form-label">Date</label>
                                        <div class="col-sm-9">
                                            <input type="hidden" name="rejected_return_id" value="{{$damageStock->rejected_return_id}}">
                                           <div class="input-group">
                                                <input type="text" name="rejected_return_date" value="{{$damageStock->rejected_return_date->format('d-m-Y')}}" class="form-control" id="datepicker-autoclose" placeholder="mm/dd/yyyy">
                                                <div class="input-group-append">
                                                    <span class="input-group-text"><i class="icon-calender"></i></span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="form-group row">
                                        <label for="brand" class="col-sm-3 text-right control-label col-form-label">Customer</label>
                                        <div class="col-sm-9">
                                            <select name="customer" class="form-control select2 ">
                                                   <option value="">Select</option>
                                                    @foreach($customers as $customer)
                                                        @if($customer->customer_id == $damageStock->customer_id)
                                                        <option selected="" value="{{$customer->customer_id}}">{{$customer->customer_name}}</option>
                                                        @else
                                                          <option value="{{$customer->customer_id}}">{{$customer->customer_name}}</option>
                                                        @endif
                                                    @endforeach
                                            </select>
                                        </div>
                                    </div>



                                     <div class="form-group row">
                                        <label for="brand" class="col-sm-3 text-right control-label col-form-label">Remarks </label>
                                        <div class="col-sm-9">
                                           <textarea name ="remarks"class="form-control" rows="3" placeholder="Text Here...">{{$damageStock->remarks}}</textarea>
                                        </div>
                                    </div>







<script type="text/javascript">
    var cartproduct={};
    var postbarcodelist={};
    var barcodelist={};
    var pre_postbarcodelist={};
    var pre_barcodelist={};
</script>
                                    <div id="cart_items">
        @foreach($damageStock->details as $details)
         <script type="text/javascript">

                cartproduct["{{$details->central_return()->return_code.'-'.$details->product_id}}-{{$details->color_id}}"]="{{$details->color_id}}";
        </script>
        @if($details->is_iemi == 1)


        @foreach($details->imeis as $imei)
            <script type="text/javascript">
                pre_barcodelist["{{$imei->imei_1}}"]="{{$imei->imei_1}}";
               if(pre_postbarcodelist["{{$details->central_return()->return_code.'-'.$details->product_id}}-{{$details->color_id}}"] == undefined){
                    pre_postbarcodelist["{{$details->central_return->return_code.'-'.$details->product_id}}-{{$details->color_id}}"] =[];
                }
                pre_postbarcodelist["{{$details->central_return()->return_code.'-'.$details->product_id}}-{{$details->color_id}}"].push("{{$imei->imei_1}}");
                barcodelist["{{$imei->imei_1}}"]="{{$imei->imei_1}}";
               if(postbarcodelist["{{$details->central_return()->return_code.'-'.$details->product_id}}-{{$details->color_id}}"] == undefined){
                    postbarcodelist["{{$details->central_return()->return_code.'-'.$details->product_id}}-{{$details->color_id}}"] =[];
                }
                postbarcodelist["{{$details->central_return()->return_code.'-'.$details->product_id}}-{{$details->color_id}}"].push("{{$imei->imei_1}}");
        </script>
        @endforeach
        @endif
            <div class="row form-group tablegrid" id="{{$details->central_return()->return_code.'-'.$details->product_id.'-'.$details->color_id}}">
                <div class="col-sm-2 text-right">
                        <div class="img form-group">
                            <img style="height: 50px" src="{{url('/public/images/product/')}}/{{$details->product->product_image}}" class="img-fluid"> <!---->
                        </div>
                </div>
                <div class="col-md-2 col-xs-12 align-items-center justify-content-center">
                    <label class="product-title form-group"><span class="mobile-heading" style="display: none">Invoice Number:</label> </label>

                        <strong>{{$details->central_return()->return_code}}</strong>

                        <input type="hidden" name="return_code[]" value="{{$details->central_return()->return_code}}">
                        <input type="hidden" name="central_return_detail_id[]" value="{{$details->central_return_detail_id}}">
                        <input type="hidden" name="chalan_details_id[]" value="{{$details->chalan_details_id}}">
                        <input type="hidden" name="chalan_id[]" value="{{$details->chalan_id}}">


                </div>
                    <div class="col-md-2 col-xs-12 align-items-center justify-content-center">
                        <label class="product-title form-group"><span class="mobile-heading" style="display: none">Brand:</label> </label>
                            <strong>{{$details->product->brand->brand_name}}</strong>

                    </div>
                <div class="col-sm-2 col-xs-12">
                    <label class="product-title form-group"><strong>{{$details->product->product_name}}</strong></label>
                    <input type="hidden" name="product_id[]" value="{{$details->product->product_id}}">
                    <input type="hidden" name="brand[]" value="{{$details->brand_id}}">

                </div>
                <div class="col-sm-1 col-xs-12 align-items-center justify-content-center">
                    <label class="product-title form-group"><strong>{{$details->color->color_name}}</strong></label>
                    <input type="hidden" name="color[]" value="{{$details->color_id}}">
                </div>
                <!-- <div class="col-sm-2 col-xs-12 align-items-center justify-content-center">
                    <label class="product-title form-group"><strong>{{$details->product->sale_price}}</strong></label>
                    <input type="hidden" name="sale_price[]" value="{{$details->product->sale_price}}">
                </div> -->
                <div class="col-sm-2">
                    <div class="input-group bootstrap-touchspin bootstrap-touchspin-injected form-group">
                         @if($details->is_iemi != 1)
                        <span class="input-group-btn input-group-prepend">
                            <button onclick="decreaseCart('demo{{$details->product_id.'-'.$details->color_id}}')" class="btn btn-primary bootstrap-touchspin-down" type="button">-</button>
                        </span>
                        @endif
                        <input id="demo{{$details->product_id.'-'.$details->color_id}}" type="text" value="{{$details->quantity}}" name="qty[]" class="form-control">
                         @if($details->is_iemi != 1)
                        <span class="input-group-btn input-group-append">
                            <button onclick="increateCart('demo{{$details->product_id.'-'.$details->color_id}}')" class="btn btn-primary bootstrap-touchspin-up" type="button">+</button>
                        </span>
                        @endif
                    </div>
                </div>
                <div class="col-sm-1">
                    <button onclick="closeCart('{{$details->product_id.'-'.$details->color_id}}')" data-repeater-delete="" class="btn btn-danger waves-effect waves-light form-group" type="button">
                        <i class="ti-close"></i>
                    </button>
                </div>
            </div>
        @endforeach
                                    </div>
                                     <div  style="margin-top: 50px;"><div style="text-align: center;padding: 10px;display: none;" id="product_exist" class="text-danger">Already Exist</div>
                                   <div class="row form-group">
                                        <label for="brand" class="col-sm-2 text-right control-label col-form-label">Add Product</label>
                                        <div class="col-sm-2">
                                            <div class="form-group">
                                                <select onchange="get_product()" class="form-control" id="brand" name="educationDate">
                                                    <option>Select Brand</option>
                                                    < @foreach($brands as $brand)
                                                        <option value="{{$brand->brand_id}}">{{$brand->brand_name}}</option>
                                                    @endforeach
                                                </select>
                                            </div>
                                        </div>
                                         <div class="col-sm-3">
                                            <div class="form-group">
                                                <select onchange="get_product_color()" class="form-control" id="addProduct" name="educationDate">
                                                    <option>Product</option>

                                                </select>
                                            </div>
                                        </div>
                                        <div class="col-sm-2">
                                            <div class="form-group">
                                                <select class="form-control" id="addColor" name="educationDate">
                                                    <option>Color</option>

                                                </select>
                                            </div>
                                        </div>
                                        <div class="col-sm-3">
                                            <div style="display: flex;">
                                                <div class="form-group" style="width: 115%;margin-right: 15px;">
                                                    <input type="text" class="form-control" id="addInvoice" name="addInvoice" placeholder="Return Code">
                                                </div>
                                                <div class="form-group">
                                                    <input type="text" class="form-control" id="addQnantity" name="addQnantity" placeholder="Quantity">
                                                </div>
                                            </div>

                                        </div>
                                        <div class="col-sm-3">
                                            <div class="form-group">

                                                <input type="text" class="form-control" id="addBarcode" name="addBarcode" placeholder="Barcode">
                                            </div>
                                        </div>
                                        <div class="col-sm-3">
                                            <div class="form-group">

                                                <input type="text" class="form-control" id="removeBarcode" name="removeBarcode" placeholder="Remove Barcode">
                                            </div>
                                        </div>
                                        <div class="col-sm-1">
                                            <div class="form-group">
                                                <button class="btn btn-success" type="button" onclick="addcart();"><i class="fa fa-plus"></i></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                    <div class="form-group mb-0 text-right">
                                        <button type="submit" name="action" value="submit" class=" submit btn btn-info waves-effect waves-light">Update</button>
                                       <!--  <button type="submit" name="action" class="btn btn-dark waves-effect waves-light">Cancel</button> -->
                                    </div>
                                 </form>
                            </div>

                        </div>


                    </div>
                </div>
                <!-- ============================================================== -->
                <!-- End PAge Content -->
                <!-- ============================================================== -->
                <!-- ============================================================== -->
                <!-- Right sidebar -->
                <!-- ============================================================== -->
                <!-- .right-sidebar -->
                <!-- ============================================================== -->
                <!-- End Right sidebar -->
                <!-- ============================================================== -->
            </div>
            <!-- ============================================================== -->
            <!-- End Container fluid  -->
            @endsection
            @section('script')
             <script src="{{url('/public/js/jquery.validate.min.js')}}"></script>
               <link rel="stylesheet" type="text/css" href="{{url('/public/css/bootstrap-datepicker.min.css')}}">
             <script src="{{url('/public/js/bootstrap-datepicker.min.js')}}"></script>

             <script src="{{url('/public/js/tinymce.min.js')}}"></script>
                <script type="text/javascript">

                    function get_product(){
                        var id=$('#brand').val();
                            //console.log("{{url('get_productById')}}/"+id);
                        $.ajax({

                            type : 'POST',
                            url  : "{{url('get_productById')}}",
                            data:{brand_id:id},
                             dataType: 'json',
                            success :  function (data)
                            {

                                //var d=JSON.parse(data);

                                var color="<option>Select Product</option>";
                                $.each(data,function(){
                                    console.log(this.product_id);
                                    color +="<option value='"+this.product_id+"'> "+this.product_name+" </option>";
                                });
                               // console.log(color);
                                $('#addProduct').html(color);

                            },
                            error :  function (data)
                            {
                                //console.log(data);
                            }
                        });
                    }
                    function get_product_color(){
                        var id=$('#addProduct').val();

                        $.ajax({

                            type : 'POST',
                            url  : "{{url('get_productById')}}",
                            data:{id:id},
                            // dataType: 'json',
                            success :  function (data)
                            {


                                $('#addColor').html(data);

                            },
                            error :  function (data)
                            {
                                //console.log(data);
                            }
                        });
                    }
                    function addcart(){
                        event.preventDefault();
                        var brand=$('#brand').val();
                        var id=$('#addProduct').val();
                        var color=$('#addColor').val();
                        var qty=$('#addQnantity').val();
                        var invoice=$('#addInvoice').val();
                          var uniqueid=invoice+'-'+id+'-'+color;
                          console.log(uniqueid);
                          console.log(cartproduct);
                        if(cartproduct[invoice+'-'+id+'-'+color] == undefined)
                        {
                            $('#product_exist').hide();
                            $.ajax(
                            {
                                type : 'POST',
                                url  : "{{url('add_cart_return')}}",
                                data : {uniqueid:uniqueid,invoice_no:invoice,id: id,color:color,qty:qty },
                                // dataType: 'json',
                                success :  function (data)
                                {
                                    if(data == 2 || data == 1){
                                        data== 2 ? $('#product_exist').html('Product quantity is invalid !'):$('#product_exist').html('Data not Found in chalan !');
                                        $('#product_exist').show();
                                    }else{
                                       cartproduct[invoice+'-'+id+'-'+color]=color;
                                        if($('#validateProduct').length > 0){
                                            $('#cart_items').html(data);
                                        }else{
                                            $('#cart_items').append(data);
                                        }
                                    }
                                },
                                error :  function (data)
                                {
                                    console.log(data);
                                }
                            });
                        }else{
                            $('#product_exist').html('Already Exist !');
                            $('#product_exist').show();
                        }
                    }

                    // var postbarcodelist={};
                    // var barcodelist={};
                     $('#addBarcode').change(function(){
                        var barcode=$('#addBarcode').val();

                        if(barcode != ""){
                            $('#product_exist').hide();
                             $.ajax(
                            {
                                type : 'POST',
                                url  : "{{url('add_cart_barcode_central_return')}}",
                                data : {barcode:barcode},
                                // dataType: 'json',
                                success :  function (data)
                                {
                                    //console.log(data);
                                    if(data == "no"){
                                        $('#product_exist').html('barcode not exist');
                                        $('#product_exist').show();
                                    }else{
                                          var uniqueid=data.chalan_number+'-'+data.product_id+'-'+data.color;
                                          var barcodex=pre_barcodelist[data.imei_1] ? data.imei_1 : data.imei_2;
                                        if(pre_barcodelist[barcodex]){
                                            if(ex_list[uniqueid] == undefined){
                                                ex_list[uniqueid] =[];
                                            }
                                            if(ex_list[uniqueid].length > 0){
                                                var index = ex_list[uniqueid].indexOf(barcodex);


                                             ex_list[uniqueid].splice(index, 1);
                                            }

                                        }

                                        if(cartproduct[uniqueid] == undefined)
                                        {
                                            cartproduct[uniqueid]=barcode;
                                            barcodelist[barcode]=barcode;

                                            if(postbarcodelist[uniqueid] == undefined){
                                                postbarcodelist[uniqueid] =[];
                                            }
                                            postbarcodelist[uniqueid].push(barcode);
                                            addBarcode(uniqueid,data.chalan_number,data.product_id,data.color,1);
                                        }else{
                                           // console.log(data.imei_2 == barcodelist[barcode]);
                                            if(barcodelist[data.imei_1] != data.imei_1 && barcodelist[data.imei_2] != data.imei_2)
                                            {
                                                barcodelist[barcode]=barcode;

                                                if(postbarcodelist[uniqueid] == undefined){
                                                    postbarcodelist[uniqueid] =[];
                                                }
                                                postbarcodelist[uniqueid].push(barcode);
                                                var checkitem=$('#cart_items #'+uniqueid);
                                                if(checkitem.length > 0){
                                                    var value=$('#cart_items #'+uniqueid+' #demo'+uniqueid).val();

                                                // $('#cart_items #'+uniqueid+' #demo'+uniqueid).val(parseInt(value)+1);
                                                $('#cart_items #'+uniqueid+' #demo'+uniqueid).prop('readonly',false);
                                                $('#cart_items #'+uniqueid+' #demo'+uniqueid).val(parseInt(value)+1);
                                                $('#cart_items #'+uniqueid+' #demo'+uniqueid).prop('readonly',true);



                                                }
                                            }else{
                                                $('#product_exist').show();
                                            }

                                        }
                                    }

                                    $('#addBarcode').val('');
                                }
                            });

                        }
                     });

                     function addBarcode(uniqueid,invoice,product_id,color,qty){
                        $.ajax(
                            {
                                type : 'POST',
                                url  : "{{url('add_cart_return')}}",
                                data : {uniqueid:uniqueid,invoice_no:invoice,id: product_id,color:color,qty:qty },
                                // dataType: 'json',
                                success :  function (data)
                                {


                                    if($('#validateProduct').length > 0){
                                        $('#cart_items').html(data);
                                    }else{
                                        $('#cart_items').append(data);
                                    }
                                },
                                error :  function (data)
                                {
                                    //console.log(data);
                                }
                            });
                     }
                     var ex_list={};
                    $('#removeBarcode').change(function(){
                        var barcode=$('#removeBarcode').val();
                         if(barcode != ""){
                            $('#product_exist').hide();
                             $.ajax(
                            {
                                type : 'POST',
                                url  : "{{url('add_cart_barcode_central_return')}}",
                                data : {barcode:barcode},
                                // dataType: 'json',
                                success :  function (data)
                                {
                                    var uniqueid=data.chalan_number+'-'+data.product_id+'-'+data.color;
                                    var barcodex = barcodelist[data.imei_1] ? data.imei_1 : data.imei_2;
                                    if(barcodex)
                                    {


                                        delete barcodelist[barcodex];


                                        var checkitem=$('#cart_items #'+uniqueid);
                                        if(checkitem.length > 0){
                                            var value=$('#cart_items #'+uniqueid+' #demo'+uniqueid).val();


                                            $('#cart_items #'+uniqueid+' #demo'+uniqueid).prop('readonly',false);
                                            $('#cart_items #'+uniqueid+' #demo'+uniqueid).val(parseInt(value)-1);
                                            $('#cart_items #'+uniqueid+' #demo'+uniqueid).prop('readonly',true);

                                        }
                                        //console.log(postbarcodelist);
                                       // console.log(uniqueid);
                                       if(pre_barcodelist[barcodex]){
                                            if(ex_list[uniqueid] == undefined){
                                                ex_list[uniqueid] =[];
                                            }
                                            ex_list[uniqueid].push(barcode);
                                        }
                                        var index = postbarcodelist[uniqueid].indexOf(barcodex);

                                         postbarcodelist[uniqueid].splice(index, 1);
                                         if(postbarcodelist[uniqueid].length == 0){
                                            delete cartproduct[uniqueid];
                                            $('#'+uniqueid).remove();
                                         }

                                    }else{
                                        $('#product_exist').html('barcode not exist');
                                        $('#product_exist').show();
                                    }
                                }
                            });
                             $('#removeBarcode').val('');
                         }


                    });
                     //increate and decreate
                       function increateCart(arg){
                            var v=$('#'+arg).val();
                            v++;
                            $('#'+arg).val(v);
                       }
                        function decreaseCart(arg){
                            var v=$('#'+arg).val();
                            v--;
                            $('#'+arg).val(v);
                       }
                       function closeCart(arg){
                        //console.log(postbarcodelist);
                        if(Object.keys(postbarcodelist).length){
                            if(postbarcodelist[arg].length > 0){
                                $.each(postbarcodelist[arg],function(){
                                    delete barcodelist[this];
                                    if(pre_barcodelist[this]){
                                        ex_list[arg].push(this);
                                    }
                                    //console.log(barcodelist);
                                })

                                delete postbarcodelist[arg];

                            }
                        }


                        delete cartproduct[arg];
                            $('#'+arg).remove();

                       }
                    //end increate and decrease

                    $(document).ready( function() {
                        var date = new Date();
                        var today = new Date(date.getFullYear(), date.getMonth(), date.getDate());
                        $('#datepicker-autoclose').datepicker({
                            format: 'dd-mm-yyyy',
                            autoclose: true,
                            todayHighlight: true
                        });
                        // $( '#datepicker-autoclose').datepicker( 'setDate', today );
                        $("#addRequisition").validate({
                                    ignore: "",
                                    rules:
                                   {
                                        customer: {
                                            required: true,
                                        },
                                        damage_stock_date:{
                                            required: true,
                                        },
                                        'product_id[]': {
                                            required: true,
                                        },
                                   },
                                    messages: {
                                        'product_id[]': "Please Add Product",
                                    },
                                submitHandler: submitForm
                              });

                     //product validtion form and insert



                       function submitForm() {

                            event.preventDefault();
                            var data1 = new FormData(document.getElementById('addRequisition'));
                            console.log(data1);

                            $.ajax({

                                type : 'POST',
                                url  : "{{url('edit_return_reject')}}",
                                data : data1,
                                cache:false,
                                contentType: false,
                                processData: false,
                                //dataType: 'json',
                                success :  function (data)
                                {
                                    console.log(data);
                                    if(data.errors=='0'){
                                        $('.alert-success').show();
                                        $('.alert-danger').hide();
                                        $('.alert-success').append('<p>'+data.success+'</p>');
                                        $("#addRequisition").get(0).reset();
                                        $("#cart_items").html("");
                                       window.location ="{{url('/view_return_reject/'.$damageStock->rejected_return_id)}}/";
                                    }else{
                                         var val="";
                                        $.each(data.errors, function(key, value){
                                            $('.alert-danger').show();
                                            $('.alert-success').hide();
                                            val+= '<p>'+value+'</p>';

                                        });
                                        $('.alert-danger').html(val);
                                    }

                                },error: function(response) {
                                    //console.log(response);
                                }
                            });
                            return false;
                        }
                     //end validation and insert

                        });


                    //new img upload
                    function previewFile(input) {
                            var preview = input.previousElementSibling;
                            var file = input.files[0];
                            var reader = new FileReader();


                            if(input.files[0].size > 2000000){
                                alert("Maximum file size is 2MB!");

                            } else {

                                reader.onloadend = function() {
                                    preview.src = reader.result;
                                }

                                if (file) {
                                    reader.readAsDataURL(file);

                                } else {
                                    preview.src = "";
                                }
                            }
                        }
                    //end new img upload
                </script>
            @endsection

VaKeR 2022