$(document).ready(function(){
  $('#travel-date, #travel-date-end').daterangepicker({
    singleDatePicker: true,
    locale: {
      format: 'YYYY-MM-DD'
    }
  });

  customDateRange($('#travel-date-filter'));

  $('.btn-remove').on('click', function(e) {
    e.preventDefault();

    const itemId = $(this).data('id');
    const modal = $('#remove-trip-warning-modal');
    modal.find('#removeBtn').data('id', itemId);
  });

  $('#removeBtn').on('click', function(e) {
    e.preventDefault();
    const itemId = $(this).data('id');
    window.__api__.remove(`/trips/${itemId}/delete`, itemId);
  })
});
