boolean allOptionsFilledUp() {
   if (c.getFrom() != null && c.getTo() != null && c.getD() != null && (c.isAc() || c.isNonAC())) {
     return true;
   }
   return false;
   // if any one of the options has not been selected, this function will return false and the
   // client will be stuck in the homepage
 }
  @FXML
  void fromComboBoxAction(ActionEvent event) {
    // fromComboBox.setItems(options);
    /*
    if(fromClicked && toClicked && !lastClicked.equals("from")){
        fromBoxList.setAll(options);
        toBoxList.setAll(options);
        toClicked=false;
        System.out.println("both combo box has been clicked");
    }
    */

    /*System.out.println("now fromBoxList of size "+ fromBoxList.size()+ " will be setAll()");
    fromComboBox.setItems(fromBoxList);
    */

    // fromComboBox=new ComboBox(fromBoxList);
    String s = (String) fromComboBox.getValue();
    c.setFrom(s);

    if (fromComboBox.getValue() == toComboBox.getValue()) {
      toComboBox
          .getSelectionModel()
          .clearSelection(); // to clear the selected option in the other combo box, because the
                             // starting point and destination can't be the same
      c.setTo(null);
      // toComboBox.setButtonCell(null);
      // toComboBox.valueProperty().set(null);
      // toComboBox.getSelectionModel().clearSelection();
    }

    // System.out.println(s.getClass());
    // System.out.println(s);
    System.out.println("from " + s);

    // temp.remove(s);
    /*
    fromClicked=true;
    fromCombo=s;
    lastClicked="from";
    //options.removeAll(s);
    if(fromClicked && !toClicked){
        toBoxList.remove(fromCombo);
        System.out.println("removing "+fromCombo+" from the list and after removing, the size of the toBoxList= "+toBoxList.size());
        toComboBox.setItems(toBoxList);
    }
    */
  }
  @FXML
  void searchTktButton(ActionEvent event) {
    // send a request to server for searching a ticket from database

    c.setDate(datePick.getValue());
    c.setAC(ACradioButton.isSelected());
    c.setNonAC(nonACradioButton.isSelected());
    if (allOptionsFilledUp()) {
      try {
        main.availableBusView();
      } catch (Exception e) {
        e.printStackTrace();
      }

      /*
      try {
          //String serverAddress="127.0.0.1";
          //int serverPort=55555;
          //NetworkUtil nc = new NetworkUtil(serverAddress,serverPort);

          //nc.write(c);

      } catch(Exception e) {
          System.out.println (e);
      }
      */

    } else {
      alert.setVisible(true);
      PauseTransition visiblePause =
          new PauseTransition(
              Duration.seconds(2)); // making the "alert" label visible for 2 seconds
      visiblePause.setOnFinished(Event -> alert.setVisible(false));
      visiblePause.play();
    }
  }