93 lines
3.3 KiB
PHP
93 lines
3.3 KiB
PHP
@extends('layouts.master')
|
|
|
|
@section('css')
|
|
@endsection
|
|
@section('content')
|
|
<div class="page-content">
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<div id="toolbar">
|
|
<a href="{{route($route.'.update')}}" id="btn-add" class="btn btn-primary">
|
|
<i class="mdi mdi-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="table-secondary text-primary">
|
|
<tr>
|
|
<th data-width="15%" class="text-center" data-field="action">#</th>
|
|
<th data-field="kode">Kode</th>
|
|
<th data-field="nama">Nama</th>
|
|
<th data-field="nomor_baris">Nomor Baris</th>
|
|
<th data-field="status">Status</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody></tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
@section('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.fire({
|
|
title: "Hapus Data!",
|
|
text: "Apa anda yakin ingin menghapus data ini ?",
|
|
icon: "warning",
|
|
showCancelButton: true,
|
|
confirmButtonColor: "#DD6B55",
|
|
confirmButtonText: "Ya Hapus Sekarang",
|
|
cancelButtonText: "Tidak"
|
|
}).then((result) => {
|
|
|
|
if (result.isConfirmed) {
|
|
|
|
request = $.ajax({
|
|
url: base_url,
|
|
xhrFields: {
|
|
withCredentials: true
|
|
},
|
|
type: "GET",
|
|
});
|
|
|
|
// Callback handler that will be called on success
|
|
request.done(function(response, textStatus, jqXHR){
|
|
console.log(response);
|
|
alertify.success("Berhasil Menhapus Data");
|
|
$('#grid-data').bootstrapTable('refresh');
|
|
});
|
|
|
|
// Callback handler that will be called on failure
|
|
request.fail(function (jqXHR, textStatus, errorThrown){
|
|
alertify.error("Gagal " + textStatus, errorThrown);
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return false;
|
|
});
|
|
</script>
|
|
@endsection |