Refactor application submission response in ApplicationController to return JSON format and update phone number validation rule. Modify careers index view to handle new response structure.
This commit is contained in:
@@ -15,7 +15,7 @@ class ApplicationController extends Controller
|
||||
'birthdate' => 'required|date',
|
||||
'resume_file' => 'required|file|mimes:pdf,doc,docx|max:2048',
|
||||
'email' => 'required|email|max:255',
|
||||
'phone_number' => 'required|string|max:20',
|
||||
'phone_number' => 'required|string',
|
||||
'cover_letter' => 'nullable|string',
|
||||
]);
|
||||
|
||||
@@ -31,6 +31,8 @@ class ApplicationController extends Controller
|
||||
'cover_letter' => $validatedData['cover_letter'] ?? null,
|
||||
]);
|
||||
|
||||
return back()->with('success', 'Your application has been submitted successfully!');
|
||||
return response()->json([
|
||||
'message' => 'Your application has been submitted successfully!',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
if (data.message) {
|
||||
alert(data.message);
|
||||
var modal = bootstrap.Modal.getInstance(applicationModal);
|
||||
modal.hide();
|
||||
|
||||
Reference in New Issue
Block a user