@extends('layouts.app')

@section('content')
    <h3 class="page-title">Test Data</h3>

    <p>
        <a href="{{ route('testdata.create') }}" class="btn btn-success">@lang('quickadmin.add_new')</a>
        <a href="{{ URL::to('/testdata/pdf') }}">Export PDF</a>
    </p>

    <div class="panel panel-default">
        <div class="panel-heading">
            @lang('quickadmin.list')
        </div>

        <div class="panel-body">
            <table id="table1" class="table table-bordered table-striped {{ count($tests) > 0 ? 'datatable' : '' }} dt-select">
                <thead>
                    <tr>
                        <th style="text-align:center;"><input type="checkbox" id="select-all" /></th>
                        {{--}}<th>@lang('quickadmin.testdata.fields.topic')</th>
                        <th>@lang('quickadmin.testdata.fields.testdata-text')</th>--}}
                        <th>ID</th>
                        <th>Name</th>
                        <th>Email</th>
                        <th>Created At</th>
                        <th>Updated At</th>
                        <th>Actions</th>
                        {{--<th>&nbsp;</th>--}}
                    </tr>
                </thead>
                
                <tbody>
                    @if (count($tests) > 0)
                        @foreach ($tests as $test)
                            <tr data-entry-id="{{ $test->id }}">

                                {{--<td>{{ $test->topic->title or '' }}</td>--}}
                                <td>{!! $test->testdata_text !!}</td>
                                <td>{{ $test->id or '' }}</td>
                                <td>{{ $test->name or '' }}</td>
                                <td>{{ $test->email or '' }}</td>
                                <td>{{ $test->created_at or '' }}</td>
                                <td>{{ $test->updated_at or '' }}</td>
                                <td>
                                    <a href="{{ route('testdata.show',[$test->id]) }}" class="btn btn-xs btn-primary">View</a>
                                    <a href="{{ route('testdata.edit',[$test->id]) }}" class="btn btn-xs btn-info">Edit</a>
                                </td>
                                    {{--
                                    {!! Form::open(array(
                                        'style' => 'display: inline-block;',
                                        'method' => 'DELETE',
                                        'onsubmit' => "return confirm('".trans("quickadmin.are_you_sure")."');",
                                        'route' => ['testdata.destroy', $test->id])) !!}
                                    {!! Form::submit(trans('quickadmin.delete'), array('class' => 'btn btn-xs btn-danger')) !!}
                                    {!! Form::close() !!}
                                </td>--}}
                            </tr>
                        @endforeach
                    @else
                        {{--<tr>
                            <td colspan="7">@lang('quickadmin.no_entries_in_table')</td>
                        </tr>--}}
                    @endif
                </tbody>
            </table>
        </div>
    </div>
@stop

@section('javascript')
    <script>
        $( document ).ready(function() {
            $('#datetimepicker1').datetimepicker({
                 format: 'MM/DD/YYYY'
            });
        });

        $('#btn_test').on('click', function () {
            alert('ready');
        });
        /*$('#comm_rate').on('keyup keydown change', function () {
            var nsp = $('#net_selling_price').val();
            var comm_rate = $('#comm_rate').val();

            var comm_amt = (nsp * comm_rate) / 100;

            $('#comm_amount').val(comm_amt.toFixed(2));
        });*/
    </script>
@endsection