program dan basis data ekosistem
This commit is contained in:
@@ -0,0 +1,155 @@
|
||||
@extends('layout.main')
|
||||
|
||||
@section('content')
|
||||
<div class="container-xxl flex-grow-1 container-p-y">
|
||||
<div class="card">
|
||||
<div class="card-body border-bottom">
|
||||
<form method="GET" action="{{ route('tabel.index') }}" class="d-flex justify-content-between align-items-center row gap-3 gap-md-0">
|
||||
<div class="col-md-auto">
|
||||
<div class="d-flex align-items-center">
|
||||
<label class="me-2 text-nowrap">Show</label>
|
||||
<select name="per_page" class="form-select form-select-sm w-auto" onchange="this.form.submit()">
|
||||
<option value="10" {{ request('per_page') == 10 ? 'selected' : '' }}>10</option>
|
||||
<option value="25" {{ request('per_page') == 25 ? 'selected' : '' }}>25</option>
|
||||
<option value="50" {{ request('per_page') == 50 ? 'selected' : '' }}>50</option>
|
||||
</select>
|
||||
<label class="ms-2 text-nowrap">entries</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-auto d-flex gap-2">
|
||||
<div class="input-group input-group-sm w-auto">
|
||||
<input type="text" name="search" class="form-control" placeholder="Cari Nama Tabel..." value="{{ request('search') }}">
|
||||
<button type="submit" class="btn btn-outline-primary"><i class="ti tabler-search"></i></button>
|
||||
</div>
|
||||
<a href="{{ route('tabel.create') }}" class="btn btn-sm btn-primary">
|
||||
<i class="ti tabler-plus me-1"></i> Tambah
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive text-nowrap">
|
||||
<table class="table table-hover">
|
||||
<thead class="border-top">
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Nama Tabel</th>
|
||||
<th>Label</th>
|
||||
<th>Menu</th>
|
||||
<th>Kelompok</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse($tabel as $index => $tbl)
|
||||
<tr>
|
||||
<td>{{ $loop->iteration }}</td>
|
||||
<td><span class="text-heading">{{ $tbl->tabel }}</span></td>
|
||||
<td><span class="text-muted">{{ $tbl->label }}</span></td>
|
||||
<td><span class="text-muted">{{ $tbl->menu }}</span></td>
|
||||
<td><span class="text-muted">{{ $tbl->group?->group }}</span></td>
|
||||
<td>
|
||||
<div class="d-flex align-items-center">
|
||||
@if (!$loop->first)
|
||||
<button type="button"
|
||||
class="btn btn-icon btn-text-secondary move-up"
|
||||
data-id="{{ $tbl->id }}">
|
||||
<i class="ti tabler-arrow-up"></i>
|
||||
</button>
|
||||
@endif
|
||||
@if (!$loop->last)
|
||||
<button type="button"
|
||||
class="btn btn-icon btn-text-secondary move-down"
|
||||
data-id="{{ $tbl->id }}">
|
||||
<i class="ti tabler-arrow-down"></i>
|
||||
</button>
|
||||
@endif
|
||||
<a href="{{ route('tabel.edit', $tbl->id) }}" class="btn btn-icon btn-text-secondary rounded-pill edit-record"><i class="ti tabler-edit ti-md"></i></a>
|
||||
<a href="javascript:;" class="btn btn-icon btn-text-secondary rounded-pill delete-record" data-id="{{ $tbl->id }}" data-nama="{{ $tbl->nama }}"><i class="ti tabler-trash ti-md"></i></a>
|
||||
<a href="{{ route('tabel.show', $tbl->id) }}" class="btn btn-icon btn-text-secondary rounded-pill view-record"><i class="ti tabler-eye ti-md"></i></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="6" class="text-center py-4">Tidak ada data ditemukan.</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="card-footer d-flex justify-content-center justify-content-md-end border-top">
|
||||
{{ $tabel->appends(request()->query())->links('pagination::bootstrap-5') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$(".move-up").click(function (e) {
|
||||
e.preventDefault();
|
||||
let id = $(this).data('id');
|
||||
|
||||
$.post("{{ route('tabel.move-up', ':id') }}".replace(':id', id), {
|
||||
_token: '{{ csrf_token() }}',
|
||||
_method: 'PUT'
|
||||
}, function (res) {
|
||||
if (res.status === 'success') {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(".move-down").click(function (e) {
|
||||
e.preventDefault();
|
||||
let id = $(this).data('id');
|
||||
|
||||
$.post("{{ route('tabel.move-down', ':id') }}".replace(':id', id), {
|
||||
_token: '{{ csrf_token() }}',
|
||||
_method: 'PUT'
|
||||
}, function (res) {
|
||||
if (res.status === 'success') {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(".delete-record").click(function (e) {
|
||||
e.preventDefault();
|
||||
const id = $(this).data('id');
|
||||
const name = $(this).data('nama');
|
||||
|
||||
Swal.fire({
|
||||
title: 'Hapus?',
|
||||
text: `Kolom ${name} akan dihapus!`,
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Ya, Hapus!',
|
||||
customClass: { confirmButton: 'btn btn-danger me-3', cancelButton: 'btn btn-label-secondary' },
|
||||
buttonsStyling: false
|
||||
}).then(function (result) {
|
||||
if (result.value) {
|
||||
$.ajax({
|
||||
url: "{{ route('tabel.destroy', ':id') }}".replace(':id', id),
|
||||
type: 'POST',
|
||||
data: {
|
||||
_token: '{{ csrf_token() }}',
|
||||
_method: 'DELETE'
|
||||
},
|
||||
success: function () {
|
||||
Swal.fire({ icon: 'success', title: 'Terhapus!', showConfirmButton: false, timer: 1500 })
|
||||
.then(() => location.reload());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
Reference in New Issue
Block a user