403Webshell
Server IP : 14.225.204.176  /  Your IP : 216.73.216.252
Web Server : nginx/1.24.0
System : Linux nodejs-ybgk 6.8.0-40-generic #40-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 5 10:34:03 UTC 2024 x86_64
User : root ( 0)
PHP Version : 8.1.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/html/php/thanhphuong/resources/views/product/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/php/thanhphuong/resources/views/product/index.blade.php
@extends('layout.main') @section('content')
@if(session()->has('create_message'))
    <div class="alert alert-success alert-dismissible text-center"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>{{ session()->get('create_message') }}</div> 
@endif
@if(session()->has('edit_message'))
    <div class="alert alert-success alert-dismissible text-center"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>{{ session()->get('edit_message') }}</div> 
@endif
@if(session()->has('import_message'))
    <div class="alert alert-success alert-dismissible text-center"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>{{ session()->get('import_message') }}</div> 
@endif
@if(session()->has('not_permitted'))
    <div class="alert alert-danger alert-dismissible text-center"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>{{ session()->get('not_permitted') }}</div> 
@endif
@if(session()->has('message'))
    <div class="alert alert-danger alert-dismissible text-center"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>{{ session()->get('message') }}</div> 
@endif

<section>
    <div class="container-fluid">
        @if(in_array("products-add", $all_permission))
            <a href="{{route('products.create')}}" class="btn btn-info"><i class="dripicons-plus"></i> {{__('file.add_product')}}</a>
            <a href="#" data-toggle="modal" data-target="#importProduct" class="btn btn-primary"><i class="dripicons-copy"></i> {{__('file.import_product')}}</a>
        @endif
    </div>
    <div class="table-responsive">
        <table id="product-data-table" class="table" style="width: 100%">
            <thead>
                <tr>
                    <th class="not-exported"></th>                  
                    <th>{{trans('file.name')}}</th>
                    <th class="text-center" style="width: 20%;">{{trans('file.Code')}}</th>
                    <th>{{trans('file.Brand')}}</th>
                    <th class="text-center">{{trans('file.Unit')}}</th>
                    <th class="text-center">{{trans('file.Inventory Quantity')}}</th>
                    <th class="text-center">{{trans('file.Warehouse Price')}}</th>
                    <th>{{trans('file.Subtotal')}}</th>
                    <th class="text-center not-exported">{{trans('file.action')}}</th>
                </tr>
            </thead>
            
        </table>
    </div>
</section>

<div id="importProduct" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" class="modal fade text-left">
    <div role="document" class="modal-dialog">
      <div class="modal-content">
        {!! Form::open(['route' => 'product.import', 'method' => 'post', 'files' => true]) !!}
        <div class="modal-header">
          <h5 id="exampleModalLabel" class="modal-title">Import Product</h5>
          <button type="button" data-dismiss="modal" aria-label="Close" class="close"><span aria-hidden="true"><i class="dripicons-cross"></i></span></button>
        </div>
        <div class="modal-body">
          <p class="italic"><small>{{trans('file.The field labels marked with * are required input fields')}}.</small></p>
           <p>{{trans('file.The correct column order is')}} (image, name*, code*, type*, brand, category*, unit_code*, cost*, price*, product_details, variant_name, item_code, additional_price) {{trans('file.and you must follow this')}}.</p>
           <p>{{trans('file.To display Image it must be stored in')}} public/images/product {{trans('file.directory')}}. {{trans('file.Image name must be same as product name')}}</p>
           <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <label>{{trans('file.Upload CSV File')}} *</label>
                        {{Form::file('file', array('class' => 'form-control','required'))}}
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label> {{trans('file.Sample File')}}</label>
                        <a href="public/sample_file/sample_products.csv" class="btn btn-info btn-block btn-md"><i class="dripicons-download"></i>  {{trans('file.Download')}}</a>
                    </div>
                </div>
           </div>           
            {{Form::submit('Submit', ['class' => 'btn btn-primary'])}}
        </div>
        {!! Form::close() !!}
      </div>
    </div>
</div>

<div id="product-details" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" class="modal fade text-left">
    <div role="document" class="modal-dialog">
        <div style="border: none" class="modal-content">
            <div class="container mt-3">
                <div class="row">
                    <div class="col-md-3">
                        <button id="print-btn" type="button" class="btn btn-default btn-sm d-print-none"><i class="dripicons-print"></i> {{trans('file.Print')}}</button>
                    </div>
                    <div class="col-md-6 text-center" id="invoice-title">
                        <h3> {{trans('file.Product Details')}} </h3>
                    </div>
                    <div class="col-md-3">
                        <button type="button" id="close-btn" data-dismiss="modal" aria-label="Close" class="close d-print-none"><span aria-hidden="true"><i class="dripicons-cross"></i></span></button>
                    </div>
                </div>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-md-5" id="slider-content"></div>
                    <div class="col-md-7" id="product-content"></div>
                </div>
                <div class="row">
                    <div class="col-md-5 mt-2" id="product-warehouse-section">
                        <h5>{{trans('file.Warehouse Quantity')}}</h5>
                        <table class="table table-bordered table-hover product-warehouse-list">
                            <thead>
                            </thead>
                            <tbody>
                            </tbody>
                        </table>
                    </div>
                    <div class="col-md-7 mt-2" id="product-variant-warehouse-section">
                        <h5>{{trans('file.Warehouse quantity of product variants')}}</h5>
                        <table class="table table-bordered table-hover product-variant-warehouse-list">
                            <thead>
                            </thead>
                            <tbody>
                            </tbody>
                        </table>
                    </div>
                </div>

                <div class="row">
                    <div class="col-md-12 mt-2">
                        <h5>{{trans('file.Purchase history')}}</h5>
                        <table class="table table-bordered table-hover history-data-table">
                            <thead>
                                <th class="text-center" width="5%">STT</th>
                                <th class="text-center" width="15%">{{trans('file.Date')}}</th>
                                <th class="text-center" width="20%">{{trans('file.Inventory Receiving Voucher')}}</th>
                                <th class="text-center" width="10%">{{trans('file.Quantity')}}</th>
                                <th class="text-center" width="15%">{{trans('file.Recieved')}}</th>
                                <th class="text-center" width="10%">{{trans('file.Tax')}}</th>
                                <th class="text-center" width="10%">{{trans('file.Discount')}}</th>
                                <th class="text-center" width="10%">{{trans('file.Subtotal')}}</th>
                            </thead>
                            <tbody>
                            </tbody>
                        </table>
                    </div>
                </div>
                
                <div class="row">
                    <div class="col-md-12 mt-2">
                        <h5 id="combo-header"></h5>
                        <table class="table table-bordered table-hover item-list">
                            <thead>
                            </thead>
                            <tbody>
                            </tbody>
                        </table>
                    </div>  
                </div>  
            </div>
            <br>
        </div>
    </div>
</div>


<script>
    $("ul#product").siblings('a').attr('aria-expanded','true');
    $("ul#product").addClass("show");
    $("ul#product #product-list-menu").addClass("active");
    $("table").css({ "color": "#000000" });
    $("th").css({ "border": "1px solid #333333", "text-align": "center" });
    $("td").css({ "border": "1px solid #333333" });

	function confirmDelete() {
	    if (confirm("Are you sure want to delete?")) {
	        return true;
	    }
	    return false;
	}

    var warehouse = [];
    var variant = [];
    var qty = [];
    var htmltext;
    var slidertext;
    var product_id = [];
    var all_permission = <?php echo json_encode($all_permission) ?>;
    var user_verified = <?php echo json_encode(env('USER_VERIFIED')) ?>;
    $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });

    $( "#select_all" ).on( "change", function() {
        if ($(this).is(':checked')) {
            $("tbody input[type='checkbox']").prop('checked', true);
        } 
        else {
            $("tbody input[type='checkbox']").prop('checked', false);
        }
    });
    
    $(document).on("click", "tr.product-link td:not(:first-child, :last-child)", function() {
        productDetails( $(this).parent().data('product'), $(this).parent().data('imagedata') );    
        getHistory($(this).parent().data('product'))

    });


    $(document).on("click", ".view", function(){
        var product = $(this).parent().parent().parent().parent().parent().data('product');
        var product1 = $(this).parent().parent().parent().parent().parent().data('product1');
        var imagedata = $(this).parent().parent().parent().parent().parent().data('imagedata');
        productDetails(product, imagedata);
        getHistory(product)
        
    });

    $("#print-btn").on("click", function(){
        var divToPrint=document.getElementById('product-details');
        $('#invoice-title').removeClass("col-md-6");
        $('#invoice-title').addClass("col-md-12");
        var report_title = `
            <div style="display:flex;justify-content: center; text-align:center">
                <div> 
                    <div id="report-logo" style="padding-right: 15px; padding-top:8px;">
                        <img src="{{url('public/logo', $general_setting->site_logo)}}" width="65">
                    </div>
                </div>
                <div> 
                    <div id="report-title" style="text-align:left;color:red;font-size: 0.75em; padding-bottom:8px;">
                        <h4 id="exampleModalLabel" class="modal-title text-center container-fluid">{{trans('file.Company name system')}}</h4>
                    </div> 
                    <div id="report-address" style="text-align:left;color:red;font-size: 0.75em; padding-bottom:8px;">
                        <div class="modal-title text-center container-fluid">{{trans('file.Company address system')}}</div>
                    </div> 
                </div>
            </div>
            <div style="text-align:center;">         
                <div id="report-content" style="padding-bottom:10px; padding-top:10px;">
                    <h4 style="text-transform: uppercase" class="modal-title text-center container-fluid">{{trans('file.Product Details')}}</h4>
                </div>
            
            </div>
        `
        $('#invoice-title').html(report_title);
        var htmlTitle = `<h3 id="exampleModalLabel" class="modal-title text-center container-fluid">{{trans('file.Product Details')}}</h3>`
        var newWin=window.open('','Print-Window');
        newWin.document.open();
        newWin.document.write('<link rel="stylesheet" href="<?php echo asset('public/vendor/bootstrap/css/bootstrap.min.css') ?>" type="text/css"><style type="text/css">@media print {.modal-dialog { max-width: 1200px;} .history-data-table th { border: 1px solid #333333 !important; } .history-data-table td { border: 1px solid #333333 !important; } .product-variant-warehouse-list th { border: 1px solid #333333 !important; } .product-variant-warehouse-list td { border: 1px solid #333333 !important; } .product-warehouse-list th { border: 1px solid #333333 !important; } .product-warehouse-list td { border: 1px solid #333333 !important; }}</style><body onload="window.print()">'+divToPrint.innerHTML+'</body>');
        newWin.document.close();
        setTimeout(function(){
            newWin.close();
            $('#invoice-title').addClass("col-md-6");
            $('#invoice-title').removeClass("col-md-12");
            $('#invoice-title').html(htmlTitle);
        },10);
    });

    function productDetails(product, imagedata) {
        product[11] = product[11].replace(/@/g, '"');
        htmltext = slidertext = '';

        htmltext = '<p><strong>{{trans("file.name")}}: </strong>'+product[1]+'</p><p><strong>{{trans("file.Code")}}: </strong>'+product[2]+ '</p><strong>{{trans("file.Brand")}}: </strong>'+product[3]+'</p><p><strong>{{trans("file.Quantity")}}: </strong>'+product[16]+'</p><p><strong>{{trans("file.Unit")}}: </strong>'+product[5]+'</p><p><strong>{{trans("file.Warehouse Price")}}: </strong>'+product[7]+'</p><p><strong>{{trans("file.Price")}}: </strong>'+product[7]+'</p><strong>{{trans("file.Alert Quantity")}}: </strong>'+product[10];

        if(product[17]) {
            var product_image = product[17].split(",");
            if(product_image.length > 1) {
                slidertext = '<div id="product-img-slider" class="carousel slide" data-ride="carousel"><div class="carousel-inner">';
                for (var i = 0; i < product_image.length; i++) {
                    if(!i)
                        slidertext += '<div class="carousel-item active"><img src="public/images/product/'+product_image[i]+'" height="300" width="100%"></div>';
                    else
                        slidertext += '<div class="carousel-item"><img src="public/images/product/'+product_image[i]+'" height="300" width="100%"></div>';
                }
                slidertext += '</div><a class="carousel-control-prev" href="#product-img-slider" data-slide="prev"><span class="carousel-control-prev-icon" aria-hidden="true"></span><span class="sr-only">Previous</span></a><a class="carousel-control-next" href="#product-img-slider" data-slide="next"><span class="carousel-control-next-icon" aria-hidden="true"></span><span class="sr-only">Next</span></a></div>';
            }
            else {
                slidertext = '<img src="public/images/product/'+product[17]+'" height="300" width="100%">';
            }
        }
        
        $("#combo-header").text('');
        $("table.item-list thead").remove();
        $("table.item-list tbody").remove();
        $("table.product-warehouse-list thead").remove();
        $("table.product-warehouse-list tbody").remove();
        $(".product-variant-warehouse-list thead").remove();
        $(".product-variant-warehouse-list tbody").remove();
        $("#product-warehouse-section").addClass('d-none');
        $("#product-variant-warehouse-section").addClass('d-none');
        if(product[0] == 'combo') {
            $("#combo-header").text('{{trans("file.Combo Products")}}');
            product_list = product[13].split(",");
            qty_list = product[14].split(",");
            price_list = product[15].split(",");
            $(".item-list thead").remove();
            $(".item-list tbody").remove();
            var newHead = $("<thead>");
            var newBody = $("<tbody>");
            var newRow = $("<tr>");
            newRow.append('<th>{{trans("file.product")}}</th><th>{{trans("file.Quantity")}}</th><th>{{trans("file.Price")}}</th>');
            newHead.append(newRow);

            $(product_list).each(function(i) {
                $.get('products/getdata/' + product_list[i], function(data) {
                    var newRow = $("<tr>");
                    var cols = '';
                    cols += '<td>' + data['name'] +' [' + data['code'] + ']</td>';
                    cols += '<td>' + qty_list[i] + '</td>';
                    cols += '<td>' + price_list[i] + '</td>';

                    newRow.append(cols);
                    newBody.append(newRow);
                });
            });

            $("table.item-list").append(newHead);
            $("table.item-list").append(newBody);
        }
        else if(product[0] == 'standard') {
            $.get('products/product_warehouse/' + product[12], function(data) {
                if(data.product_warehouse[0].length != 0) {
                    warehouse = data.product_warehouse[0];
                    qty = data.product_warehouse[1];
                    var newHead = $("<thead>");
                    var newBody = $("<tbody>");
                    var newRow = $("<tr>");
                    newRow.append('<th>{{trans("file.Warehouse")}}</th><th>{{trans("file.Quantity")}}</th>');
                    newHead.append(newRow);
                    $.each(warehouse, function(index){
                        var newRow = $("<tr>");
                        var cols = '';
                        cols += '<td>' + warehouse[index] + '</td>';
                        cols += '<td class="text-center">' + qty[index] + '</td>';

                        newRow.append(cols);
                        newBody.append(newRow);
                        $("table.product-warehouse-list").append(newHead);
                        $("table.product-warehouse-list").append(newBody);
                        $(".product-warehouse-list th").css({ "border": "1px solid #333333", "text-align": "center" });
                        $(".product-warehouse-list td").css({ "border": "1px solid #333333" });
                    });
                    $("#product-warehouse-section").removeClass('d-none');
                }
                if(data.product_variant_warehouse[0].length != 0) {
                    warehouse = data.product_variant_warehouse[0];
                    variant = data.product_variant_warehouse[1];
                    qty = data.product_variant_warehouse[2];
                    var newHead = $("<thead>");
                    var newBody = $("<tbody>");
                    var newRow = $("<tr>");
                    newRow.append('<th>{{trans("file.Warehouse")}}</th><th>{{trans("file.Variant")}}</th><th>{{trans("file.Quantity")}}</th>');
                    newHead.append(newRow);
                    $.each(warehouse, function(index){
                        var newRow = $("<tr>");
                        var cols = '';
                        cols += '<td>' + warehouse[index] + '</td>';
                        cols += '<td>' + variant[index] + '</td>';
                        cols += '<td class="text-center">' + qty[index] + '</td>';

                        newRow.append(cols);
                        newBody.append(newRow);
                        $("table.product-variant-warehouse-list").append(newHead);
                        $("table.product-variant-warehouse-list").append(newBody);
                        $(".product-variant-warehouse-list th").css({ "border": "1px solid #333333", "text-align": "center" });
                        $(".product-variant-warehouse-list td").css({ "border": "1px solid #333333" });
                    });
                    $("#product-variant-warehouse-section").removeClass('d-none');
                }
            });
        }
        
        $('#product-content').html(htmltext);
        $('#slider-content').html(slidertext);
        $('#product-details').modal('show');
        $('#product-img-slider').carousel(0);
    }

    $(document).ready(function() {
        $('#product-data-table').DataTable( {
            responsive: true,
            "processing": true,
            "serverSide": true,
            "ajax":{
                url:"products/product-data",
                data:{
                    all_permission: all_permission
                },
                dataType: "json",
                type:"post"
            },
            "createdRow": function( row, data, dataIndex ) {
                $(row).addClass('product-link');
                $(row).attr('data-product', data['product']);
                $(row).attr('data-imagedata', data['imagedata']);
                $(row).attr('data-history', data['history']);
                $('td', row).css( "border", "1px solid #333333" );

            },
            "columns": [
                {"data": "key", "className": "text-center"},
                {"data": "name"},
                {"data": "code", "className": "text-right"},
                {"data": "brand"},
                {"data": "unit", "className": "text-center"},
                {"data": "qty", "className": "text-right"},
                {"data": "price", "className": "text-right"},
                {"data": "subtotal", "className": "text-right"},
                {"data": "options", "className": "text-right"},
            ],

            'language': {
                'lengthMenu': '_MENU_ {{trans("file.records per page")}}',
                 "info":      '<small>{{trans("file.Showing")}} _START_ - _END_ (_TOTAL_)</small>',
                "search":  '{{trans("file.Search")}}',
                'paginate': {
                        'previous': '<i class="dripicons-chevron-left"></i>',
                        'next': '<i class="dripicons-chevron-right"></i>'
                }
            },
            order:[['2', 'asc']],
            'columnDefs': [
                {
                    "orderable": false,
                    'targets': [0, 3, 5, 6, 7, 8]
                },
                {
                    "visible": false,
                    'targets': []
                },
                {
                    'render': function(data, type, row, meta){
                        if(type === 'display'){
                            data = '<div class="checkbox"><input type="checkbox" class="dt-checkboxes"><label></label></div>';
                        }

                       return data;
                    },
                    'checkboxes': {
                       'selectRow': true,
                       'selectAllRender': '<div class="checkbox"><input type="checkbox" class="dt-checkboxes"><label></label></div>'
                    },
                    'targets': [0]
                }
            ],
            'select': { style: 'multi', selector: 'td:first-child'},
            'lengthMenu': [[10, 25, 50, -1], [10, 25, 50, "All"]],
            dom: '<"row"lfB>rtip',
            buttons: [
                {
                    extend: 'pdf',
                    text: '{{trans("file.PDF")}}',
                    exportOptions: {
                        columns: ':visible:not(.not-exported)',
                        rows: ':visible',
                        stripHtml: false,
                        format: {
                            body: function ( data, row, column, node ) {
                                if (column === 0 && (data.indexOf('<img src=') !== -1)) {
                                    var regex = /<img.*?src=['"](.*?)['"]/;
                                    data = regex.exec(data)[1];                 
                                }
                                if (column === 0 || column === 1 || column === 4 || column === 5 || column === 6) {
                                    return data.replace(/<br>/g, '\n');
                                }
                                return data;
                            }
                        }
                    },
                    customize: function(doc) {
                        for (var i = 1; i < doc.content[1].table.body.length; i++) {
                            if (doc.content[1].table.body[i][0].text.indexOf('<img src=') !== -1) {
                                var imagehtml = doc.content[1].table.body[i][0].text;
                                var regex = /<img.*?src=['"](.*?)['"]/;
                                var src = regex.exec(imagehtml)[1];
                                var tempImage = new Image();
                                tempImage.src = src;
                                var canvas = document.createElement("canvas");
                                canvas.width = tempImage.width;
                                canvas.height = tempImage.height;
                                var ctx = canvas.getContext("2d");
                                ctx.drawImage(tempImage, 0, 0);
                                var imagedata = canvas.toDataURL("image/png");
                                delete doc.content[1].table.body[i][0].text;
                                doc.content[1].table.body[i][0].image = imagedata;
                                doc.content[1].table.body[i][0].fit = [30, 30];
                            }
                        }
                    },
                },
                {
                    extend: 'csv',
                    charset: 'UTF-8',
                    bom: true, 
                    text: '{{trans("file.CSV")}}',
                    exportOptions: {
                        columns: ':visible:not(.not-exported)',
                        rows: ':visible',
                        format: {
                            body: function ( data, row, column, node ) {
                                if (column === 0 && (data.indexOf('<img src=') !== -1)) {
                                    var regex = /<img.*?src=['"](.*?)['"]/;
                                    data = regex.exec(data)[1];                 
                                }
                                if (column === 0 || column === 1 || column === 4 || column === 5 || column === 6) {
                                    return data.replace(/<br>/g, '\n');
                                }
                                return data;
                            }
                        }
                    },
                    footer:true
                },
                {
                    extend: 'print',
                    text: '{{trans("file.Print")}}',
                    messageTop: function(){
                    return `
                        <div> 
                            <div style="display:flex;justify-content: center">
                                <div style="padding-right: 15px"> 
                                    <img src="{{url('public/logo', $general_setting->site_logo)}}" width="65">
                                </div>
                                <div> 
                                    <h4 style="text-align:left;color:red;">{{trans('file.Company name system')}}</h4> 
                                    <p style="text-align:left;color:red;">{{trans('file.Company address system')}}</p> 
                                </div>
                            </div>
                            <div style="text-align:center;">         
                                <h3 style="text-transform: uppercase" class="modal-title text-center container-fluid">{{trans('file.product_list')}}</h3>
                            </div>
                        </div>
                    `;
                    },
                    exportOptions: {
                        columns: ':visible:not(.not-exported)',
                        rows: ':visible',
                        stripHtml: false,
                    },
                    customize: function ( doc ) {
                        $(doc.document.body).find('table td').css('border', '1px solid #333333');
                        $(doc.document.body).find('table th').css({'border': '1px solid #333333', "text-align": "center"});;
                        $(doc.document.body).find('table td:nth-child(4)').css('text-align', 'center');
                        $(doc.document.body).find('table td:nth-child(5), table td:nth-child(6), table td:nth-child(7), table td:nth-child(8)').css('text-align', 'right');
                    },
                },
                {
                    text: '{{trans("file.delete")}}',
                    className: 'buttons-delete',
                    action: function ( e, dt, node, config ) {
                        if(user_verified == '1') {
                            product_id.length = 0;
                            $(':checkbox:checked').each(function(i){
                                if(i){
                                    var product_data = $(this).closest('tr').data('product');
                                    product_id[i-1] = product_data[12];
                                }
                            });
                            if(product_id.length && confirmDelete()) {
                                $.ajax({
                                    type:'POST',
                                    url:'products/deletebyselection',
                                    data:{
                                        productIdArray: product_id
                                    },
                                    success:function(data){
                                        dt.rows({ page: 'current', selected: true }).deselect();
                                        dt.rows({ page: 'current', selected: true }).remove().draw(false);
                                    }
                                });
                            }
                            else if(!product_id.length)
                                alert('No product is selected!');
                        }
                        else
                            alert('This feature is disable for demo!');
                    }
                },
                {
                    extend: 'colvis',
                    text: '{{trans("file.Column visibility")}}',
                    columns: ':gt(0)'
                },
            ],
        } );

        
    } );

    function getHistory (product){
        let id = product[12];
        $('.history-data-table').DataTable({
            "processing": true,
            "serverSide": true,
            "ajax":{
                url:`products/history/${id}`,
                data:{
                    all_permission: all_permission
                },
                dataType: "json",
                type: "get"
            },
            "createdRow": function( row, data, dataIndex ) {
                $('td', row).css( "border", "1px solid #333333" );

            },
            "columns": [
                {"data": "key", "className": "text-center"},
                {"data": "created_at", "className": "text-center"},
                {"data": "inventory_receiving_voucher", "className": "text-center"},
                {"data": "qty", "className": "text-center"},
                {"data": "recieved", "className": "text-center"},
                {"data": "tax", "className": "text-right"},
                {"data": "discount", "className": "text-right"},
                {"data": "total", "className": "text-right"},
            ],
            'language': {
            },
            order:[],
            'columnDefs': [
                {
                    "orderable": false,
                    'targets': [0, 1, 2, 3, 4, 5, 6, 7]
                },
            ],
            'destroy': true,
            "searching": false,
            "info": false,        
            "lengthChange": false,
            'lengthMenu': [[10, 25, 50, -1], [10, 25, 50, "All"]],
            "bPaginate": false,
            "filter": true,
            "iDisplayLength": 50,
        } );
       
    }

    if(all_permission.indexOf("products-delete") == -1)
        $('.buttons-delete').addClass('d-none');

    $('select').selectpicker();

</script>
@endsection

Youez - 2016 - github.com/yon3zu
LinuXploit