update form data surveyor
This commit is contained in:
@@ -83,7 +83,7 @@
|
||||
<div class="card-body">
|
||||
@if (request()->has('form') && request('form') == 'denah')
|
||||
@include('lpj::surveyor.components.card-tambah')
|
||||
{{-- @elseif(request()->has('form') && request('form') == 'data-pembanding')
|
||||
{{-- @elseif(request()->has('form') && request('form') == 'data-pembanding')
|
||||
@include('lpj::surveyor.components.data-pembanding') --}}
|
||||
@elseif(request()->has('form') && request('form') == 'foto')
|
||||
@include('lpj::surveyor.components.card-tambah')
|
||||
@@ -92,23 +92,75 @@
|
||||
@endIf
|
||||
</div>
|
||||
|
||||
@if (request()->has('form') && request('form') !== 'data-pembanding')
|
||||
<div class="card-footer">
|
||||
<form action="{{ route('surveyor.submitSurveyor', $surveyor ) }}" method="POST">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<button type="submit" class="btn btn-primary " {{ $buttonDisable ? 'disabled' : '' }}>
|
||||
<div class="card-footer ">
|
||||
<div class="flex gap-5">
|
||||
<button type="button" id="btnProses" class="btn btn-success">
|
||||
Proses
|
||||
</button>
|
||||
<button type="button" id="btnSubmit" class="btn btn-primary">
|
||||
Submit
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
checkButtonStatus();
|
||||
|
||||
document.getElementById('btnProses').addEventListener('click', onProses);
|
||||
document.getElementById('btnSubmit').addEventListener('click', onSubmit);
|
||||
});
|
||||
|
||||
function checkButtonStatus() {
|
||||
$.ajax({
|
||||
url: "{{ route('surveyor.checkButtonStatus', ['id' => $surveyor]) }}",
|
||||
type: "GET",
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.buttonDisable) {
|
||||
$('#btnProses, #btnSubmit').prop('disabled', true);
|
||||
} else {
|
||||
$('#btnProses, #btnSubmit').prop('disabled', false);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log('Error checking button status:', error, status, xhr);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function onProses() {
|
||||
return alert('Are you sure you want to submit?');
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
$.ajax({
|
||||
url: "{{ route('surveyor.submitSurveyor', ['id' => $surveyor]) }}",
|
||||
type: "GET",
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
window.location.href = "{{ route('surveyor.index') }}";
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log('Error checking button status:', error, status, xhr);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$('.card-title a').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
var url = $(this).attr('href');
|
||||
|
||||
Reference in New Issue
Block a user