77 lines
2.7 KiB
PHP
77 lines
2.7 KiB
PHP
@extends('layouts.main')
|
|
|
|
@section('breadcrumbs')
|
|
{{ Breadcrumbs::render(request()->route()->getName(), $permohonan->id, $header) }}
|
|
@endsection
|
|
|
|
@section('content')
|
|
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
|
|
|
@php
|
|
$dataHeader = strtolower($header ?? '');
|
|
@endphp
|
|
|
|
@include('lpj::component.detail-jaminan', ['backLink' => 'otorisator.'. $dataHeader . '.index'])
|
|
|
|
<div>
|
|
<div>
|
|
<button onclick="otorisatorData({{ $permohonan->id }})" type="button" class="btn btn-primary">
|
|
<i class="ki-filled ki-double-check"></i>
|
|
Otorisator {{ $header ?? '' }}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
@push('scripts')
|
|
<script>
|
|
function otorisatorData(dataId) {
|
|
const dataHeader = @json($header);
|
|
Swal.fire({
|
|
title: 'Apakah Anda yakin?',
|
|
text: `Untuk melakukan otorisator ${dataHeader}!`,
|
|
icon: 'warning',
|
|
input: 'textarea',
|
|
inputLabel: 'Keterangan',
|
|
inputPlaceholder: 'Masukkan keterangan...',
|
|
inputAttributes: {
|
|
'aria-label': 'Masukkan keterangan'
|
|
},
|
|
showCancelButton: true,
|
|
confirmButtonColor: '#3085d6',
|
|
cancelButtonColor: '#d33',
|
|
confirmButtonText: 'Ya, Lanjutkan!',
|
|
cancelButtonText: 'Batal',
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
const userMessage = result.value || ''; // Ambil pesan dari textarea
|
|
$.ajaxSetup({
|
|
headers: {
|
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
|
},
|
|
});
|
|
$.ajax({
|
|
url: `/otorisator/otorisator/${dataId}/${dataHeader}`,
|
|
type: 'POST',
|
|
data: {
|
|
message: userMessage
|
|
},
|
|
success: (response) => {
|
|
Swal.fire('Berhasil!', 'Data berhasil diotorisasi.', 'success').then(() => {
|
|
window.location.reload();
|
|
});
|
|
console.log(response);
|
|
},
|
|
error: (error) => {
|
|
console.error('Error:', error);
|
|
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan otorisator.',
|
|
'error');
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
@endpush
|