index.blade.php 12 KB
Newer Older
Siti Aisah committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
@extends('layouts.app')
@section('title','Data Kegiatan')
@section('content')
    <section class="section">
        <div class="section-header">
            <h1>Data Kegiatan</h1>
            <div class="section-header-breadcrumb">
                <div class="breadcrumb-item">
                    <a href="">Home</a>
                </div>
                <div class="breadcrumb-item active">Data Kegiatan</div>
            </div>
        </div>

        <div class="section-body">
            <div class="row mt-4 active" id="tab-semuapengajuan" data-tab-group="mygroup-tab">
                <div class="col-12">
                <div class="card">
                    <div class="card-body">
                        <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#add-modal">Tambah Data</button>
                        <br>
                        <div class="clearfix mb-3"></div>
                        <div class="table-responsive">
                            <table class="table table-striped dataTable" id="table-daftar-kegiatan" role="grid">
                                <thead>
                                    <tr style="text-align: center;">
                                    <th>No.</th>
                                    <th>Kegiatan</th>
                                    <th>Harga</th>
                                    <th>Aksi</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @php
                                        $no = 1;
                                    @endphp
                                    @foreach($kegiatan as $tr)
                                        <tr style="text-align: center;">
                                            <td>{{ $no }}</td>
                                            <td>{{ $tr->nama}}</td>
                                            <td>{{ $tr->harga}}</td>
                                            <td>
                                                <button type="button" class="btn btn-info" data-toggle="modal" data-target="#update-modal{{$tr->id}}">Ubah</button>
                                                <button type="button" class="btn btn-danger" data-toggle="modal" data-target="#delete-modal{{$tr->id}}">Hapus</button>

                                                {{-- Modal Add Workshop --}}
                                                <div class="modal fade" id="add-modal" data-backdrop="false" style="background-color: rgba(0, 0, 0, 0.5);">
                                                    <div class="modal-dialog">
                                                        <div class="modal-content">
                                                            <div class="modal-header">
                                                                <h4 class="modal-title bold">Tambah Kegiatan Baru</h4>
                                                            </div>

                                                            <form method="POST" action="{{ route('admin.create_kegiatan', ['id' => $tr->id ]) }}" enctype="multipart/form-data">
                                                                @csrf
                                                                    <div class="modal-body">
                                                                        <div class="form-group" style="text-align: left">
                                                                            <label for="nama">Nama Kegiatan</label>
                                                                            <input type="text" class="form-control" id="nama" name="nama" required @if($errors->has('nama')) has-error @endif>
                                                                            @if($errors->has('nama'))
                                                                                <label id="login-error" class="error" for="nama" style="color: red">{{$errors->first('nama')}}</label>
                                                                            @endif
                                                                        </div>
                                                                        <div class="form-group" style="text-align: left">
                                                                            <label for="harga">Harga</label>
                                                                            <input type="number" class="form-control" id="harga" name="harga" required @if($errors->has('harga')) has-error @endif>
                                                                            @if($errors->has('harga'))
                                                                                <label id="login-error" class="error" for="harga" style="color: red">{{$errors->first('harga')}}</label>
                                                                            @endif
                                                                        </div>
                                                                    </div>
                                                                    <div class="modal-footer">
                                                                        <button type="submit" class="btn btn-primary ml-1">Simpan</button>
                                                                        <button type="button" class="btn btn-light-secondary" data-dismiss="modal">Batal</button>
                                                                    </div>
                                                            </form>
                                                        </div>
                                                    </div>
                                                </div>
                                                {{-- End of Modal Add Workshop --}}

                                                {{-- Modal Update Workshop --}}
                                                <div class="modal fade" id="update-modal{{$tr->id}}" data-backdrop="false" style="background-color: rgba(0, 0, 0, 0.5);">
                                                    <div class="modal-dialog">
                                                        <div class="modal-content">
                                                            <div class="modal-header">
                                                                <h4 class="modal-title bold">Ubah Kegiatan</h4>
                                                            </div>

                                                            <form method="POST" action="{{ route('admin.update_kegiatan', ['id' => $tr->id ]) }}" enctype="multipart/form-data">
                                                                @csrf
                                                                @method('put')
                                                                <div class="modal-body">
                                                                    <div class="form-group" style="text-align: left">
                                                                        <label for="nama">Nama Kegiatan</label>
                                                                        <input type="text" class="form-control" id="nama" name="nama" value="{{ $tr->nama }}" required @if($errors->has('nama')) has-error @endif>
                                                                        @if($errors->has('nama'))
                                                                            <label id="login-error" class="error" for="nama" style="color: red">{{$errors->first('nama')}}</label>
                                                                        @endif
                                                                    </div>
                                                                    <div class="form-group" style="text-align: left">
                                                                        <label for="harga">Harga</label>
                                                                        <input type="text" class="form-control" id="harga" name="harga" value="{{ $tr->harga }}" required @if($errors->has('harga')) has-error @endif>
                                                                        @if($errors->has('harga'))
                                                                            <label id="login-error" class="error" for="harga" style="color: red">{{$errors->first('harga')}}</label>
                                                                        @endif
                                                                    </div>
                                                                </div>
                                                                <div class="modal-footer">
                                                                    <button type="submit" class="btn btn-primary ml-1">Simpan</button>
                                                                    <button type="button" class="btn btn-light-secondary" data-dismiss="modal">Batal</button>
                                                                </div>
                                                            </form>
                                                        </div>
                                                    </div>
                                                </div>
                                                {{-- End of Modal Update Workshop --}}

                                                {{-- Modal Delete Workshop --}}
                                                <div class="modal fade" id="delete-modal{{$tr->id}}" data-backdrop="false" style="background-color: rgba(0, 0, 0, 0.5); padding-top:15%;">
                                                    <div class="modal-dialog">
                                                        <div class="modal-content" style="padding-top : 10px">
                                                            <form method="GET" action="{{ route('admin.delete_kegiatan', ['id' => $tr->id ]) }}" enctype="multipart/form-data">
                                                                @csrf
                                                                <div class="modal-body" @if ($errors->has('nama')) has-error @endif>
                                                                    <div class="form-group" style="text-align: center">
                                                                        <h5 class="address-title text-center mb-1" id="addNewAddressTitle">Apakah Anda yakin akan menghapus data ini?</h5>
                                                                    </div>
                                                                    <button type="submit" class="btn btn-primary ml-1">Hapus</button>
                                                                    <button type="button" class="btn btn-light-secondary" data-dismiss="modal">Batal</button>
                                                                </div>
                                                            </form>
                                                        </div>
                                                    </div>
                                                </div>
                                                {{-- End of Modal Delete Workshop --}}
                                            </td>
                                        </tr>
                                        @php
                                            $no++;
                                        @endphp
                                    @endforeach
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
@endsection

@push('js')
    <script>
        $(document).ready(function() {
            $("#table-daftar-kegiatan").dataTable();
        });
    </script>
@endpush