fix redirect
This commit is contained in:
@@ -143,6 +143,8 @@ class AdminsController extends Controller
|
|||||||
'form_meeting_seminar' => $formMeetingSeminar,
|
'form_meeting_seminar' => $formMeetingSeminar,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
session()->put('redirect_url', route('admin.admins.expense', $user_id));
|
||||||
|
|
||||||
// Pass the forms and page information to the view
|
// Pass the forms and page information to the view
|
||||||
return view('backend.pages.admins.expense', [
|
return view('backend.pages.admins.expense', [
|
||||||
'pageInfo' => [
|
'pageInfo' => [
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
$forms = FormEntertaimentPresentation::where('user_id', auth()->user()->id)->get();
|
$forms = FormEntertaimentPresentation::where('user_id', auth()->user()->id)->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
session()->put('redirect_url', route('forms.entertainment'));
|
||||||
return view('backend.pages.forms.entertainment.index', [
|
return view('backend.pages.forms.entertainment.index', [
|
||||||
'forms' => $forms
|
'forms' => $forms
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class FormMeetingSeminarController extends Controller
|
|||||||
$forms = FormMeetingSeminar::where('user_id', auth()->user()->id)->get();
|
$forms = FormMeetingSeminar::where('user_id', auth()->user()->id)->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
session()->put('redirect_url', route('forms.meeting'));
|
||||||
return view('backend.pages.forms.meeting.index', [
|
return view('backend.pages.forms.meeting.index', [
|
||||||
'forms' => $forms
|
'forms' => $forms
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class FormOtherController extends Controller
|
|||||||
$forms = FormOthers::where('user_id', auth()->user()->id)->get();
|
$forms = FormOthers::where('user_id', auth()->user()->id)->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
session()->put('redirect_url', route('forms.other'));
|
||||||
return view('backend.pages.forms.other.index', [
|
return view('backend.pages.forms.other.index', [
|
||||||
'forms' => $forms
|
'forms' => $forms
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class FormUpCountryController extends Controller
|
|||||||
$forms = FormUpCountry::with('rayon')->where('user_id', auth()->user()->id)->get();
|
$forms = FormUpCountry::with('rayon')->where('user_id', auth()->user()->id)->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
session()->put('redirect_url', route('forms.up-country'));
|
||||||
return view('backend.pages.forms.upcountry.index', [
|
return view('backend.pages.forms.upcountry.index', [
|
||||||
'forms' => $forms
|
'forms' => $forms
|
||||||
]);
|
]);
|
||||||
@@ -137,8 +138,6 @@ class FormUpCountryController extends Controller
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
session()->flash('success', 'Form has been created.');
|
session()->flash('success', 'Form has been created.');
|
||||||
session()->flash('redirect_url', route('forms.up-country'));
|
|
||||||
|
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class FormVehicleController extends Controller
|
|||||||
$forms = FormVehicleRunningCost::where('user_id', auth()->user()->id)->get();
|
$forms = FormVehicleRunningCost::where('user_id', auth()->user()->id)->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
session()->put('redirect_url', route('forms.vehicle'));
|
||||||
return view('backend.pages.forms.vehicle.index', [
|
return view('backend.pages.forms.vehicle.index', [
|
||||||
'forms' => $forms
|
'forms' => $forms
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
@if (Session::has('success'))
|
@if (Session::has('success'))
|
||||||
<script>
|
<script>
|
||||||
@@ -22,6 +21,9 @@
|
|||||||
}).then(() => {
|
}).then(() => {
|
||||||
if ("{{ Session::get('redirect_url') }}") {
|
if ("{{ Session::get('redirect_url') }}") {
|
||||||
window.location.href = "{{ Session::get('redirect_url') }}";
|
window.location.href = "{{ Session::get('redirect_url') }}";
|
||||||
|
@php
|
||||||
|
Session::forget('redirect_url');
|
||||||
|
@endphp
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@@ -37,6 +39,9 @@
|
|||||||
}).then(() => {
|
}).then(() => {
|
||||||
if ("{{ Session::get('redirect_url') }}") {
|
if ("{{ Session::get('redirect_url') }}") {
|
||||||
window.location.href = "{{ Session::get('redirect_url') }}";
|
window.location.href = "{{ Session::get('redirect_url') }}";
|
||||||
|
@php
|
||||||
|
Session::forget('redirect_url');
|
||||||
|
@endphp
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -70,10 +70,6 @@
|
|||||||
<label class="form-label">Hotel</label>
|
<label class="form-label">Hotel</label>
|
||||||
<input type="number" class="form-control" name="hotel" id="hotel" required value="{{ $form->hotel }}">
|
<input type="number" class="form-control" name="hotel" id="hotel" required value="{{ $form->hotel }}">
|
||||||
</div>
|
</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">
|
<div class="mb-3">
|
||||||
<label class="form-label">Bukti 1</label>
|
<label class="form-label">Bukti 1</label>
|
||||||
<input type="file" class="form-control" name="bukti1" value="{{ old('bukti1') }}">
|
<input type="file" class="form-control" name="bukti1" value="{{ old('bukti1') }}">
|
||||||
@@ -95,30 +91,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</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
|
@endsection
|
||||||
|
|||||||
Reference in New Issue
Block a user