diff --git a/app/Http/Controllers/KuesionerController.php b/app/Http/Controllers/KuesionerController.php index 091d59d..ceb26e9 100644 --- a/app/Http/Controllers/KuesionerController.php +++ b/app/Http/Controllers/KuesionerController.php @@ -72,7 +72,9 @@ class KuesionerController extends Controller } if((session('group_alias') == 'dinas') || (session('group_alias') == 'suku_dinas') || (session('group_alias') == 'administrator') ){ - $action .= ''; + if($row->status == 1){ + $action .= ''; + } } } } diff --git a/resources/views/modules/kuesioner/index.blade.php b/resources/views/modules/kuesioner/index.blade.php index f8d5b61..f8073c6 100644 --- a/resources/views/modules/kuesioner/index.blade.php +++ b/resources/views/modules/kuesioner/index.blade.php @@ -184,6 +184,53 @@ 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() { var base_url = $(this).attr('data-href'); var id = $(this).attr('data-id'); @@ -258,7 +305,7 @@ // 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'}); + 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 () {