Commit 4ecb9a7f authored by Deep Dey's avatar Deep Dey

updated new form validation logic

parent 101e6637
package com.example.LaMartin.admission.dao.controller;
import static com.example.LaMartin.constants.EmailConstants.BCC_LM_BOYS;
import static com.example.LaMartin.constants.EmailConstants.BCC_LM_GIRLS;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.List;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import com.example.LaMartin.admission.dao.repository.AdmissionFormDataRepository;
import com.example.LaMartin.admission.model.AdmissionFormData;
import com.example.LaMartin.admission.pojo.AdmissionFormCount;
......@@ -9,21 +24,8 @@ import com.example.LaMartin.common.service.FileStorageService;
import com.example.LaMartin.common.service.PdfService;
import com.example.LaMartin.common.service.TemplateService;
import com.example.LaMartin.config.Settings;
import lombok.AllArgsConstructor;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.List;
import java.util.Objects;
import static com.example.LaMartin.constants.EmailConstants.*;
import lombok.AllArgsConstructor;
@Controller
@AllArgsConstructor(onConstructor_ = @__({@Autowired}))
......@@ -49,6 +51,12 @@ public class AdmissionFormDAOController {
throw new Exception("Father's Email already Exists");
}
}
if (formData.getAdmissionClass().equals("Lower Nursery")) {
if(!formData.getDateOfBirth().startsWith("2023")) {
throw new Exception("Date of Birth should be 2023");
}
}
if (formData.getCandidateImage() == null || formData.getCandidateImage().isEmpty()) {
formData.setCandidateImageName("candidate.png");
......
......@@ -311,7 +311,24 @@
granted Provisional admission to <b th:text="${admissionForm.admissionClass}"></b> for the year <span th:text="${admissionForm.sessionYear}">2025 - 2026</span>, subject to Interaction/Interview with Principal.
</p>
<div class="middle">
<b> BOTH PARENTS AND CANDIDATE MUST ATTEND THE INTERACTION.</b>
<b>
BOTH PARENTS AND CANDIDATE MUST ATTEND THE INTERACTION.
<span th:if="${admissionForm.school == 'La Martiniere for Girls'}">
<span th:if="${admissionForm.admissionClass != 'Lower Nursery'
and admissionForm.admissionClass != 'Upper Nursery'
and admissionForm.admissionClass != 'Kindergarten'}">
<br />THERE WILL BE A WRITTEN TEST FOR THE CANDIDATE.
</span>
</span>
<span th:if="${admissionForm.school == 'La Martiniere for Boys'}">
<span th:if="${admissionForm.admissionClass != 'Lower Nursery'
and admissionForm.admissionClass != 'Upper Nursery'
and admissionForm.admissionClass != 'Kindergarten'
and admissionForm.admissionClass != 'Class 1'}">
<br />THERE WILL BE A WRITTEN TEST FOR THE CANDIDATE.
</span>
</span>
</b>
</div>
<p>
Please contact the
......@@ -327,7 +344,7 @@
</strong> in person, along with a printout of this letter on <b><span th:text="${admissionForm.admissionDate}"></span> at <span th:text="${admissionForm.admissionTime}"></span></b> for necessary formalities.</p>
<p>Parents willing to pay the full year fee may do so, or pay quarterly by way of Pay Order favouring <b>&quot;La
Martiniere Calcutta&quot;</b> or bank transfer, at the time of admission.</p>
<p>For the <b>1<sup>st</sup> &amp; 2<sup>nd</sup> Quarter fees (April to September <span th:text="${#strings.substring(admissionForm.sessionYear, 0, 4)}"></span>)</b>, parents are to pay Rs.<b><span th:text="${admissionAmountList[__${formIndex.index}__]}"></span>/-</b> towards Tuition Fees, Session Fees,
<p>For the <b>1<sup>st</sup> Quarter fees (April to June <span th:text="${#strings.substring(admissionForm.sessionYear, 0, 4)}"></span>)</b>, parents are to pay Rs.<b><span th:text="${fees.get(0)}"></span>/-</b> towards Tuition Fees, Session Fees,
Infrastructure Development Fees, Admission Fees, Building Development Fees and Security Deposit
(refundable). The amount may be transferred directly to the following account.</p>
<br />
......
......@@ -152,7 +152,24 @@
granted Provisional admission to <b th:text="${admissionForm.admissionClass}"></b> for the year <span th:text="(${admissionForm.sessionYear})">2025 - 2026</span>, subject to Interaction/Interview with Principal.
</p>
<div class="middle">
<b> BOTH PARENTS AND CANDIDATE MUST ATTEND THE INTERACTION.</b>
<b>
BOTH PARENTS AND CANDIDATE MUST ATTEND THE INTERACTION.
<span th:if="${admissionForm.school == 'La Martiniere for Girls'}">
<span th:if="${admissionForm.admissionClass != 'Lower Nursery'
and admissionForm.admissionClass != 'Upper Nursery'
and admissionForm.admissionClass != 'Kindergarten'}">
<br />THERE WILL BE A WRITTEN TEST FOR THE CANDIDATE.
</span>
</span>
<span th:if="${admissionForm.school == 'La Martiniere for Boys'}">
<span th:if="${admissionForm.admissionClass != 'Lower Nursery'
and admissionForm.admissionClass != 'Upper Nursery'
and admissionForm.admissionClass != 'Kindergarten'
and admissionForm.admissionClass != 'Class 1'}">
<br />THERE WILL BE A WRITTEN TEST FOR THE CANDIDATE.
</span>
</span>
</b>
</div>
<p>
Please contact the
......@@ -168,7 +185,7 @@
</strong> in person, along with a printout of this letter on <b><span th:text="${admissionForm.admissionDate}"></span> at <span th:text="${admissionForm.admissionTime}"></span></b> for necessary formalities.</p>
<p>Parents willing to pay the full year fee may do so, or pay quarterly by way of Pay Order favouring <b>&quot;La
Martiniere Calcutta&quot;</b> or bank transfer, at the time of admission.</p>
<p>For the <b>1<sup>st</sup> &amp; 2<sup>nd</sup> Quarter fees (April to September <span th:text="${#strings.substring(admissionForm.sessionYear, 0, 4)}"></span>)</b>, parents are to pay Rs.<b><span th:text="${admissionAmount}"></span>/-</b> towards Tuition Fees, Session Fees,
<p>For the <b>1<sup>st</sup> Quarter fees (April to June <span th:text="${#strings.substring(admissionForm.sessionYear, 0, 4)}"></span>)</b>, parents are to pay Rs.<b><span th:text="${fees.get(0)}"></span>/-</b> towards Tuition Fees, Session Fees,
Infrastructure Development Fees, Admission Fees, Building Development Fees and Security Deposit
(refundable). The amount may be transferred directly to the following account (IMPS / RTGS / NEFT).</p>
<br />
......
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