98 lines
3.3 KiB
PHP
98 lines
3.3 KiB
PHP
@extends('layouts.master')
|
|
|
|
@section('page-css')
|
|
@endsection
|
|
@section('content')
|
|
<div class="subheader">
|
|
<h1 class="subheader-title">
|
|
{{$title}}
|
|
</h1>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<div id="panel-4" class="panel">
|
|
<div class="panel-container show">
|
|
<div class="panel-content">
|
|
<div id="toolbar">
|
|
<a href="{{route($route.'.update')}}" class="btn btn-primary">
|
|
<i class="fal fa-plus"></i> Tambah Data
|
|
</a>
|
|
</div>
|
|
|
|
<table class="table w-100"
|
|
data-search="true"
|
|
data-toggle="table"
|
|
data-pagination="true"
|
|
data-toolbar="#toolbar"
|
|
data-show-refresh="false"
|
|
data-url="{{route($route.'.grid')}}"
|
|
data-ajax-options='{"xhrFields": {"withCredentials": true}}'
|
|
data-sort-name="ids"
|
|
data-sort-order="desc"
|
|
data-page-size="10"
|
|
data-id-field="id"
|
|
id="grid-data">
|
|
<thead class="bg-primary-light text-primary">
|
|
<tr>
|
|
<th data-field="action">#</th>
|
|
<th data-field="no">No</th>
|
|
<th data-field="kategori">Kategori</th>
|
|
<th data-field="page_number">Number Halaman</th>
|
|
<th data-field="judul">Judul</th>
|
|
<th data-field="type">Tipe Inputan</th>
|
|
<th data-field="created_at">Created At</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody></tbody>
|
|
</table>
|
|
<!-- datatable end -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@endsection
|
|
@section('page-js')
|
|
<script type="text/javascript">
|
|
$("#grid-data").on("click", ".remove_data", function() {
|
|
var base_url = $(this).attr('data-href');
|
|
var id = $(this).attr('data-id');
|
|
swal({
|
|
title: "Hapus Data!",
|
|
text: "Apa anda yakin ingin menghapus data ini ?",
|
|
type: "warning",
|
|
showCancelButton: true,
|
|
confirmButtonColor: "#DD6B55",
|
|
confirmButtonText: "Ya Hapus Sekarang",
|
|
cancelButtonText: "Tidak",
|
|
closeOnConfirm: true,
|
|
closeOnCancel: true
|
|
},
|
|
function(isConfirm) {
|
|
if(isConfirm){
|
|
|
|
request = $.ajax({
|
|
url: base_url,
|
|
type: "GET",
|
|
});
|
|
|
|
// Callback handler that will be called on success
|
|
request.done(function(response, textStatus, jqXHR){
|
|
console.log(response);
|
|
toastr.success("Berhasil Menhapus Data", 'Berhasil!', {positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right'});
|
|
$('#grid-data').bootstrapTable('refresh');
|
|
});
|
|
|
|
// Callback handler that will be called on failure
|
|
request.fail(function (jqXHR, textStatus, errorThrown){
|
|
toastr.error(
|
|
"Gagal "+textStatus, errorThrown
|
|
);
|
|
});
|
|
}
|
|
});
|
|
return false;
|
|
});
|
|
</script>
|
|
@endsection |