'use strict';
define(function() {

  var importxlsxfactory = function(
      $filter,
      $http
  ) {

    const importAndTreatXlsxFile = (userLogin, territoryValue, configName, uploadProcessID, save) => {
      const promise = $http.get("/services/{portalid}/{appname}/systemsheets/importAndTreatSystemSheets" +
          "?userLogin=" + userLogin +
          "&territory=" + territoryValue +
          "&configName=" + configName +
          "&uploadProcessID=" + uploadProcessID +
          "&save=" + save);
      promise.catch(()=>{
        require('toastr').error(
            $filter('translate')('importxlsxwidget.errorImporting'));
      });
      return promise;
    };

    return {
      importAndTreatXlsxFile: importAndTreatXlsxFile
    };
  };
  importxlsxfactory.$inject = [
      '$filter',
      '$http'
  ];
  return importxlsxfactory;
});