Commit 075e2300 authored by Deep Dey's avatar Deep Dey

chore: update form ui for new validation and implementation

parent a9d7e8f7
...@@ -350,9 +350,10 @@ ...@@ -350,9 +350,10 @@
<div class="la-invalid-feedback"></div> <div class="la-invalid-feedback"></div>
</div> </div>
<div class="la-form-group"> <div class="la-form-group">
<label for="motherOccupation">Occupation and Designation</label> <label for="motherOccupation">Occupation and Designation <span>*</span></label>
<input type="text" name="motherOccupation" class="la-form-control"> <input type="text" name="motherOccupation" class="la-form-control">
<div class="la-invalid-feedback"></div> <div class="la-invalid-feedback"></div>
<small>If not working please write Homemaker/Housewife</small>
</div> </div>
<div class="la-form-group"> <div class="la-form-group">
<label for="motherMonthlyIncome">Monthly Income</label> <label for="motherMonthlyIncome">Monthly Income</label>
...@@ -381,9 +382,9 @@ ...@@ -381,9 +382,9 @@
<div class="la-invalid-feedback"></div> <div class="la-invalid-feedback"></div>
</div> </div>
<div class="la-form-group"> <div class="la-form-group">
<img class="image-preview" src="./img/mother.png" alt="mother photo"> <img id="motherImage" class="image-preview" src="./img/mother.png" alt="mother photo">
<label for="motherImage">Mother's Photo</label> <label for="motherImage">Mother's Photo</label>
<input id="motherImage" type="file" name="motherImage" class="la-form-control"> <input id="motherImageInput" type="file" name="motherImage" class="la-form-control">
<div class="la-invalid-feedback"></div> <div class="la-invalid-feedback"></div>
</div> </div>
</div> </div>
......
...@@ -145,48 +145,51 @@ $(document).ready(function () { ...@@ -145,48 +145,51 @@ $(document).ready(function () {
$('#application-form').validate({ $('#application-form').validate({
rules: { rules: {
// school: 'required', school: 'required',
// category: 'required', category: 'required',
// fullName: 'required', fullName: 'required',
// admissionClass: 'required', admissionClass: 'required',
// dateOfBirth: 'required', dateOfBirth: 'required',
// nationality: 'required', nationality: 'required',
// religion: 'required', religion: 'required',
// motherTongue: 'required', motherTongue: 'required',
// community: 'required', community: 'required',
// maritalStatus: 'required', homeAddress: 'required',
// fatherName: 'required', correspondenceAddress: 'required',
// fatherEmail: 'required', maritalStatus: 'required',
// fatherMobile: { fatherName: 'required',
// required: true, fatherEmail: 'required',
// regex: /^[0-9]{10}$/, fatherMobile: {
// }, required: true,
// fatherNationality: 'required', regex: /^[0-9]{10}$/,
// fatherReligion: 'required', },
// fatherMotherTongue: 'required', fatherNationality: 'required',
// fatherCommunity: 'required', fatherReligion: 'required',
// fatherSchoolInfo: 'required', fatherMotherTongue: 'required',
// fatherOccupation: 'required', fatherCommunity: 'required',
// fatherMonthlyIncome: 'required', fatherSchoolInfo: 'required',
// motherName: 'required', fatherOccupation: 'required',
// motherMobile: { fatherMonthlyIncome: 'required',
// regex: /^[0-9]{10}$/, motherName: 'required',
// }, motherMobile: {
// motherNationality: 'required', regex: /^[0-9]{10}$/,
// motherReligion: 'required', },
// motherMotherTongue: 'required', motherNationality: 'required',
// motherCommunity: 'required', motherReligion: 'required',
// motherSchoolInfo: 'required', motherMotherTongue: 'required',
// candidateImage: { motherCommunity: 'required',
// required: true, motherSchoolInfo: 'required',
// extension: ['jpg', 'png', 'jpeg', 'svg'], motherOccupation: 'required',
// fileSize: 1 * 1024 * 1024, candidateImage: {
// }, required: true,
// fatherImage: { extension: ['jpg', 'png', 'jpeg', 'svg'],
// required: true, fileSize: 1 * 1024 * 1024,
// extension: ['jpg', 'png', 'jpeg', 'svg'], },
// fileSize: 1 * 1024 * 1024, fatherImage: {
// }, required: true,
extension: ['jpg', 'png', 'jpeg', 'svg'],
fileSize: 1 * 1024 * 1024,
},
// motherImage: { // motherImage: {
// required: true, // required: true,
// extension: ['jpg', 'png', 'jpeg', 'svg'], // extension: ['jpg', 'png', 'jpeg', 'svg'],
...@@ -203,29 +206,32 @@ $(document).ready(function () { ...@@ -203,29 +206,32 @@ $(document).ready(function () {
religion: 'Please enter the religion', religion: 'Please enter the religion',
motherTongue: 'Please enter the mother tongue', motherTongue: 'Please enter the mother tongue',
community: 'Please specify the community', community: 'Please specify the community',
homeAddress: 'Please enter the home address',
correspondenceAddress: 'Please enter the correspondence address',
maritalStatus: 'Please choose an option', maritalStatus: 'Please choose an option',
fatherName: "Please enter the father's name", fatherName: "Please enter father's name",
fatherEmail: "Please enter the father's email", fatherEmail: "Please enter father's email",
fatherMobile: { fatherMobile: {
required: "Please enter the father's phone number", required: "Please enter father's phone number",
regex: 'Please enter a valid phone number', regex: 'Please enter a valid phone number',
}, },
fatherNationality: "Please enter the father's nationality", fatherNationality: "Please enter father's nationality",
fatherReligion: "Please enter the father's religion", fatherReligion: "Please enter father's religion",
fatherMotherTongue: "Please enter the father's mother tongue", fatherMotherTongue: "Please enter father's mother tongue",
fatherCommunity: "Please specify the father's community", fatherCommunity: "Please specify father's community",
fatherSchoolInfo: "Please enter the father's school name", fatherSchoolInfo: "Please enter father's school name",
fatherOccupation: "Please enter the father's occupation", fatherOccupation: "Please enter father's occupation",
fatherMonthlyIncome: "Please enter the father's monthly income", fatherMonthlyIncome: "Please enter father's monthly income",
motherName: "Please enter the mother's name", motherName: "Please enter mother's name",
motherMobile: { motherMobile: {
regex: 'Please enter a valid phone number', regex: 'Please enter a valid phone number',
}, },
motherNationality: "Please enter the mother's nationality", motherNationality: "Please enter mother's nationality",
motherReligion: "Please enter the mother's religion", motherReligion: "Please enter mother's religion",
motherMotherTongue: "Please enter the mother's mother tongue", motherMotherTongue: "Please enter mother's mother tongue",
motherCommunity: "Please specify the mother's community", motherCommunity: "Please specify mother's community",
motherSchoolInfo: "Please enter the mother's school name", motherSchoolInfo: "Please enter mother's school name",
motherOccupation: "Please enter mother's occupation",
candidateImage: { candidateImage: {
required: "Candidate's photo is required", required: "Candidate's photo is required",
extension: 'Only jpg, jpeg, png, svg files are allowed.', extension: 'Only jpg, jpeg, png, svg files are allowed.',
...@@ -316,6 +322,10 @@ $(document).ready(function () { ...@@ -316,6 +322,10 @@ $(document).ready(function () {
var errorElements = []; var errorElements = [];
// conditional validation on category // conditional validation on category
if (!formData.get('correspondenceAddress')) {
let correspondenceAddress = formData.get('homeAddress');
reconfiguredFormData.set('correspondenceAddress', correspondenceAddress);
}
if (formData.get('category') === 'Staff Child') { if (formData.get('category') === 'Staff Child') {
if (!formData.get('staffDepartment')) { if (!formData.get('staffDepartment')) {
$('#staffDepartment').addClass('is-invalid'); $('#staffDepartment').addClass('is-invalid');
...@@ -425,10 +435,10 @@ $(document).ready(function () { ...@@ -425,10 +435,10 @@ $(document).ready(function () {
} }
if (formData.get('motherImage').name == '') { if (formData.get('motherImage').name == '') {
$('#motherImage').addClass('is-invalid'); $('#motherImageInput').addClass('is-invalid');
$('#motherImage').next('.la-invalid-feedback').html('For Marital Status Married, Please provide mother image'); $('#motherImageInput').next('.la-invalid-feedback').html('For Marital Status Married, Please provide mother image');
$('#motherImage').prev('label').addClass('is-invalid'); $('#motherImageInput').prev('label').addClass('is-invalid');
errorElements.push('#motherImage'); errorElements.push('#motherImageInput');
} }
} }
...@@ -439,6 +449,6 @@ $(document).ready(function () { ...@@ -439,6 +449,6 @@ $(document).ready(function () {
return null; return null;
} }
return null; return reconfigureFormData;
} }
}); });
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>La Martiniere for Girls - Proof of Delivery</title> <title>Proof of Delivery</title>
<style> <style>
body { body {
font-family: Arial, sans-serif; font-family: Arial, sans-serif;
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
<div class="details" id="details"></div> <div class="details" id="details"></div>
<div class="footer"> <div class="footer">
<p>Please quote the reference <span class="email">piklughosh01@gmail.com</span> for further correspondence <p>Please quote the reference <span class="email"></span> for further correspondence
until such time the admission procedure is under way.</p> until such time the admission procedure is under way.</p>
</div> </div>
</div> </div>
...@@ -118,6 +118,7 @@ ...@@ -118,6 +118,7 @@
$('#details').html(userDataHtml); $('#details').html(userDataHtml);
$('#school').html(userObject.school); $('#school').html(userObject.school);
$('.email').html(userObject.fatherEmail);
} else { } else {
$('#details').html('<p>No user data found.</p>'); $('#details').html('<p>No user data found.</p>');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment