@extends('dosen.layouts.DS')

@section('content')
    <div class="container">
        <div class="row">
            <div class="col-lg-12 d-flex flex-column">
                <div class="row flex-grow">
                    <div class="col-7 grid-margin stretch-card">

                    </div>

                    {{-- @if ($proposal->isEmpty()) --}}
                    <div class="col-md-5 grid-margin stretch-card"
                        style="box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);">

                    </div>
                    {{-- @else

        @endif --}}
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-8 d-flex flex-column">
            <div class="row flex-grow">
                <div class="col-12 grid-margin stretch-card">
                    <div class="card"
                        style="box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);">
                        <div class="card-body">
                            <div class="d-sm-flex justify-content-between align-items-start">
                                <div>
                                    <h4 class="card-title card-title-dash">Data Laporan Kegiatan Penelitian</h4>
                                    <p> Judul : {{ $judul->judul }} </p> 

                                </div>
                            </div>
                            <br>
                            <div class="d-sm-flex align-items-center mt-1 justify-content-between">
                            </div>
                            @if (Session::has('pesan2'))
                                <div class="alert alert-danger alert-dismissible">
                                    <a href="#" class="close" data-dismiss="alert">&times;</a>
                                    {{ Session::get('pesan2') }}
                                </div>
                            @endif
                            @if (Session::has('pesan1'))
                            <div class="alert alert-success alert-dismissible">
                                <a href="#" class="close" data-dismiss="alert">&times;</a>
                                {{ Session::get('pesan1') }}
                            </div>
                        @endif

                            @if ($proposal->isEmpty())
                                <h4>Anda Belum Mengupload Berkas</h4>
                            @else
                                <table class="table table-light">
                                    <thead class="thead-light">
                                        <tr>
                                            <th>No</th>
                                            <th>Laporan</th>
                                            <th>File / Link Publikasi</th>
                                            <th>Status</th>
                                            <th>Aksi</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        @foreach ($proposal as $row)
                                            <tr>
                                                <td>{{ $loop->iteration }}</td>
                                                <td>{{ $row->jenispenelitian->nama_jenis }}</td>
                                                @if (isset($row->file))
                                                <td><a href="{{ \Storage::url($row->file) }}" target="_blank">Download
                                                    File</a></td>
                                                @elseif (isset($row->link_publikasi))
                                                <td><a href="{{ $row->link_publikasi }}" target="_blank">Lihat Publikasi</a></td>
                                                @endif
                                                
                                                <td>
                                                    {{ $row->status }}
                                                    {{-- @if ($row->statusjudul_id == '1')
                                                    <small
                                                        style="color: orange;">{{ $row->statusjudul->status }}</small>
                                                @else
                                                    <small
                                                        style="color: rgb(10, 252, 1);">{{ $row->statusjudul->status }}</small>
                                                @endif --}}
                                                </td>
                                                <td>


                                                    {{-- <a href="#" class="btn btn-sm btn-primary"
                                                        onclick="return confirm('Anda yakin?')"><i
                                                            class="mdi mdi-delete"></i></a> --}}
                                                    <a href="{{ url('dosen/hapus-laporan/' . $row->id, []) }}"
                                                                class="btn btn-sm btn-primary"
                                                                onclick="return confirm('Anda yakin?')"><i
                                                                    class="mdi mdi-delete"></i></a>
                                                </td>
                                            </tr>
                                        @endforeach
                                    </tbody>
                                </table>
                            @endif

                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-lg-4 d-flex flex-column">
            <div class="row flex-grow">
                <div class="col-12 grid-margin stretch-card">
                    <div class="card"
                        style="box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);">
                        <div class="card-body">
                            <div class="d-sm-flex justify-content-between align-items-start">
                                <div>
                                    <h4 class="card-title card-title-dash">Laporan Kegiatan Penelitian</h4>
                                </div>
                            </div>
                            <br>

                            {!! Form::model($objek, ['action' => $action, 'method' => $method, 'files' => true]) !!}

                            <div class="form-group">
                                <label for="jenispenelitian_id">Jenis Kegiatan Penelitian</label>
                                {{ Form::select('jenispenelitian_id', \App\Jenispenelitian::pluck('nama_jenis', 'id'), null, ['class' => 'form-control']) }}
                                {{-- {!! Form::textarea('alamat', ['label' => 'Alamat Penerima']) !!} --}}
                            </div>

                            <div class="form-group">
                                <div class="row">
                                    <div class="col-lg-5">
                                        <label for="link_publikasi">Link Publikasi</label>
                                        {!! Form::text('link_publikasi', null, ['class' => 'form-control']) !!}
                                        {{-- {!! Form::textarea('alamat', ['label' => 'Alamat Penerima']) !!} --}}
                                    </div>
                                    <div class="col-lg-7">
                                        <label for="file">File (Format: pdf, word)</label>
                                        {{ Form::file('file', ['class' => 'form-control']) }}
                                        <span class="text-danger">{{ $errors->first('file') }}</span>
                                    </div>
                                </div>
                            </div>

                            {{-- <div class="form-group">
                                <label for="waktu">Waktu Penelitian (Jam/Minggu)</label>
                                {{ Form::select(
                                        'waktu',
                                        [
                                            '1' => '1',
                                            '2' => '2',
                                            '3' => '3',
                                            '4' => '4',
                                            '5' => '5',
                                            '6' => '6',
                                            '7' => '7',
                                            '8' => '8',
                                        ],
                                        null,
                                        ['class' => 'form-control'],
                                    ) }}
                                <span class="text-danger">{{ $errors->first('file') }}</span>
                            </div> --}}

                            {{-- <a href="#" class="btn btn-primary"> Simpan</a> --}}

                            {!! Form::submit('Simpan', ['class' => 'btn btn-primary']) !!}
                            {!! Form::close() !!}

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>


@endsection
