"use strict";

$(document).ready(function () {
  $("#sf_msg_container").empty();
  $("#sf_msg_container").show();
  $('#sf-spinner-panel').css('width', '100%'); // Workaround for Safari issue
  $.ajax({
    type: 'POST',
    url: '/load_dxf/'
  }).done(function(r) {
    console.log(r)
    $("#sf_msg_container").append('<li class="">DXF from Sales Force loaded successfully.</li>');
    setTimeout(function() { window.location.reload() }, 500);
  }).fail(function(r) {
    // console.log(r.status)
    r.responseJSON.errors.forEach((msg) => {
      $("#sf_msg_container").append('<li class="error_message">' + msg + '</li>');
    })
  }).always(function() {
    $('#sf-spinner-panel').css('width', '0%'); // Workaround for Safari issue
  });
});
