$(document).ready( function () {
  $("#datepicker").datepicker();
  
  $(".confirm-export").confirm({
    "text": "Mark current batch exported?",
    "title": "Export confrimation",
    confirm: function() {
         window.location = "/export-commit";
    },
  });
  
  if( $('.addedLink').length > 0) {
     setTimeout(function (){
        window.close();
    }, 500);
  }
  
  $("form.form-add").submit( function(e) {
    if ( $(".add-category").val() == -1) {
        e.preventDefault();
        $(".add-category-col").addClass("has-error");
    } 
  });
  
  $(".category-change-parent").change(function (e) {
       e.target.parentElement.submit();
  });
  
   $('.cat-delete').confirm({
    text: "Are you sure you want to delete this category?",
    title: "Confrimation required",
    confirmButton: "Yes",
    cancelButton: "No",
  });
});