Commit 72dddea7 authored by Deep Dey's avatar Deep Dey

feat: add api template to download interaction excel

parent 808ce7dc
...@@ -317,6 +317,49 @@ public class AdmissionFormController { ...@@ -317,6 +317,49 @@ public class AdmissionFormController {
IOUtils.copy(pdfStream, response.getOutputStream()); IOUtils.copy(pdfStream, response.getOutputStream());
} }
@GetMapping(
value = "/admission-form/download-master-interaction-excel"
)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "SUCCESS"),
@ApiResponse(code = 400, message = "FAILED"),
@ApiResponse(code = 500, message = "Exception Occurred")
})
@ApiOperation(value = "")
public void downloadMasterInteractionExcel(
HttpServletRequest request,
HttpServletResponse response,
@RequestParam("apikey") String apiKey,
@RequestParam String schoolName,
@RequestParam String interactionDate
) throws Exception {
List<AdmissionFormData> admissionFormDataList =
this.admissionFormDAOController.getAdmissionFormDataList(
schoolName,
null,
interactionDate,
null,
null
);
if (admissionFormDataList.isEmpty()) {
throw new Exception("No Admission Data Found");
}
//TODO: write logic to download excel
// String output = templateService
// .generateMasterInteractionTemplate(admissionFormDataList);
//
// ByteArrayInputStream pdfStream = pdfService.convertHtmlToPdf(output);
//
// response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
// response.setHeader("Content-Disposition", "attachment; filename=master-interaction-template.pdf");
// IOUtils.copy(pdfStream, response.getOutputStream());
}
@GetMapping( @GetMapping(
value = "/admission-form/count", value = "/admission-form/count",
produces = MediaType.APPLICATION_JSON_VALUE produces = MediaType.APPLICATION_JSON_VALUE
......
...@@ -154,8 +154,9 @@ ...@@ -154,8 +154,9 @@
</div> </div>
<div class="book-appointment-box2"> <div class="book-appointment-box2">
<button id="interactionScoring" class="btn btn-primary btn-sm">Interaction Scoring Sheet</button> <button id="interactionScoring" class="btn btn-primary btn-sm">Interaction Scoring Sheet</button>
<button id="counsellorScoring" class="btn btn-secondary btn-sm">Counsellor Scoring Sheet</button>
<button id="download-interaction-sheet-btn" class="btn btn-success btn-sm">Download Interaction Sheet</button> <button id="download-interaction-sheet-btn" class="btn btn-success btn-sm">Download Interaction Sheet</button>
<button id="download-interaction-excel-btn" class="btn btn-success btn-sm">Download Interaction Excel</button>
<button id="counsellorScoring" class="btn btn-secondary btn-sm">Counsellor Scoring Sheet</button>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -341,4 +341,33 @@ $(document).ready(function () { ...@@ -341,4 +341,33 @@ $(document).ready(function () {
) )
.focus(); .focus();
}); });
$('#download-interaction-excel-btn').click(function () {
let schoolName = $('#schoolFilterReport').val();
let interactionDate = $('#dateFilterReport').val();
if (!schoolName || !interactionDate) {
$('#reportModal').modal('hide');
$('#messageModal .modal-title').text('Error');
$('#messageModal .modal-body').text(
'Please select school and date to download counsellor scoring sheet.'
);
$('#messageModal').modal('show');
return;
}
window
.open(
BASE_URL_LAMARTIN +
`/admission-form/download-master-interaction-excel?apikey=${
loginData.apiKey
}&schoolName=${
schoolName
}&interactionDate=${
interactionDate
}`,
'_blank'
)
.focus();
});
}); });
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