139 lines
5.0 KiB
PHP
139 lines
5.0 KiB
PHP
@extends('layouts.master')
|
|
|
|
@section('title', 'Jenis Pengelolaan Kotoran Ternak')
|
|
|
|
@section('content')
|
|
{{-- <div class="container"> --}}
|
|
<div class="card shadow-sm">
|
|
<div class="card-header d-flex justify-content-between align-items-center">
|
|
<h5 class="mb-0 font-weight-bold">Jenis Pengelolaan Kotoran Ternak</h5>
|
|
<a href="{{ route('livestockManure.create') }}" class="btn btn-sm btn-primary float-right">Tambah Jenis Pengelolaan
|
|
Kotoran Ternak</a>
|
|
</div>
|
|
|
|
<div class="card-body">
|
|
@if (session('success'))
|
|
<div class="alert alert-success">
|
|
{{ session('success') }}
|
|
</div>
|
|
@endif
|
|
<div class="table-responsive">
|
|
<table class="table align-items-center mb-0 display" id="data-table" style="width:100%">
|
|
<thead>
|
|
<tr>
|
|
{{-- <th scope="col">Kode</th> --}}
|
|
<th scope="col">Sistem Pengelolaan Kotoran Ternak</th>
|
|
<th scope="col">Faktor Emisi untuk Emisi Langsung N2O-N</th>
|
|
<th scope="col">Faktor Emisi untuk Emisi N2O dari Penguapan N</th>
|
|
<th scope="col">Nomor Baris</th>
|
|
<th scope="col">Status</th>
|
|
<th scope="col" width="20%">Aksi</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{-- </div> --}}
|
|
@endsection
|
|
|
|
@section('js')
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('#data-table').DataTable({
|
|
pageLength: 10,
|
|
responsive: true,
|
|
serverSide: true,
|
|
scrollX: true,
|
|
searchDelay: 1000,
|
|
ajax: {
|
|
url: '{{ route('livestockManure.index') }}',
|
|
type: 'GET',
|
|
dataSrc: 'data'
|
|
},
|
|
columns: [
|
|
// {
|
|
// data: 'code',
|
|
// name: 'code'
|
|
// },
|
|
{
|
|
data: 'name',
|
|
name: 'name'
|
|
},
|
|
{
|
|
data: 'ef_direct_n2o_n',
|
|
name: 'ef_direct_n2o_n'
|
|
},
|
|
{
|
|
data: 'ef_evaporation_n',
|
|
name: 'ef_evaporation_n'
|
|
},
|
|
{
|
|
data: 'no_baris',
|
|
name: 'no_baris'
|
|
},
|
|
{
|
|
data: 'status',
|
|
name: 'status'
|
|
},
|
|
{
|
|
data: 'action',
|
|
name: 'action',
|
|
orderable: false,
|
|
searchable: false
|
|
},
|
|
],
|
|
order: [
|
|
[3, 'asc']
|
|
]
|
|
});
|
|
});
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Delete confirmation
|
|
$(document).on('click', '.delete-button', function(e) {
|
|
e.preventDefault();
|
|
var form = $(this).closest('form');
|
|
var name = form.closest('tr').find('td').eq(1).text();
|
|
Swal.fire({
|
|
title: 'Apakah Anda yakin?',
|
|
text: 'Data "' + name + '" akan dihapus secara permanen!',
|
|
icon: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonColor: '#3085d6',
|
|
cancelButtonColor: '#d33',
|
|
confirmButtonText: 'Ya, hapus!',
|
|
cancelButtonText: 'Batal'
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
form.submit();
|
|
}
|
|
});
|
|
});
|
|
|
|
// Set aktif confirmation
|
|
$(document).on('click', '.set-aktif-button', function(e) {
|
|
e.preventDefault();
|
|
var form = $(this).closest('form');
|
|
var name = form.closest('tr').find('td').eq(1).text();
|
|
Swal.fire({
|
|
title: 'Apakah Anda yakin?',
|
|
text: 'Data "' + name + '" akan diaktifkan dan data lain akan dinonaktifkan!',
|
|
icon: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonColor: '#3085d6',
|
|
cancelButtonColor: '#d33',
|
|
confirmButtonText: 'Ya, aktifkan!',
|
|
cancelButtonText: 'Batal'
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
form.submit();
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
@endsection
|