@extends('admin.layouts.main', [
    'scripts' => [
        path_asset('path.backoffice.js_path') . '/view/form/form-responses.js'
    ]
])

@section('content')
    <h1>{{!empty($formName) ? $formName : ""}} Responses</h1>
    <div id="form-responses">
        <div class="list-filters-container">
            <label for="" class="list-filters-label">Filters:</label>
            <div class="list-filters">
                <div class="list-filter">
                    @php
                        $formEmpty = [
                            0 => 'Filter by Form',
                        ];
                        $formsArray = $formEmpty + $forms;
                    @endphp
                    {!! Form::select('forms_filter', $formsArray, null, array(
                        'id' => 'forms_id_input',
                        'class' => 'form-control' )) !!}
                </div>
                <button type="button" data-toggle="tooltip" class="btn btn-default command-export list-export-btn" title="Export to Excel">
                    <span class="icon glyphicon glyphicon-export"></span>
                </button>
            </div>
        </div>
        <table id="grid" class="table table-condensed table-hover table-striped">
            <thead>
                <tr>
                    <th data-column-id="id" data-type="numeric" data-sortable="true" data-identifier="true">ID</th>
                    <th data-column-id="form" data-formatter="form" data-sortable="false">Form Name</th>
                    <th data-column-id="created_at" data-formatter="date" data-order="asc">Submit Date</th>
                    <th data-column-id="status" data-formatter="status" data-sortable="false">Status</th>
                    <th data-column-id="commands" data-formatter="commands" data-sortable="false">{{ trans('backend.actions') }}</th>
                </tr>
            </thead>
        </table>
    </div>
    <script>
        $(function() {
            var manageFormResponsesView = new Eae.View.BackendFormResponsesList({
                el : $('#form-responses'),
                userId : {{ $loggedUser->id }},
                formId : {{ !empty($formId) ? intval($formId) : 0 }},
            });
        });
    </script>
@stop
