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

View File

@ -23,7 +23,7 @@
<div class="container">
<div class="row">
<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>
<tr>
<th>ID</th>
@ -62,25 +62,51 @@
</div>
<div th:replace="_fragments :: page-footer-scripts"></div>
<script th:inline="javascript">
(async function () {
const $selectAllCheckBox = $('[data-checkbox-all]');
$selectAllCheckBox.change(function () {
if ($selectAllCheckBox.prop('checked')) {
// When parent checkbox is checked, check all child checkboxes
$('[name="parent-doc-type-ids"]').each(function () {
let $this = $(this);
$this.prop('checked', true);
});
} else {
// When parent checkbox is unchecked, uncheck all child checkboxes
$('[name="parent-doc-type-ids"]').each(function () {
let $this = $(this);
$this.prop('checked', false);
});
}
});
})(jQuery)
// 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 () {
const $selectAllCheckBox = $('[data-checkbox-all]');
$selectAllCheckBox.change(function () {
if ($selectAllCheckBox.prop('checked')) {
// When parent checkbox is checked, check all child checkboxes
$('[name="parent-doc-type-ids"]').each(function () {
let $this = $(this);
$this.prop('checked', true);
});
} else {
// When parent checkbox is unchecked, uncheck all child checkboxes
$('[name="parent-doc-type-ids"]').each(function () {
let $this = $(this);
$this.prop('checked', false);
});
}
});
})(jQuery)
</script>
</body>

View File

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