window.addEventListener('load', function() {
 let editor = ace.edit('jsonEditor');
// editor.setTheme("ace/theme/monokai");
 editor.session.setMode("ace/mode/json");
 let textarea = $('textarea[name="parameters"]');
 editor.getSession().on("change", function () {
  textarea.val(editor.getSession().getValue());
 });

 $(function() {

  if($('#added:not([readonly])').length) {
   $('#added').datepicker({
    format: "yyyy-mm-dd",
    autoclose: true
   });
  }

  if($('#updated, #used').length) {
   $('#updated, #used').datepicker({
    format: "yyyy-mm-dd",
    autoclose: true
   });
  }
 });
});
