$(document).ready(function () {
  if ($.isFunction($.fn.datepicker)) {
    $.fn.datepicker.defaults.format = "dd-mm-yyyy";
    $.fn.datepicker.defaults.autoclose = true;
    $.fn.datepicker.defaults.todayHighlight = true;
    $.fn.datepicker.defaults.zIndexOffset = 1040;
  }

  $(".hapus").on("click", function (e) {
    e.preventDefault();
    let form = $(this).parent();
    console.log(form);
    swal({
      title: "Apakah data akan di hapus",
      type: "warning",
      showCancelButton: true,
      confirmButtonColor: "#3085d6",
      cancelButtonColor: "#d33",
      confirmButtonText: "Hapus",
    }).then((result) => {
      if (result.value) {
        form.submit();
      } else {
        swal("Aman!", "Data Tidak Di Hapus", "success");
      }
    });
  });

  $(".tab-nav").eq(0).addClass("active");
  $(".tab-pane").eq(0).addClass("show active");
});
