Remove unused class column from enquiries data table and enhance form validation
This commit is contained in:
@@ -30,9 +30,6 @@ class DashboardController extends Controller
|
||||
$model = Enquiry::query()->where('is_read', 0)->latest();
|
||||
return DataTables::eloquent($model)
|
||||
->addIndexColumn()
|
||||
->editColumn('class', function (Enquiry $enquiry) {
|
||||
return $enquiry->class ?? '-';
|
||||
})
|
||||
->editColumn('subject', function (Enquiry $enquiry) {
|
||||
return $enquiry->subject ?? '-';
|
||||
})
|
||||
|
@@ -152,7 +152,7 @@
|
||||
<label
|
||||
class="text-20 text-ter p-0 m-0 flex items-center gap-10 px-10 py-12 bg-white rounded-30 tabs"
|
||||
for="{{ $country->id }}"> <input type="radio" name="country_id"
|
||||
value="{{ $country->id }}" id="{{ $country->id }}">
|
||||
value="{{ $country->id }}" id="{{ $country->id }}" required>
|
||||
{{ $country->title }} </label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -173,7 +173,7 @@
|
||||
class="text-20 text-ter p-0 m-0 flex items-center gap-10 px-10 py-12 bg-white rounded-30 tabs"
|
||||
for="{{ $status }}"> <input type="radio"
|
||||
name="status_type_id" value="{{ $status }}"
|
||||
id="{{ $status }}"> {{ $status }}</label>
|
||||
id="{{ $status }}" required> {{ $status }}</label>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@@ -192,7 +192,7 @@
|
||||
<label
|
||||
class="text-20 text-ter p-0 m-0 flex items-center gap-10 px-10 py-12 bg-white rounded-30 tabs"
|
||||
for="yes"> <input name="services" type="radio" id="yes"
|
||||
value="yes"> Yes</label>
|
||||
value="yes" required> Yes</label>
|
||||
|
||||
|
||||
</div>
|
||||
@@ -224,9 +224,9 @@
|
||||
|
||||
<label
|
||||
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" name=""
|
||||
id="{{ $level }}" value="">
|
||||
{{ $level }}</label>
|
||||
for="{{ $level }}"> <input type="radio"
|
||||
name="program_level" id="level_{{ $loop->index }}"
|
||||
value="{{ $level }}" required>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@@ -239,14 +239,12 @@
|
||||
<div class="row flex py-20">
|
||||
<div class="col col-sm-12">
|
||||
<div class="flex items-center gap-10 px-10 py-12 bg-white rounded-30 tabs">
|
||||
@foreach ($programss as $key => $program)
|
||||
<select name="program_id" class="cost-select" id="" required>
|
||||
<option value="">Select Program</option>
|
||||
<select name="program_id" class="cost-select" required>
|
||||
<option value="">Select Program</option>
|
||||
@foreach ($programss as $key => $program)
|
||||
<option value="{{ $key }}">{{ $program }}</option>
|
||||
</select>
|
||||
@endforeach
|
||||
|
||||
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -331,75 +329,61 @@
|
||||
|
||||
</section>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
{{-- <script>
|
||||
const form = document.getElementById('multiStepForm');
|
||||
const tabs = document.querySelectorAll('.tab-pane');
|
||||
const nextBtns = document.querySelectorAll('.btn-next');
|
||||
const prevBtns = document.querySelectorAll('.btn-prev');
|
||||
const navButtons = document.querySelectorAll('#step-nav button');
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
let currentStep = 1;
|
||||
const totalSteps = 5;
|
||||
|
||||
let currentStep = 0;
|
||||
function validateStep(step) {
|
||||
const stepContent = document.querySelector(`#step${step}`);
|
||||
const requiredInputs = stepContent.querySelectorAll("input[required], select[required]");
|
||||
let valid = false;
|
||||
|
||||
function showStep(step) {
|
||||
tabs.forEach((tab, idx) => {
|
||||
tab.classList.toggle('active', idx === step);
|
||||
});
|
||||
navButtons.forEach((btn, idx) => {
|
||||
btn.classList.toggle('active', idx === step);
|
||||
});
|
||||
}
|
||||
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;
|
||||
}
|
||||
});
|
||||
|
||||
nextBtns.forEach(btn => {
|
||||
btn.addEventListener('click', () => {
|
||||
if (currentStep < tabs.length - 1) {
|
||||
currentStep++;
|
||||
showStep(currentStep);
|
||||
if (!valid) {
|
||||
alert("Please complete this step before proceeding.");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
prevBtns.forEach(btn => {
|
||||
btn.addEventListener('click', () => {
|
||||
if (currentStep > 0) {
|
||||
currentStep--;
|
||||
showStep(currentStep);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
navButtons.forEach((btn, idx) => {
|
||||
btn.addEventListener('click', () => {
|
||||
currentStep = idx;
|
||||
showStep(currentStep);
|
||||
});
|
||||
});
|
||||
|
||||
// Proficiency test toggle
|
||||
const yesRadio = document.getElementById('yes');
|
||||
const noRadio = document.getElementById('no');
|
||||
const testDetailsGroup = document.getElementById('testDetailsGroup');
|
||||
const testScoreGroup = document.getElementById('testScoreGroup');
|
||||
const consideringGroup = document.getElementById('consideringGroup');
|
||||
|
||||
function toggleProficiencySections() {
|
||||
if (yesRadio.checked) {
|
||||
testDetailsGroup.classList.remove('d-none');
|
||||
testScoreGroup.classList.remove('d-none');
|
||||
consideringGroup.classList.add('d-none');
|
||||
} else if (noRadio.checked) {
|
||||
testDetailsGroup.classList.add('d-none');
|
||||
testScoreGroup.classList.add('d-none');
|
||||
consideringGroup.classList.remove('d-none');
|
||||
} else {
|
||||
testDetailsGroup.classList.add('d-none');
|
||||
testScoreGroup.classList.add('d-none');
|
||||
consideringGroup.classList.add('d-none');
|
||||
return valid;
|
||||
}
|
||||
}
|
||||
|
||||
yesRadio.addEventListener('change', toggleProficiencySections);
|
||||
noRadio.addEventListener('change', toggleProficiencySections);
|
||||
toggleProficiencySections();
|
||||
</script> --}}
|
||||
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
|
||||
|
@@ -134,30 +134,29 @@
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@php
|
||||
$columns = [
|
||||
[
|
||||
'title' => 'S.N',
|
||||
'data' => 'DT_RowIndex',
|
||||
'name' => 'DT_RowIndex',
|
||||
'orderable' => false,
|
||||
'searchable' => false,
|
||||
'sortable' => false,
|
||||
],
|
||||
['title' => 'Name', 'data' => 'name', 'name' => 'name'],
|
||||
['title' => 'Email', 'data' => 'email', 'name' => 'email'],
|
||||
['title' => 'Contact', 'data' => 'mobile', 'name' => 'mobile'],
|
||||
['title' => 'Class', 'data' => 'class', 'name' => 'class'],
|
||||
['title' => 'Subject', 'data' => 'subject', 'name' => 'subject'],
|
||||
['title' => 'Message', 'data' => 'message', 'name' => 'message'],
|
||||
[
|
||||
'title' => 'Action',
|
||||
'data' => 'action',
|
||||
'orderable' => false,
|
||||
'searchable' => false,
|
||||
],
|
||||
];
|
||||
@endphp
|
||||
<x-data-table-script :route="route('dashboard.getEnquiries')" :reorder="null" :columns="$columns" />
|
||||
$columns = [
|
||||
[
|
||||
'title' => 'S.N',
|
||||
'data' => 'DT_RowIndex',
|
||||
'name' => 'DT_RowIndex',
|
||||
'orderable' => false,
|
||||
'searchable' => false,
|
||||
'sortable' => false,
|
||||
],
|
||||
['title' => 'Name', 'data' => 'name', 'name' => 'name'],
|
||||
['title' => 'Email', 'data' => 'email', 'name' => 'email'],
|
||||
['title' => 'Mobile', 'data' => 'mobile', 'name' => 'mobile'],
|
||||
['title' => 'Subject', 'data' => 'subject', 'name' => 'subject'],
|
||||
['title' => 'Message', 'data' => 'message', 'name' => 'message'],
|
||||
[
|
||||
'title' => 'Action',
|
||||
'data' => 'action',
|
||||
'orderable' => false,
|
||||
'searchable' => false,
|
||||
],
|
||||
];
|
||||
@endphp
|
||||
<x-data-table-script :route="route('dashboard.getEnquiries')" :reorder="null" :columns="$columns" />
|
||||
</div><!-- end card body -->
|
||||
</div><!-- end card -->
|
||||
</div><!-- end col -->
|
||||
|
Reference in New Issue
Block a user