diff --git a/manager/bakery/bakery_stock.php b/manager/bakery/bakery_stock.php index 2df8000ee..c32671041 100644 --- a/manager/bakery/bakery_stock.php +++ b/manager/bakery/bakery_stock.php @@ -140,7 +140,7 @@ if (!$authInfo) { No. - 품목 + 품목 바코드 전일재고 생산 diff --git a/manager/bakery/tail.sub.php b/manager/bakery/tail.sub.php index 9627c8c64..348ee6170 100644 --- a/manager/bakery/tail.sub.php +++ b/manager/bakery/tail.sub.php @@ -71,18 +71,21 @@ $(document).ready(function() { function attachThClickEvent() { $('table').off('click', 'th'); // 기존 이벤트 제거 - $('table').on('click', 'th', function() { + + // #bakeryTable에만 정렬 이벤트 등록 + $('#bakeryTable').on('click', 'th', function() { if ($(this).hasClass('no-click')) { - return; // no-click 클래스를 가진 th 요소는 클릭 이벤트를 무시하고 이후 코드 실행 안함 + return; // no-click 클래스 th는 무시 } - console.log('th clicked:', $(this).data('column')); // 로그 추가 const column = $(this).data('column'); - let order = $(this).data('order') || 'asc'; // 기본값 'asc' + let order = $(this).data('order') || 'asc'; order = order === 'asc' ? 'desc' : 'asc'; $(this).data('order', order); - sortTable(column, order); // 테이블 정렬 함수 호출 + sortTable(column, order); }); + + // 다른 테이블(#bakeryTotalTable 등)은 클릭해도 정렬 이벤트 없음 } function sortTable(column, order) { @@ -102,9 +105,22 @@ $(document).ready(function() { $.each(rows, (index, row) => { tbody.append(row); - // 정렬 후 No. 열의 값을 재설정 $(row).find('td').eq(0).text(index + 1); }); + + // 아이콘 업데이트 + // 모든 th의 .sort-icon 초기화 (모든 아이콘 초기화) + $('#bakeryTable th .sort-icon').removeClass('fa fa-sort-up fa-sort-down').text(''); + + // 정렬된 컬럼의 아이콘만 선택하기 + const $icon = $(`#bakeryTable th[data-column="${column}"] > .sort-icon`); + if (order === 'asc') { + // FontAwesome 아이콘 클래스 사용 시 + $icon.addClass('fa fa-sort-up').text(''); + } else { + $icon.addClass('fa fa-sort-down').text(''); + } + } function getColumnIndex(column) {