/**
 * Page: WMS & Inventory Reports
 * -----------------------------------------------------------------------------
 * Handles common functionality for inventory reports:
 * - Inventory Valuation Report
 * - Stock Movement Report
 * - Low Stock Report
 */

$(function () {
  'use strict';

  // Initialize Select2 dropdowns
  if ($('.select2').length) {
    $('.select2').each(function () {
      $(this).select2({
        placeholder: $(this).data('placeholder') || (typeof pageData !== 'undefined' && pageData.labels?.selectAnOption) || 'Select an option',
        allowClear: true,
        dropdownParent: $(this).parent()
      });
    });
  }

  // Initialize Flatpickr date pickers
  if ($('.flatpickr-date').length) {
    $('.flatpickr-date').flatpickr({
      dateFormat: 'Y-m-d',
      allowInput: true
    });
  }
});
