fixes
This commit is contained in:
@@ -224,9 +224,9 @@
|
|||||||
|
|
||||||
<label
|
<label
|
||||||
class="text-20 text-ter p-0 m-0 flex items-center gap-10 px-10 py-12 bg-white rounded-30 tabs"
|
class="text-20 text-ter p-0 m-0 flex items-center gap-10 px-10 py-12 bg-white rounded-30 tabs"
|
||||||
for="{{ $level }}"> <input type="radio"
|
for="{{ $level }}"> <input type="radio" name=""
|
||||||
name="program_level" id="level_{{ $loop->index }}"
|
id="{{ $level }}" value="">
|
||||||
value="{{ $level }}" required>
|
{{ $level }}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
@@ -239,12 +239,12 @@
|
|||||||
<div class="row flex py-20">
|
<div class="row flex py-20">
|
||||||
<div class="col col-sm-12">
|
<div class="col col-sm-12">
|
||||||
<div class="flex items-center gap-10 px-10 py-12 bg-white rounded-30 tabs">
|
<div class="flex items-center gap-10 px-10 py-12 bg-white rounded-30 tabs">
|
||||||
<select name="program_id" class="cost-select" required>
|
@foreach ($programss as $key => $program)
|
||||||
<option value="">Select Program</option>
|
<select name="program_id" class="cost-select" id="" required>
|
||||||
@foreach ($programss as $key => $program)
|
<option value="">Select Program</option>
|
||||||
<option value="{{ $key }}">{{ $program }}</option>
|
<option value="{{ $key }}">{{ $program }}</option>
|
||||||
@endforeach
|
</select>
|
||||||
</select>
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -329,61 +329,3 @@
|
|||||||
|
|
||||||
</section>
|
</section>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@push('js')
|
|
||||||
<script>
|
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
|
||||||
let currentStep = 1;
|
|
||||||
const totalSteps = 5;
|
|
||||||
|
|
||||||
function validateStep(step) {
|
|
||||||
const stepContent = document.querySelector(`#step${step}`);
|
|
||||||
const requiredInputs = stepContent.querySelectorAll("input[required], select[required]");
|
|
||||||
let valid = false;
|
|
||||||
|
|
||||||
requiredInputs.forEach(input => {
|
|
||||||
if ((input.type === "radio" || input.type === "checkbox")) {
|
|
||||||
const group = stepContent.querySelectorAll(`input[name="${input.name}"]:checked`);
|
|
||||||
if (group.length > 0) valid = true;
|
|
||||||
} else if (input.value.trim() !== "") {
|
|
||||||
valid = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!valid) {
|
|
||||||
alert("Please complete this step before proceeding.");
|
|
||||||
}
|
|
||||||
return valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
document.getElementById("nextBtn").addEventListener("click", function() {
|
|
||||||
if (validateStep(currentStep)) {
|
|
||||||
document.getElementById(`step${currentStep}`).classList.remove("active");
|
|
||||||
currentStep++;
|
|
||||||
document.getElementById(`step${currentStep}`).classList.add("active");
|
|
||||||
|
|
||||||
if (currentStep === totalSteps) {
|
|
||||||
document.getElementById("nextBtn").style.display = "none";
|
|
||||||
document.getElementById("doneBtn").style.display = "inline-flex";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
document.getElementById("prevBtn").addEventListener("click", function() {
|
|
||||||
document.getElementById(`step${currentStep}`).classList.remove("active");
|
|
||||||
currentStep--;
|
|
||||||
document.getElementById(`step${currentStep}`).classList.add("active");
|
|
||||||
|
|
||||||
document.getElementById("nextBtn").style.display = "inline-flex";
|
|
||||||
document.getElementById("doneBtn").style.display = "none";
|
|
||||||
});
|
|
||||||
|
|
||||||
// Final check before submit
|
|
||||||
document.getElementById("cost-calculator").addEventListener("submit", function(e) {
|
|
||||||
if (!validateStep(currentStep)) {
|
|
||||||
e.preventDefault();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@endpush
|
|
||||||
|
Reference in New Issue
Block a user