@extends('layouts.Layout')

@section('content')
 <div class="col-md-12">
  <div class="card">
      <div class="header">
         <h3>Denah Ruangan Sekolah</h3>
      </div>
        <div class="panel-body">
          @if(Session::has('alert-success'))
              <div class="alert alert-success">
                    {{ Session::get('alert-success') }}
                </div>
          @endif
          <div class="tab-content">
          <div class="tab-pane" id="tab1">
              <center><img class="img" src="{{asset('img/Denahv1.jpg')}}" /></center>
          </div>
          </div>
        <div class="content table-responsive table-full-width" >
          <button class="btn btn-info pull-left btn-sm"><a href="#tab1" data-toggle="tab"><span class="glyphicon glyphicon-check"></span> Lihat Denah</a></button>
          <button class="tambah-modal btn btn-info pull-right btn-sm"><span class="glyphicon glyphicon-plus"></span> Tambah Data</button><br><br>
          <table class="table table-striped" id="table">
            <tr>
              <th>ID</th>
              <th>Kode</th>
              <th>Keterangan</th>
              <th>Action</th>
            </tr>
            @foreach($ruang as $rua)
            <tr class="item{{$rua->id}}">
              <td>{{$rua->id}}</td>
              <td>{{$rua->kode}}</td>
              <td>{{$rua->keterangan}}</td>
              <td>
                <button class="ubah-modal btn btn-info btn-sm" data-id="{{$rua->id}}" data-kode="{{$rua->kode}}" data-keterangan="{{$rua->keterangan}}"><span class="glyphicon glyphicon-edit"></span> Ubah</button>
                <button class="hapus-modal btn btn-danger btn-sm" data-id="{{$rua->id}}"><span class="glyphicon glyphicon-trash"></span> Delete</button>
              </td>
            </tr>
            @endforeach
          </table>
          
        </div>
      </div>
    </div>
  </div>

@endsection
          <div class="modal fade bs-example-modal-sm1" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
              <div class="modal-dialog modal-sm" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                      <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                      <h4 class="modal-title">Tambah Data</h4>
                    </div>
                    <div class="modal-body">
                      <div class="form-group">
                        {{ csrf_field() }}
                        <input type="text" name="kode" id="kode" class="form-control" placeholder="Kode">
                      </div>
                      <div class="form-group">
                        <input type="text" name="keterangan" id="keterangan" class="form-control" placeholder="Keterangan">
                      </div>
                      <div class="form-group" align="right">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                        <button type="button" id="addruang" class="btn btn-primary" data-dismiss="modal">Simpan</button>
                      </div>
                    </div>
                </div>
              </div>
          </div>
          <!-- Edit modal -->
          <div class="modal fade bs-example-modal-sm2" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
              <div class="modal-dialog modal-sm" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                      <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                      <h4 class="modal-title">Ubah Data</h4>
                    </div>
                    <div class="modal-body">
                      <div class="form-group">
                        {{ csrf_field() }}
                        <input type="hidden" name="id" id="id-edit">
                        <input type="text" name="kode-edit" id="kode-edit" class="form-control" placeholder="Kode">
                      </div>
                      <div class="form-group">
                        <input type="text" name="keterangan-edit" id="keterangan-edit" class="form-control" placeholder="Keterangan">
                      </div>
                      <div class="form-group" align="right">
                        <button type="button" id="Ubah" class="btn btn-primary" data-dismiss="modal">Ubah</button>
                      </div>
                    </div>
                </div>
              </div>
          </div>

          <!-- Delete modal -->
          <div class="modal fade bs-example-modal-sm3" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
              <div class="modal-dialog modal-sm" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                      <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                      <h4 class="modal-title">Delete Data</h4>
                    </div>
                    <div class="modal-body">
                      <div class="form-group">
                        {{ csrf_field() }}
                        <input type="hidden" name="id-delete" id="id-delete">
                        <p>Yakin Ingin Menghapus Data? </p>
                      </div>
                      <div class="form-group" align="right">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                        <button type="button" id="delete" class="btn btn-danger" data-dismiss="modal">Delete</button>
                      </div>
                    </div>
                </div>
              </div>
          </div>
          
