@extends('layouts.app')

@section('title', 'Buat Pengajuan P1')

@section('content')
<div class="card">
    <div class="card-header"><h3 class="card-title">Form Pengajuan P1</h3></div>
    <div class="card-body">
        <form action="{{ route('p1.pengajuan.store') }}" method="POST" enctype="multipart/form-data">
            @csrf
            @if(auth()->user()->role === 'mahasiswa')
                <div class="form-group row">
                    <label class="col-sm-2 col-form-label">Mahasiswa</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" value="{{ auth()->user()->nim }} - {{ auth()->user()->name }}" readonly>
                        <input type="hidden" name="nim" value="{{ auth()->user()->nim }}">
                    </div>
                </div>
            @else
                <div class="form-group row">
                    <label class="col-sm-2 col-form-label">Mahasiswa</label>
                    <div class="col-sm-10">
                        <select name="nim" class="form-control" required>
                            <option value="">-- Pilih Mahasiswa --</option>
                            @foreach($mahasiswa as $m)
                            <option value="{{ $m->nim }}">{{ $m->nim }} - {{ $m->nama }}</option>
                            @endforeach
                        </select>
                    </div>
                </div>
            @endif
            <div class="form-group row">
                <label class="col-sm-3 col-form-label">Disposisi Ketua Bagian</label>
                <div class="col-sm-9"><input type="file" name="file_disposisi" class="form-control" required></div>
            </div>
            <div class="form-group row">
                <label class="col-sm-3 col-form-label">Transkrip Nilai</label>
                <div class="col-sm-9"><input type="file" name="file_transkrip" class="form-control" required></div>
            </div>
            <div class="form-group row">
                <label class="col-sm-3 col-form-label">Ijazah Terakhir</label>
                <div class="col-sm-9"><input type="file" name="file_ijazah" class="form-control" required></div>
            </div>
            <div class="form-group row">
                <label class="col-sm-3 col-form-label">KHS Semester 1-7</label>
                <div class="col-sm-9"><input type="file" name="file_khs" class="form-control" required></div>
            </div>
            <div class="form-group row">
                <label class="col-sm-3 col-form-label">Sertifikat PKK Maba</label>
                <div class="col-sm-9"><input type="file" name="file_pkk" class="form-control" required></div>
            </div>
            <button type="submit" class="btn btn-primary">Kirim Pengajuan</button>
            <a href="{{ route('p1.pengajuan.index') }}" class="btn btn-secondary">Batal</a>
        </form>
    </div>
</div>
@endsection
