127 lines
4.8 KiB
PHP
127 lines
4.8 KiB
PHP
@extends('layouts.master')
|
|
|
|
@section('css')
|
|
@endsection
|
|
@section('content')
|
|
<div class="flex-1 overflow-y-auto p-8 custom-scrollbar">
|
|
<div class="bg-white p-8 rounded-3xl border border-slate-200 shadow-sm overflow-hidden">
|
|
<div class="overflow-x-auto">
|
|
<div id="toolbar">
|
|
@if(permission('is_create', $route.'.*','module',false) || permission('is_update', $route.'.*','module',false))
|
|
<a href="{{route($route.'.update')}}" class="p-2 border border-slate-200 rounded-xl hover:bg-slate-50 transition-colors flex items-center text-sm font-semibold text-slate-600">
|
|
<i data-lucide="plus" class="w-4 h-4 mr-2"></i> <span>Tambah Data</span>
|
|
</a>
|
|
@endif
|
|
</div>
|
|
<table class="w-full text-left border-collapse"
|
|
data-search="true"
|
|
data-toggle="table"
|
|
data-pagination="true"
|
|
data-toolbar="#toolbar"
|
|
data-show-refresh="false"
|
|
data-url="{{route($route.'.grid')}}"
|
|
data-sort-name="ids"
|
|
data-sort-order="desc"
|
|
data-page-size="10"
|
|
data-id-field="id"
|
|
id="grid-data">
|
|
<thead class="bg-slate-50/50 border-b border-slate-100">
|
|
<tr>
|
|
<th class="text-[10px] border font-bold text-slate-900 text-center" data-width="10" data-field="action">#</th>
|
|
<th class="text-[10px] border font-bold text-slate-900 text-center" data-width="10" data-field="no">No</th>
|
|
<th class="text-[10px] border font-bold text-slate-900 text-center" data-field="name">Name</th>
|
|
<th class="text-[10px] border font-bold text-slate-900 text-center" data-field="role">Role</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@endsection
|
|
@section('js')
|
|
<script type="text/javascript">
|
|
$("#grid-data").on("click", ".forcelogin", function() {
|
|
var base_url = $(this).attr('data-href');
|
|
var id = $(this).attr('data-id');
|
|
swal({
|
|
title: "Force Login!",
|
|
text: "Apa anda yakin ingin login sebagai akun ini ?",
|
|
type: "warning",
|
|
showCancelButton: true,
|
|
confirmButtonColor: "#3F7D58",
|
|
confirmButtonText: "Ya Masuk 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 Login", 'Berhasil!', {positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right'});
|
|
window.location.href = '{{url("/dashboard")}}';
|
|
history.pushState(null, null, location.href);
|
|
window.onpopstate = function () {
|
|
history.go(1);
|
|
};
|
|
});
|
|
|
|
// Callback handler that will be called on failure
|
|
request.fail(function (jqXHR, textStatus, errorThrown){
|
|
toastr.error(
|
|
"Gagal "+textStatus, errorThrown
|
|
);
|
|
});
|
|
}
|
|
});
|
|
return false;
|
|
});
|
|
$("#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 |