fix table searching issues

add-stitching-dashboard
Usama Khan 2025-04-24 10:21:16 -07:00
parent 4c01a5ee1a
commit 4a94cac214
3 changed files with 52 additions and 30 deletions

View File

@ -768,6 +768,7 @@ public class ReportingService {
List<CuttingJobCardItemWrapper> wrappers = jobCardItems.stream().map(item -> { List<CuttingJobCardItemWrapper> wrappers = jobCardItems.stream().map(item -> {
CuttingJobCardItemWrapper wrapper = new CuttingJobCardItemWrapper(); CuttingJobCardItemWrapper wrapper = new CuttingJobCardItemWrapper();
wrapper.setArticleName(jobCard.getArticleName()); wrapper.setArticleName(jobCard.getArticleName());
wrapper.setJobCardId(jobCard.getId());
wrapper.setJobCardCode(jobCard.getCode()); wrapper.setJobCardCode(jobCard.getCode());
wrapper.setSku(item.getSku()); wrapper.setSku(item.getSku());
wrapper.setPoName(jobCard.getPurchaseOrderId()); wrapper.setPoName(jobCard.getPurchaseOrderId());
@ -781,9 +782,6 @@ public class ReportingService {
jobCardItemsStitchingDetailsMap.computeIfAbsent(accountId, k -> new ArrayList<>()).addAll(wrappers); jobCardItemsStitchingDetailsMap.computeIfAbsent(accountId, k -> new ArrayList<>()).addAll(wrappers);
} }
System.out.println(jobCardItemsStitchingDetailsMap);
System.out.println(totalStitchingBasedOnAccountID);
stitchingDetails.put("totalStitchingBasedOnAccountID", totalStitchingBasedOnAccountID); stitchingDetails.put("totalStitchingBasedOnAccountID", totalStitchingBasedOnAccountID);
stitchingDetails.put("jobCardItemsStitchingDetailsMap", jobCardItemsStitchingDetailsMap); stitchingDetails.put("jobCardItemsStitchingDetailsMap", jobCardItemsStitchingDetailsMap);
stitchingDetails.put("Date Wise Stitching", dateWiseProduction); stitchingDetails.put("Date Wise Stitching", dateWiseProduction);

View File

@ -23,7 +23,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<table th:if="${#lists.size(transactions) != 0 && #lists != null }" class="table table-bordered font-sm"> <table th:if="${#lists.size(transactions) != 0 && #lists != null }" class="table table-bordered font-sm mb-4" data-account-tables>
<thead> <thead>
<tr> <tr>
<th>ID</th> <th>ID</th>
@ -62,6 +62,32 @@
</div> </div>
<div th:replace="_fragments :: page-footer-scripts"></div> <div th:replace="_fragments :: page-footer-scripts"></div>
<script th:inline="javascript"> <script th:inline="javascript">
// Initialize DataTables for each individual table
$('table[data-account-tables]').each(function () {
const $table = $(this);
// Prevent reinitializing if already done
if (!$.fn.DataTable.isDataTable($table)) {
$table.DataTable({
pageLength: 5,
searching: true,
lengthChange: false,
processing: false,
dom: `
<'row'<'col-sm-5'B><'col-sm-7'f>>
<'row'<'col-sm-12't>>
<'row'<'col-sm-5'i><'col-sm-7'p>>`,
buttons: [{
extend: 'excel',
text: '',
className: 'bi bi-file-earmark-spreadsheet btn-sm d-none' // Keep it hidden
}]
});
}
});
(async function () { (async function () {
const $selectAllCheckBox = $('[data-checkbox-all]'); const $selectAllCheckBox = $('[data-checkbox-all]');

View File

@ -2,7 +2,7 @@
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml" <html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml"
xmlns:ctp="http://www.w3.org/1999/xhtml"> xmlns:ctp="http://www.w3.org/1999/xhtml">
<head th:replace="_fragments :: head('Cutting Report')"></head> <head th:replace="_fragments :: head('Stitching Report')"></head>
<body> <body>
<div class="container-fluid"> <div class="container-fluid">
@ -28,7 +28,7 @@
</div> </div>
</div> </div>
<div class="mt-3" th:if="${stitching.get('stitchingAccount') != null}" <div class="mt-3" th:if="${stitching.get('stitchingAccount') != null && stitching.get('jobCardItemsStitchingDetailsMap').get(stitchingAccount.id) != null}"
th:each="stitchingAccount, index : ${stitching.get('stitchingAccount')}"> th:each="stitchingAccount, index : ${stitching.get('stitchingAccount')}">
<div class="bg-dark text-white py-2 px-3 fs-5 fw-bold text-center mb-2" <div class="bg-dark text-white py-2 px-3 fs-5 fw-bold text-center mb-2"
th:text="${stitchingAccount.title}"></div> th:text="${stitchingAccount.title}"></div>
@ -56,7 +56,7 @@
title="Transactions"> title="Transactions">
<span data-dropdown-icon-transactions class="bi bi-caret-right-fill"></span> <span data-dropdown-icon-transactions class="bi bi-caret-right-fill"></span>
</td> </td>
<td th:text="${wrap.jobCardId}"></td> <td th:text="${wrap.jobCardCode}"></td>
<td th:text="${wrap.poName}"></td> <td th:text="${wrap.poName}"></td>
<td th:text="${wrap.sku}"></td> <td th:text="${wrap.sku}"></td>
<td th:text="${wrap.articleName}"></td> <td th:text="${wrap.articleName}"></td>
@ -69,17 +69,15 @@
</div> </div>
</main> </main>
</div> </div>
<div th:replace="_fragments :: page-footer-scripts"></div>
<script> <script>
const $body = $('body'); const $body = $('body');
// Initialize DataTables for each individual table // Initialize DataTables for each individual table
$('table[data-account-table]').each(function () { $('table[data-account-table]').each(function () {
$(this).DataTable({ $(this).DataTable({
paging: false,
pageLength: 100, pageLength: 100,
searching: true, searching: false,
lengthChange: false, lengthChange: false,
processing: false, processing: false,
dom: ` dom: `
@ -89,7 +87,7 @@
buttons: [{ buttons: [{
extend: 'excel', extend: 'excel',
text: '', text: '',
className: 'bi bi-file-earmark-spreadsheet btn-sm' className: 'bi bi-file-earmark-spreadsheet btn-sm d-none'
}] }]
}); });
}); });