fix redirect

This commit is contained in:
Jagad R R
2024-12-26 13:28:06 +07:00
parent c8c37f8d10
commit 1bd9ffecba
8 changed files with 13 additions and 33 deletions
@@ -11,7 +11,6 @@
</div>
@endif
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
@if (Session::has('success'))
<script>
@@ -22,6 +21,9 @@
}).then(() => {
if ("{{ Session::get('redirect_url') }}") {
window.location.href = "{{ Session::get('redirect_url') }}";
@php
Session::forget('redirect_url');
@endphp
}
});
</script>
@@ -37,6 +39,9 @@
}).then(() => {
if ("{{ Session::get('redirect_url') }}") {
window.location.href = "{{ Session::get('redirect_url') }}";
@php
Session::forget('redirect_url');
@endphp
}
});
</script>
@@ -70,10 +70,6 @@
<label class="form-label">Hotel</label>
<input type="number" class="form-control" name="hotel" id="hotel" required value="{{ $form->hotel }}">
</div>
<div class="mb-3">
<label class="form-label">Total</label>
<input type="number" class="form-control" name="total" id="total" required value="{{ $form->total }}" readonly>
</div>
<div class="mb-3">
<label class="form-label">Bukti 1</label>
<input type="file" class="form-control" name="bukti1" value="{{ old('bukti1') }}">
@@ -95,30 +91,4 @@
</div>
</div>
</section>
<script>
const allowance = document.getElementById('allowance');
const transportDalkot = document.getElementById('transport_dalkot');
const transportAnkot = document.getElementById('transport_ankot');
const hotel = document.getElementById('hotel');
const total = document.getElementById('total');
// Function to calculate total
function calculateTotal() {
const allowanceValue = parseInt(allowance.value) || 0;
const transportDalkotValue = parseInt(transportDalkot.value) || 0;
const transportAnkotValue = parseInt(transportAnkot.value) || 0;
const hotelValue = parseInt(hotel.value) || 0;
total.value = allowanceValue + transportDalkotValue + transportAnkotValue + hotelValue;
}
// Attach event listeners
[allowance, transportDalkot, transportAnkot, hotel].forEach(input => {
input.addEventListener('input', calculateTotal);
});
// Initial calculation on page load
calculateTotal();
</script>
@endsection