main
Ilham Wara Nugroho 2026-03-04 13:47:13 +07:00
parent c1a3c26159
commit 5199f160b8
2 changed files with 51 additions and 2 deletions

View File

@ -72,7 +72,9 @@ class KuesionerController extends Controller
} }
if((session('group_alias') == 'dinas') || (session('group_alias') == 'suku_dinas') || (session('group_alias') == 'administrator') ){ if((session('group_alias') == 'dinas') || (session('group_alias') == 'suku_dinas') || (session('group_alias') == 'administrator') ){
$action .= '<a href="#" data-href="'.url('kuesioner/kembalikan/'.encode_id($row->KuesionerId)).'" data-toggle="tooltip" title="Kembalikan Kuesioner Leveling" class="btn btn-xs btn-block btn-danger dikembalikan"><i class="fal fa-undo text-white"></i></a>'; if($row->status == 1){
$action .= '<a href="#" data-href="'.url('kuesioner/kembalikan/'.encode_id($row->KuesionerId)).'" data-toggle="tooltip" title="Kembalikan Kuesioner Leveling" class="btn btn-xs btn-block btn-danger dikembalikan"><i class="fal fa-undo text-white"></i></a>';
}
} }
} }
} }

View File

@ -184,6 +184,53 @@
return params return params
} }
$("#grid-data").on("click", ".dikembalikan", function() {
var base_url = $(this).attr('data-href');
var id = $(this).attr('data-id');
swal({
title: "Kembalikan Kuesioner!",
text: "Apa anda yakin ingin mengembalikan kuesioner ini ke pihak sekolah ?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#BF3131",
confirmButtonText: "Kembalikan Sekarang",
cancelButtonText: "Batal",
closeOnConfirm: true,
closeOnCancel: true
},
function(isConfirm) {
if(isConfirm){
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);
toastr.success("Berhasil", 'Berhasil!', {positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right'});
window.location.href = '{{url("/kuesioner")}}';
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", ".tolak", function() { $("#grid-data").on("click", ".tolak", function() {
var base_url = $(this).attr('data-href'); var base_url = $(this).attr('data-href');
var id = $(this).attr('data-id'); var id = $(this).attr('data-id');
@ -258,7 +305,7 @@
// Callback handler that will be called on success // Callback handler that will be called on success
request.done(function(response, textStatus, jqXHR){ request.done(function(response, textStatus, jqXHR){
console.log(response); console.log(response);
toastr.success("Berhasil Login", 'Berhasil!', {positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right'}); toastr.success("Berhasil", 'Berhasil!', {positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right'});
window.location.href = '{{url("/kuesioner")}}'; window.location.href = '{{url("/kuesioner")}}';
history.pushState(null, null, location.href); history.pushState(null, null, location.href);
window.onpopstate = function () { window.onpopstate = function () {