<nav class="navbar navbar-expand-lg navbar-dark bg-cdark rounded">
    <div class="container-fluid">
        <button class="navbar-toggler collapsed" type="button" data-toggle="collapse"
            data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse mb-" id="bs-example-navbar-collapse-1">
            <form class="navbar-form navbar-left" style="width: 100%;" id="form-temario">
                <div class="row">
                    {{ $existe = '' }}
                    {{ $existe2 = '' }}
                    <div class="col-md-4 col-sm-12">
                        @if (array_key_exists('clave', $data))
                            @php
                                $existe = $data['clave'];
                            @endphp
                        @endif
                        <input type="text" id="f_clave" name="f_clave" class="form-control form-control-sm"
                            placeholder="Clave" value="{{ $existe }}">
                    </div>
                    <div class="col-md-4 col-sm-12">
                        <select name="f_materia" id="f_materia" class="form-control form-control-sm">
                            <option value>Materia</option>
                            @foreach ($mat as $m)
                                @php
                                    $s = '';
                                @endphp
                                @if (array_key_exists('materia', $data))
                                    @if ($data['materia'] == $m->cve_mat)
                                        @php
                                            $s = 'selected';
                                            $existe2 = $m->cve_mat;
                                        @endphp
                                    @endif
                                @endif
                                <option value="{{ $m->cve_mat }}" {{ $s }}>
                                    {{ $m->nombre_mat }}
                                </option>
                            @endforeach
                        </select>
                    </div>
                    <div class="col-md-4 col-sm-12 text-center">
                        <button type="button" class="btn btn-sm btn-info" form="form-temario" data-toggle="tooltip"
                            data-placement="top" title="" data-original-title="Buscar"
                            onclick="filtro_temario(this.form)"><i class="fa fa-search"></i></button>
                        <button type="button" class="btn btn-sm btn-danger" form="form-temario" data-toggle="tooltip"
                            data-placement="top" title="" data-original-title="Descargar PDF"
                            onclick="(this.form)"><i class="fa fa-file-pdf-o"></i></button>
                        <a href="/exportarTemarioExcel?materia={{ $existe2 }}&clave={{ $existe }}">
                            <button type="button" class="btn btn-sm btn-success" data-toggle="tooltip"
                                data-placement="top" title="" data-original-title="Descargar XLSX"><i
                                    class="fa fa-file-excel-o"></i></button>
                        </a>
                        <button type="button" class="btn btn-sm btn-light" form="form-temario" data-toggle="tooltip"
                            data-placement="top" title="" data-original-title="Limpiar"
                            onclick="limpiar_temario()"><i class="fa fa-undo"></i></button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</nav>
