feat: Add Vacancy management functionality with controller, model, migration, and form

This commit is contained in:
2025-08-22 17:03:00 +05:45
parent 52732b0f09
commit 6d71fe4b4a
7 changed files with 258 additions and 12 deletions

View File

@@ -219,7 +219,7 @@
});
</script>
<script>
<script>
document.addEventListener('DOMContentLoaded', () => {
const form = document.getElementById('franchise-form');
const submitBtn = document.getElementById('franchise-submit');
@@ -259,7 +259,7 @@
});
</script>
<script>
<script>
document.addEventListener('DOMContentLoaded', () => {
const form = document.getElementById('newsletter-form');
const submitBtn = document.getElementById('newsletter-submit');
@@ -339,6 +339,46 @@
});
</script>
<script>
document.addEventListener('DOMContentLoaded', () => {
const form = document.getElementById('vacancy-form');
const submitBtn = document.getElementById('vacancy-submit-btn');
const url = form.action;
form.addEventListener('submit', async (e) => {
e.preventDefault();
submitBtn.disabled = true;
submitBtn.textContent = 'Submitting…';
const formData = new FormData(form);
try {
const res = await fetch(url, {
method: 'POST',
headers: {
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')
.content
},
body: formData
});
const data = await res.json();
if (res.ok) {
form.reset();
window.location.href =
"{{ route('thankyou') }}"; // ✅ redirect instead of toastr
} else if (data.errors && data.errors.email) {
data.errors.email.forEach(msg => toastr.error(msg));
} else {
toastr.error('Submission failed. Please try again.');
}
} catch (err) {
console.error(err);
toastr.error('Something went wrong. Please try again.');
} finally {
submitBtn.disabled = false;
submitBtn.textContent = 'Submit';
}
});
});
</script>
<script>
$(document).ready(function() {
var weekdays = [

View File

@@ -89,35 +89,37 @@
<div class="col col-12 col-md-5">
<div class=" form ">
<h2 class="text-26 mb-30 text-brand text-center">Quick Apply</h2>
<form action="">
<form action="{{ route('vacancy.store') }}" method="post" id="vacancy-form">
@csrf
<input type="hidden" name="career_id" value="{{ $career->id }}">
<div class="flex gap-20">
<input class="w-full mb-30 rounded-6 py-15 text-14 px-10" type="text"
name="" id="" placeholder="First Name">
name="first_name" id="" placeholder="First Name">
<input class="w-full mb-30 rounded-6 py-15 text-14 px-10" type="text"
name="" id="" placeholder="Last Name">
name="last_name" id="" placeholder="Last Name">
</div>
<div class="flex gap-20">
<input class="w-full mb-30 rounded-6 py-15 text-14 px-10" type="email"
name="" id="" placeholder="Email">
name="email" id="" placeholder="Email">
<input class="w-full mb-30 rounded-6 py-15 text-14 px-10" type="tel"
name="" id="" placeholder="Phone Number">
name="phone" id="" placeholder="Phone Number">
</div>
<input class="w-full mb-30 rounded-6 py-15 text-14 px-10" type="text" name=""
id="" placeholder="Your Qualification">
<input class="w-full mb-30 rounded-6 py-15 text-14 px-10" type="text"
name="qualification" id="" placeholder="Your Qualification">
<textarea class="w-full mb-10 rounded-6 py-15 text-14 px-10" name="" id=""
<textarea class="w-full mb-10 rounded-6 py-15 text-14 px-10" name="description" id=""
placeholder="Short description about you"></textarea>
<label class="text-16" for="">Please Upload Your CV</label>
<input class="mb-20" type="file" name="" id="">
<button
<input class="mb-20" type="file" name="document" id="">
<button type="submit" id="vacancy-submit-btn"
class="button-hover px-30 py-10 bg-sec text-white rounded-30 text-14 border-0 mt-20 ">Submit</button>
</form>