Show Filter
<script>
  document.addEventListener("DOMContentLoaded", function() {
  const filterSets = [
    
    //You can add any additional meta to filter below here
    
    {
      selectId: 'select-price',
      minInputId: 'input-price .min',
      maxInputId: 'input-price .max',
      eventName: 'filter_price_change',
      defaultMin: 1000000,
      defaultMax: 16198000000
    },
    {
      selectId: 'select-building',
      minInputId: 'input-building .min',
      maxInputId: 'input-building .max',
      eventName: 'filter_building_change',
      defaultMin: 10,
      defaultMax: 2000
    },
    {
      selectId: 'select-land',
      minInputId: 'input-land .min',
      maxInputId: 'input-land .max',
      eventName: 'filter_land_change',
      defaultMin: 10,
      defaultMax: 20000
    }
  ];
  
  const applyFilterButton = document.querySelector('.filter-btn');
  const resetFilterButton = document.querySelector('#reset-btn');

  filterSets.forEach(filterSet => {
    const selectElement = document.getElementById(filterSet.selectId);
    const minInput = document.querySelector(`#${filterSet.minInputId}`);
    const maxInput = document.querySelector(`#${filterSet.maxInputId}`);

    // Ambil nilai default dari opsi placeholder
    const placeholderOption = selectElement.querySelector('option[value=""]');
    const defaultMin = parseInt(placeholderOption.getAttribute('data-min')) || filterSet.defaultMin;
    const defaultMax = parseInt(placeholderOption.getAttribute('data-max')) || filterSet.defaultMax;

    function updateInputsAndTriggerEvent() {
      const selectedOption = selectElement.options[selectElement.selectedIndex];
      const min = parseInt(selectedOption.getAttribute('data-min')) || defaultMin;
      const max = parseInt(selectedOption.getAttribute('data-max')) || defaultMax;

      minInput.setAttribute('value', min);
      maxInput.setAttribute('value', max);
      minInput.dispatchEvent(new Event('input', { bubbles: true }));
      minInput.dispatchEvent(new Event('change', { bubbles: true }));
      maxInput.dispatchEvent(new Event('input', { bubbles: true }));
      maxInput.dispatchEvent(new Event('change', { bubbles: true }));
      window.dispatchEvent(new CustomEvent(filterSet.eventName));
    }

    selectElement.addEventListener("change", updateInputsAndTriggerEvent);
    applyFilterButton.addEventListener('click', updateInputsAndTriggerEvent);

    resetFilterButton.addEventListener('click', () => {
      selectElement.value = "";
      minInput.setAttribute('value', defaultMin);
      maxInput.setAttribute('value', defaultMax);
      minInput.dispatchEvent(new Event('input', { bubbles: true }));
      minInput.dispatchEvent(new Event('change', { bubbles: true }));
      maxInput.dispatchEvent(new Event('input', { bubbles: true }));
      maxInput.dispatchEvent(new Event('change', { bubbles: true }));
      window.dispatchEvent(new CustomEvent(filterSet.eventName));
    });
  });
});

</script>  
Single Family Offsite Built

{post_label}

Single Family Offsite Built

Valley Center,
Kansas

This charming is home nestled within Southborough Estates in Southwest Wichita. Located in a quiet and well-maintained neighborhood, this 3-bedroom, 2-bathroom home features freshly painted walls and new carpet on......

sqft
2,000
beds
4
baths
4
View
Single Family Onsite Built

{post_label}

Single Family Onsite Built

Wichita,
Kansas

Welcome to this move-in-ready 4-bedroom, 2-bathroom home boasting additional versatile rooms that have been utilized as bedrooms, a game room, or an office.

sqft
2,000
beds
4
baths
4
View
Single Family Residence

{post_label}

Single Family Residence

Pomona,
Kansas

Story home in the Hillcrest Farm Subdivision backing to greenspace, allowing you the ultimate privacy in a prime location.

sqft
2,000
beds
4
baths
4
View