Commit 7cc22160 authored by Pratik Shrivastava's avatar Pratik Shrivastava

feat: initialize admission interview

parent b1c2378b
......@@ -199,6 +199,46 @@ public class AdmissionFormController {
response.setHeader("Content-Disposition", "attachment; filename=admission-form-list.pdf");
IOUtils.copy(pdfStream, response.getOutputStream());
}
@GetMapping(
value = "/admission-confirmation-form/download-form"
)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "SUCCESS"),
@ApiResponse(code = 400, message = "FAILED"),
@ApiResponse(code = 500, message = "Exception Occurred")
})
@ApiOperation(value = "")
public void downloadAdmissionConfirmationForm(
HttpServletRequest request,
HttpServletResponse response,
@RequestParam("apikey") String apiKey,
@RequestParam("formIds") String formIds
) throws Exception {
// TODO: validation of api key using redis
List<Long> formIdList = Stream.of(formIds.split(","))
.map(Long::valueOf)
.collect(Collectors.toList());
if (formIdList.isEmpty()) {
throw new Exception("Provide formIds to download");
}
List<AdmissionFormData> admissionFormDataList =
this.admissionFormDAOController.getAdmissionFormDataListByIds(formIdList);
if (admissionFormDataList.isEmpty()) {
throw new Exception("No Admission Data Found");
}
String output = templateService
.generateAdmissionConfirmationFormListTemplate(admissionFormDataList);
ByteArrayInputStream pdfStream = pdfService.convertHtmlToPdf(output);
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
response.setHeader("Content-Disposition", "attachment; filename=admission-confirmation-form-list.pdf");
IOUtils.copy(pdfStream, response.getOutputStream());
}
@GetMapping(
value = "/admission-form/download-counsellor-scoring-template"
......
......@@ -2,6 +2,7 @@ package com.example.LaMartin.admission.dao.repository;
import com.example.LaMartin.admission.mapper.AdmissionFormCountMapper;
import com.example.LaMartin.admission.mapper.AdmissionFormMapper;
import com.example.LaMartin.admission.mapper.AdmissionFormPreviewMapper;
import com.example.LaMartin.admission.model.AdmissionFormData;
import com.example.LaMartin.admission.pojo.AdmissionFormCount;
import lombok.AllArgsConstructor;
......@@ -199,7 +200,7 @@ public class AdmissionFormDataRepository {
parameters.addValue("correspondenceEmail", correspondenceEmail);
}
return namedParameterJdbcTemplate
.query(sql.toString(), parameters, new AdmissionFormMapper());
.query(sql.toString(), parameters, new AdmissionFormPreviewMapper());
}
public List<AdmissionFormData> getAdmissionFormDataListByIds(List<Long> ids) {
......
package com.example.LaMartin.admission.mapper;
import com.example.LaMartin.admission.model.AdmissionFormData;
import com.example.LaMartin.common.utils.RowMapperUtil;
import org.jetbrains.annotations.NotNull;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;
import java.sql.ResultSet;
import java.sql.SQLException;
@Component
public class AdmissionFormPreviewMapper implements RowMapper<AdmissionFormData> {
@Override
public AdmissionFormData mapRow(@NotNull ResultSet rs, int rowNum) throws SQLException {
AdmissionFormData formData = new AdmissionFormData();
formData.setFullName(RowMapperUtil.getString(rs, "full_name"));
formData.setFatherName(RowMapperUtil.getString(rs, "father_name"));
formData.setFatherEmail(RowMapperUtil.getString(rs, "father_email"));
formData.setMotherName(RowMapperUtil.getString(rs, "mother_name"));
formData.setInteractionDate(RowMapperUtil.getString(rs, "interaction_date"));
formData.setInteractionTime(RowMapperUtil.getString(rs, "interaction_time"));
return formData;
}
}
......@@ -27,6 +27,23 @@ public class TemplateService {
return templateEngine.process("AdmissionFormListTemplate", context);
}
public String generateAdmissionConfirmationFormListTemplate(List<AdmissionFormData> admissionFormDataList) {
// for (AdmissionFormData admissionFormData: admissionFormDataList)
// {
// String originalDate = "2024-07-04";
// LocalDate date = LocalDate.parse(admissionFormData.getInteractionDate());
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
// admissionFormData.setInteractionDate(date.format(formatter));
// }
Context context = new Context();
context.setVariable("admissionFormList", admissionFormDataList);
context.setVariable("serverPath", settings.getStaticServerPath());
return templateEngine.process("AdmissionConfimationFormListTemplate", context);
}
public String generateAdmissionInterviewTemplate(@NotNull AdmissionFormData admissionFormData) {
String originalDate = "2024-07-04"; // Example date string
......
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="en">
<head>
<title>Intimation for Admission</title>
<style>
* {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
font-size: 12px;
}
body {
margin: 0px 20px;
}
.header,
.content,
.footer {
text-align: center;
position: relative;
width: 100%;
}
.content {
text-align: justify;
}
.left,
.center,
.right {
display: inline-block;
}
.left{
position: absolute;
left: 0;
}
.right{
position: absolute;
right: 0;
}
.middle{
margin: 0 auto;
text-align: center;
}
.header img {
height: 80px;
}
.content {
margin-top: 10px;
}
.content p {
margin: 5px 0;
}
.content b {
font-weight: bold;
}
.account-details,
.fee-details {
width: 100%;
margin-top: 20px;
border-collapse: collapse;
}
.account-details td,
.fee-details td,
.fee-details th {
border: 1px solid black;
padding: 5px;
text-align: left;
}
.fee-details th {
text-align: center;
}
.signature {
margin-top: 40px;
text-align: left;
}
.signature img{
width: 18%;
height: 18%;
}
</style>
</head>
<body>
<div class="container" th:each="admissionForm : ${admissionFormList}">
<div class="header">
<div class="left">
<h4>Supriyo Dhar, HRM, MBA, LLB<br />Secretary</h4>
</div>
<div class="center">
<img th:src="@{${serverPath + 'static/la-martin-logo.png'}}" alt="Logo" height="80px"/>
<!-- <img src="la-martin-logo copy.png" alt="Logo" height="80px" /> -->
</div>
<div class="right">
<h2>La Martiniere</h2>
</div>
</div>
<div class="content">
<div class="left">
<p><b>To,</b><br />
<b th:text="${admissionForm.fatherName}">Pratik Shrivastava</b>
</p>
</div>
<div class="right">
<p><b th:text="${admissionForm.interactionDate}">17/07/2024</b></p>
</div>
<br/>
<br/>
<br/>
<div class="middle">
<strong>Sub: <u>Intimation for Admission</u></strong>
</div>
<p>Dear Parent/s,</p>
<br />
<p>We are pleased to inform you that your son <b th:text="${admissionForm.fullName}"></b> has been
granted admission to <b th:text="${admissionForm.admissionClass}"></b> for the year
2024-2025.</p>
<p>Please contact the <b>Principal's office of La Martiniere for Boys, 11 Dr. U.N. Brahmachari Street,
Kolkata 700 017</b>, in person, along with a printout of this letter on <b>05/04/2024 at 10:00am</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>“La
Martiniere Calcutta”</b> or bank transfer, at the time of admission.</p>
<p>For the <b>1<sup>st</sup> Quarter (April to June 2024)</b>, parents are to pay <b>Rs. 1,69,500/- (Rupees
One Lacs Sixty Nine Thousand Five Hundred only)</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 />
<p><b><u>Penalty of Rs.5000/- will be levied if fees not paid on the due date.</u></b></p>
<table class="account-details">
<tr>
<td>Account Name</td>
<td>: La Martiniere, Calcutta</td>
</tr>
<tr>
<td>Account Number</td>
<td>: 031201001229</td>
</tr>
<tr>
<td>Bank Name</td>
<td>: ICICI Bank, Gorky Terrace</td>
</tr>
<tr>
<td>Account Type</td>
<td>: Savings</td>
</tr>
<tr>
<td>RTGS/NEFT/IFS Code</td>
<td>: ICIC0000312</td>
</tr>
</table>
<br />
<p>Please email the enclosed format to <b>lmcao@rediffmail.com</b> for confirmation of your payment and also
bring a hard copy while visiting Principal’s Office.</p>
<table class="fee-details">
<tr>
<th>Quarters</th>
<th>Amount</th>
<th>Date of Payment</th>
</tr>
<tr>
<td>1<sup>st</sup> Quarter (April to June 2024)</td>
<td>Rs. 1,69,500.00</td>
<td>On the date of admission</td>
</tr>
<tr>
<td>2<sup>nd</sup> Quarter (July to Sept. 2024)</td>
<td>Rs. 1,24,500.00</td>
<td>1<sup>st</sup> to 5<sup>th</sup> July, 2024</td>
</tr>
<tr>
<td>3<sup>rd</sup> Quarter (Oct to Dec. 2024)</td>
<td>Rs. 1,24,500.00</td>
<td>1<sup>st</sup> to 5<sup>th</sup> Oct. 2024</td>
</tr>
<tr>
<td>4<sup>th</sup> Quarter (Jan to March 2025)</td>
<td>Rs. 1,24,500.00</td>
<td>6<sup>th</sup> to 11<sup>th</sup> Jan 2025</td>
</tr>
<tr>
<td><b>Total</b></td>
<td colspan="2"><b>Rs 5,43,000.00</b></td>
</tr>
</table>
<div class="signature">
<p>Yours faithfully,</p>
<!-- <img th:src="@{${serverPath + 'static/signature.png'}}" alt="Logo" height="80px" /> -->
<img src="signature.png" alt="Logo" height="80px" />
<p><b>SUPRIYO DHAR</b><br />Secretary<br />La Martiniere, Kolkata</p>
</div>
<div class="footer">
<div class="left">
<p>11 Dr. U.N. Brahmachari Street<br />Kolkata - 700 017 (INDIA)</p>
</div>
<div class="center">
<p>+91-33-4040-6600/01<br />22890112(D)</p>
</div>
<div class="right">
<p>secretary@lamartiniere.co<br />lamartiniere.co</p>
</div>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
......@@ -55,7 +55,10 @@
<button id="summary-popup-btn" class="btn btn-success btn-sm">Download Score Sheets</button>
<button id="download-admission-data-btn" class="btn btn-success btn-sm">Download Admission Data</button>
</div>
<button id="bookAppointmentBtn" class="btn btn-primary btn-sm">Schedule Appointment</button>
<div>
<button id="bookAppointmentBtn" class="btn btn-primary btn-sm">Schedule Admission</button>
<button id="bookAppointmentBtn" class="btn btn-primary btn-sm">Schedule Appointment</button>
</div>
</div>
</div>
......
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