/**
   * uploads File into currently selected Task.
   *
   * @param event
   * @throws ClassNotFoundException
   * @throws IOException
   * @throws SQLException
   */
  @FXML
  private void uploadFile(ActionEvent event)
      throws ClassNotFoundException, IOException, SQLException {

    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Open Resource File");
    File file = fileChooser.showOpenDialog(mainStage).getAbsoluteFile();

    // FileUtils.copyFileToDirectory(file, FileUtils.getFile(super.getPath(file.getName())), true);
    File selectedDir = new File(super.getPath("files"));
    FileUtils.copyFileToDirectory(file, new File(selectedDir.getAbsolutePath()));
    shl.getCurrentTab().addFile("File-" + file.getName(), file);

    download.setText("Upload done!");
    download.setTextFill(Color.GREEN);

    super.saveShell();
    super.saveLog(
        shl.getCurrentUser().getID()
            + " - "
            + shl.getCurrentUser().getName()
            + " - "
            + "UPLOADED "
            + file.getName());

    System.out.println("File uploaded as " + file.toString());
  }
  /**
   * Creates a new account (User)
   *
   * @param event
   * @throws IOException
   * @throws ClassNotFoundException
   * @throws SQLException
   */
  @FXML
  public void createAccount(ActionEvent event)
      throws IOException, ClassNotFoundException, SQLException {

    roles.setTextFill(Color.RED);
    wrongPass.setTextFill(Color.RED);
    duplicateID.setTextFill(Color.RED);

    if (super.loadShell() != null) {
      Shell loadShell = loadShell();
      shl.setEmployees(loadShell.getEmployees());
      shl.setManagers(loadShell.getManagers());
      shl.setTabs(loadShell.getTabs());
      shl.setUsers(loadShell.getUsers());
    }

    loadLog();

    if (!user.getText().equals("")
        && !password.getText().equals("")
        && !passconf.getText().equals("")
        && !name.getText().equals("")
        && !post.getText().equals("")) {

      if (shl.findUser(user.getText()) != null) {
        user.getStyleClass().add("error");
        duplicateID.setVisible(true);

        System.out.printf(
            "[SHELL] User %s exists as %s %s\n ",
            user.getText(), shl.findUser(user.getText()), shl.findUser(user.getText()));
      } else if (password.getText().equals(passconf.getText())) {
        shl.createUser(user.getText(), password.getText(), post.getText(), name.getText());

        System.out.printf("Created User %s\n", user.getText());

        user.getStyleClass().remove("error");
        password.getStyleClass().remove("error");
        passconf.getStyleClass().remove("error");
        roles.setVisible(false);
        duplicateID.setVisible(false);
        wrongPass.setVisible(false);

        super.saveShell();
        super.saveLog("USER " + user.getText() + " - " + name.getText() + " HAS BEEN CREATED");

        goToScreen1(event);

      } else {
        System.out.println("[SHELL] User creation failed - Passwords don't match");

        password.getStyleClass().add("error");
        passconf.getStyleClass().add("error");
        wrongPass.setVisible(true);
      }

    } else System.out.println("[SHELL] User creation failed - Missing fields");
  }
  @FXML
  protected void statusVReject(ActionEvent event)
      throws ClassNotFoundException, IOException, SQLException {

    shl.markAsRejected();

    super.saveShell();

    super.saveLog(
        shl.getCurrentUser().getID()
            + " - "
            + shl.getCurrentUser().getName()
            + " - "
            + "REJECTED TASK "
            + shl.getCurrentTab().getName());
  }
  /**
   * marks the current Task as Verified by a Manager
   *
   * @param event
   * @throws ClassNotFoundException
   * @throws IOException
   * @throws SQLException
   */
  @FXML
  private void markAsVerified(ActionEvent event)
      throws ClassNotFoundException, IOException, SQLException {

    shl.markAsVerified();
    shl.getCurrentTab().setReject(false);

    super.saveShell();

    super.saveLog(
        shl.getCurrentUser().getID()
            + " - "
            + shl.getCurrentUser().getName()
            + " - "
            + "MARKED TASK "
            + shl.getCurrentTab().getName()
            + " AS VERIFIED");
  }