@extends('php/teacher/home')
@section('content')

<div class="content-header">
    <div class="container-fluid">
        <div class="row mb-2">
            <div class="col-sm-6">
                
            </div>
            <div class="col-sm-6">
                <ol class="breadcrumb float-sm-right">
                    <li class="breadcrumb-item"><a href="#">Home</a></li>
                    <li class="breadcrumb-item active">Dashboard v1</li>
                </ol>
            </div>
        </div>
    </div>
</div>


<section class="content">
    <div class="container-fluid">
        <div class="row">
            
            <div class="col-md-12">
                <div class="card card-body">
                    
                    <div class="row">
                        <div class="col-md-12">
                            <h5 style="margin: 0px">Daftar Matakuliah</h5>
                            <p>Menampilkan materi perkuliahan keseluruhan</p>
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-md-12">
                            <hr>
                        </div>
                        <div class="col-md-12">
                            <div style="display: flex; flex-wrap: wrap; gap: 20px; justify-content: start; ">
                            <?php 
                                    $sql = DB::select("SELECT * FROM classrooms a left join master_materi b on a.id_materi = b.id_meteri 
                                    WHERE a.owner = '$id_user'");
                                    if(!empty($sql)):
                                        foreach($sql as $materi):
                            ?>
                                <div class="card p-0" style="width: 25%; height: 400px; margin-left: 55px; box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1); margin-top: 20px;">
                                    <img src="{{ asset('./images/cards/'.$materi->image) }}" class="card-img-top" style="width: 100%; height: 200px; object-fit: cover;">
                                    <div class="card-body d-flex flex-column">
                                        <h5 class="card-titles">{{ $materi->materi }}</h5>
                                        <div class="row align-items-start">
                                            <div class="col-1">
                                                <img src="{{ asset('./images/book.png') }}" style="width: 13px; height: 16px;">
                                            </div>
                                            <div class="col">
                                                <span>{{ $materi->topik }} learning topics</span>
                                            </div>
                                        </div>
                                        <div class="row align-items-start">
                                            <div class="col-1">
                                                <i class="fa fa-user" aria-hidden="true"></i>
                                            </div>
                                            <div class="col">
                                                <?php 
                                                    $sql_kelas = DB::select("SElECt count(*) as total from php_submits_submission where id_materi = '$materi->id_meteri' group by email");
                                                    $row_count = count($sql_kelas);
                                                    echo $row_count;  
                                                ?>
                                                <span>Mahasiswa</span>
                                            </div>
                                        </div>
                                        <div style="margin-top: 10px;">
                                            <a href="{{ url('php/teacher/crooms/detail/'.$materi->id_meteri) }}" class="btn btn-primary">Detail</a>
                                        </div>
                                    </div>
                                </div>
                            <?php endforeach; 
                                endif; ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
    
    <div class="modal fade" id="modal-xl">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">

                <form action="http://127.0.0.1:8000/android23/topic/add" method="post" enctype="multipart/form-data">

                <input type="hidden" name="_token" value="4XYtt4wvnvqqPikgmbiGtTvYLEWbKM9w6bw1B4J8" autocomplete="off">                                    <div class="modal-body">
                    <h4 style="margin: 0px">Tambah Topik Android</h4>
                    <p>Isi form dibawah ini untuk menambahkan topik android</p>

                    <div class="form-group">
                        <label for="">Judul Topik</label>
                        <input type="text" name="title" class="form-control" placeholder="Masukkan judul topik . . .">
                        <small>Berisi judul topik materi android</small>
                    </div>
                    
                    <div class="row">
                        <div class="col-md-6">
                            <div class="form-group">
                                <label for="">Folder Path</label>
                                <input type="text" name="folder_path" class="form-control" placeholder="Direktori file . . .">
                                <small>Berisi direktori topik materi android</small>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label for="">Picture (Opsional)</label>
                                <input type="file" name="picturePath">
                                <small>Berisi foto materi android</small>
                            </div>
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label for="">Status Publikasi</label>
                        <select name="status" class="form-control" id="">
                            <option value="draft">Draft</option>
                            <option value="publish">Publikasi</option>
                        </select>
                        <small>Status materi android</small>
                    </div>
                    
                    <div class="form-group">
                        <label for="">Deskripsi</label>
                        <textarea name="description" class="form-control" placeholder="Masukkan deskripsi materi . . ." data-gramm="false" wt-ignore-input="true"></textarea>
                        <small>Deskripsi materi android</small>
                    </div>

                </div>
                <div class="modal-footer justify-content-between">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    <button type="submit" class="btn btn-primary">Tambahkan</button>
                </div>
                </form>
            </div>
        </div>
    </div>

    <!-- modal edit -->
    <div class="modal fade" id="modal-update-0">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">

                <form action="http://127.0.0.1:8000/android23/topic/update/7" method="post" enctype="multipart/form-data">

                <input type="hidden" name="_token" value="4XYtt4wvnvqqPikgmbiGtTvYLEWbKM9w6bw1B4J8" autocomplete="off">                                                        <div class="modal-body">
                    <h4 style="margin: 0px">Update Topik Android</h4>
                    <p>Isi form dibawah ini untuk menambahkan topik android</p>

                    <div class="form-group">
                        <label for="">Judul Topik</label>
                        <input type="text" name="title" class="form-control" value="A1:Java - Basic UI Java Edition" placeholder="Masukkan judul topik . . .">
                        <small>Berisi judul topik materi android</small>
                    </div>
                    
                    <div class="row">
                        <div class="col-md-6">
                            <div class="form-group">
                                <label for="">Folder Path</label>
                                <input type="text" name="folder_path" value="A1_BASIC_UI" class="form-control" placeholder="Direktori file . . .">
                                <small>Berisi direktori topik materi android</small>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label for="">Picture (Opsional)</label>
                                <input type="file" name="picturePath">
                                <small>Berisi foto materi android</small>
                            </div>
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label for="">Status Publikasi</label>
                        <select name="status" class="form-control" id="">
                            <option value="draft" selected="selected">Draft</option>
                            <option value="publish">Publikasi</option>
                        </select>
                        <small>Status materi android</small>
                    </div>
                    
                    <div class="form-group">
                        <label for="">Deskripsi</label>
                        <textarea name="description" class="form-control" placeholder="Masukkan deskripsi materi . . ." data-gramm="false" wt-ignore-input="true"></textarea>
                        <small>Deskripsi materi android</small>
                    </div>

                </div>
                <div class="modal-footer justify-content-between">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    <button type="submit" class="btn btn-primary">Tambahkan</button>
                </div>
                </form>
            </div>
        </div>
    </div>

</section>

@endsection
