ringkasan dan summary petani
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -95,6 +95,70 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h6 class="mb-3">Informasi Ringkasan Tabel</h6>
|
||||
|
||||
<hr class="my-4 mx-n4" />
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-auto d-flex gap-2">
|
||||
<button type="button" class="btn btn-sm btn-primary" data-bs-toggle="offcanvas" data-bs-target="#offcanvasAddRingkasan" >
|
||||
<i class="ti tabler-plus me-1"></i> Tambah
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-12 mb-4 form-control-validation">
|
||||
|
||||
<div class="table-responsive text-nowrap mb-4">
|
||||
<table class="table table-hover">
|
||||
<thead class="border-top">
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Heading / Subheading</th>
|
||||
<th>Query</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse($tabel->ringkasan as $index => $ringkasan)
|
||||
<tr>
|
||||
<td>{{ $loop->iteration }}</td>
|
||||
<td>
|
||||
<span class="text-muted">{{ $ringkasan->heading }}</span><br>
|
||||
<small class="text-muted">{{ $ringkasan->subheading }}</small>
|
||||
</td>
|
||||
<td><span class="text-muted">{{ $ringkasan->query_ringkasan }}</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-ringkasan"
|
||||
data-id="{{ $ringkasan->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-ringkasan"
|
||||
data-id="{{ $ringkasan->id }}">
|
||||
<i class="ti tabler-arrow-down"></i>
|
||||
</button>
|
||||
@endif
|
||||
<a href="javascript:;" class="btn btn-icon btn-text-secondary rounded-pill edit-ringkasan" data-id="{{ $ringkasan->id }}"><i class="ti tabler-edit ti-md"></i></a>
|
||||
<a href="javascript:;" class="btn btn-icon btn-text-secondary rounded-pill delete-ringkasan" data-id="{{ $ringkasan->id }}" data-nama="{{ $ringkasan->heading }}"><i class="ti tabler-trash ti-md"></i></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="5" class="text-center py-4">Tidak ada ringkasan ditemukan.</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 text-end">
|
||||
<a href="{{ route('tabel.index') }}" class="btn btn-label-secondary me-2">Kembali</a>
|
||||
</div>
|
||||
@@ -103,6 +167,8 @@
|
||||
</div>
|
||||
@include('ekosistem.kolom-basis-data.add')
|
||||
@include('ekosistem.kolom-basis-data.edit')
|
||||
@include('ekosistem.ringkasan-basis-data.add')
|
||||
@include('ekosistem.ringkasan-basis-data.edit')
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@@ -168,6 +234,63 @@
|
||||
});
|
||||
});
|
||||
|
||||
$(".move-up-ringkasan").click(function (e) {
|
||||
e.preventDefault();
|
||||
let id = $(this).data('id');
|
||||
|
||||
$.post("{{ route('tabel.ringkasan.move-up', [$tabel->id, ':id']) }}".replace(':id', id), {
|
||||
_token: '{{ csrf_token() }}',
|
||||
_method: 'PUT'
|
||||
}, function (res) {
|
||||
if (res.status === 'success') {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(".move-down-ringkasan").click(function (e) {
|
||||
e.preventDefault();
|
||||
let id = $(this).data('id');
|
||||
|
||||
$.post("{{ route('tabel.ringkasan.move-down', [$tabel->id, ':id']) }}".replace(':id', id), {
|
||||
_token: '{{ csrf_token() }}',
|
||||
_method: 'PUT'
|
||||
}, function (res) {
|
||||
if (res.status === 'success') {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(".delete-ringkasan").click(function (e) {
|
||||
e.preventDefault();
|
||||
const id = $(this).data('id');
|
||||
const name = $(this).data('nama');
|
||||
|
||||
Swal.fire({
|
||||
title: 'Hapus?',
|
||||
text: `Ringkasan ${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.ringkasan.destroy', [$tabel->id, ':id']) }}".replace(':id', id),
|
||||
type: 'DELETE',
|
||||
data: {
|
||||
_token: '{{ csrf_token() }}'
|
||||
},
|
||||
success: function () {
|
||||
Swal.fire({ icon: 'success', title: 'Terhapus!', showConfirmButton: false, timer: 1500 })
|
||||
.then(() => window.location.reload());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
Reference in New Issue
Block a user