Current File : /home/tradevaly/www/resources/views/user/pages/product/analytics.blade.php
@extends('user.ayaan.master')
@push('title','Product Visitor Analytics')
@push('style')
    <link href="{{ asset('/assets/libs/datatables/datatables.min.css') }}" rel="stylesheet" type="text/css" />
@endpush

@section('content')
<div class="container-fluid">
  <div class="row">
    <div class="col-md-12">
      <div class="card">
        <div class="card-header card-header-info card-header-icon">
            <h2>Product History Analytics</h2>
        </div>
        <div class="card-body">
            <div class="d-flex mb-2 align-item-center" >
                <img style="width:100px; border-radius:10%;" src="{{asset('storage/images/admin/product/'.$product->image)}}" alt="image">
            <h4 class="">
                <a target="_blank" href="{{route('product.view',$product->slug)}}">
                    {{$product->title}}
                </a>
            </h2>
            </div>
          <div class="table-responsive">
            <table class="table dat_table">
              <thead>
                <tr>
                  <th class="text-center">#</th>
                  <th>Visitor Name</th>
                  <th>Visitor Email</th>
                  <th>Visitor phone number</th>
                  <th>Company name</th>
                  <th>Time</th>
                  <th>Inquery</th>
                </tr>
              </thead>
              <tbody >
                
              </tbody>
            </table>
          </div>
        </div>
      </div>
  </div>
</div>
</div>
@stop

@section('script')
    <script src="{{ asset('/assets/libs/datatables/datatables.min.js') }}"></script>
    <script src="{{ asset('/assets/libs/jszip/jszip.min.js') }}"></script>
    <script src="{{ asset('/assets/libs/pdfmake/pdfmake.min.js') }}"></script>
    <script>
    $(function () {
        $(document).ready(function () {
            let url =  "{{ route('admin.product.analytics',$product->id) }}";
        
            var table = $('.dat_table').DataTable({
            lengthChange: false,
            processing: true,
            serverSide: true,
            ajax: url,
            dom: 'Bfrtip',
            columns: [
                {data: 'DT_RowIndex', name: 'DT_RowIndex'},
                {data: 'visitor', name: 'visitor'},
                {data: 'email', name: 'email'},
                {data: 'phone', name: 'phone'},
                {data: 'company', name: 'company'},
                {data: 'time', name: 'time'},
                {data: 'action', name: 'action'},
                ],
            buttons: ['copy', 'excel', 'pdf', 'colvis'],
            });
            table.buttons().container().appendTo('#datatable-buttons_wrapper .col-md-6:eq(0)');
          $(".dataTables_length select").addClass('form-select form-select-sm');
        });
    });
</script>
@endsection