@Override
 public void searchActiveProductUsingStatus(String productName) {
   commonActions.navigateTo(NavMenuLink.PRODUCT_TYPES);
   commonActions.selectContentFrame();
   session.setChecked(ACTIVE_CHK_BOX, true);
   session.setChecked(INACTIVE_CHK_BOX, false);
   session.setText(SEARCH_FLD, productName);
   session.click(SUBMIT_BTN);
   waits.waitUntilVisible(verifySearchedProductAtProductsPage(productName));
   session.setChecked(ACTIVE_CHK_BOX, false);
   session.setChecked(INACTIVE_CHK_BOX, true);
   session.click(SUBMIT_BTN);
   waits.waitUntilNotVisible(verifySearchedProductAtProductsPage(productName));
 }
 @Override
 public void searchMultipleProductsUsingMultipleUPCs(String[] upcs, String[] products) {
   commonActions.navigateTo(NavMenuLink.PRODUCT_TYPES);
   commonActions.selectContentFrame();
   session.setChecked(ACTIVE_CHK_BOX, true);
   session.setChecked(INACTIVE_CHK_BOX, true);
   session.clear(SEARCH_FLD);
   for (String upc : upcs) {
     session.appendText(UPCS_FLD, upc + ",");
   }
   session.click(SUBMIT_BTN);
   for (String productName : products) {
     waits.waitUntilVisible(verifySearchedProductAtProductsPage(productName));
   }
   session.clear(UPCS_FLD);
   session.click(SUBMIT_BTN);
 }
 private void setFields(CashDrawer drawer) {
   session.setText(NAME, drawer.getName());
   session.selectDropDownText(STORE, drawer.getMerchantStoreName());
   session.setChecked(STATUS, true);
   session.setUSCurrency(OPERATING_FUND, drawer.getOperatingFund());
   session.setUSCurrency(UPPER_LIMIT, drawer.getOperatingFundUpperLimit());
   session.setText(OPEN_COMMAND, drawer.getOpenerString());
 }
  @Override
  public void searchProductByNameUpcBarcodeProductType(
      ProductSearch search, List<String> products) {
    commonActions.navigateTo(NavMenuLink.PRODUCT_TYPES);
    commonActions.selectContentFrame();
    waits.waitUntilVisible(TITLE);
    session.setChecked(ACTIVE_CHK_BOX, search.isActive().get());
    // Search All Product Type products by product name

    session.setText(SEARCH_FLD, products.get(0));
    session.click(SUBMIT_BTN);
    waits.waitUntilVisible(verifySearchedProductAtProductsPage(products.get(0)));

    session.setText(SEARCH_FLD, products.get(1));
    session.click(SUBMIT_BTN);
    waits.waitUntilVisible(verifySearchedProductAtProductsPage(products.get(1)));

    session.setText(SEARCH_FLD, products.get(2));
    session.click(SUBMIT_BTN);
    waits.waitUntilVisible(verifySearchedProductAtProductsPage(products.get(2)));

    session.setText(SEARCH_FLD, products.get(3));
    session.click(SUBMIT_BTN);
    waits.waitUntilVisible(verifySearchedProductAtProductsPage(products.get(3)));

    session.setText(SEARCH_FLD, products.get(4));
    session.click(SUBMIT_BTN);
    waits.waitUntilVisible(verifySearchedProductAtProductsPage(products.get(4)));
    session.setText(SEARCH_FLD, "");

    // Search Product by UPC Barcode
    session.setText(UPCS_FLD, Joiners.COMMA.join(search.getUpcs().get()));
    session.click(SUBMIT_BTN);
    waits.waitUntilVisible(verifySearchedProductAtProductsPage(products.get(1)));
    session.setText(UPCS_FLD, "");

    Map<String, String> map = new HashMap<String, String>();
    map.put(ProductType.SERIALIZABLE.getText(), products.get(1));
    map.put(ProductType.NON_SERIALIZABLE.getText(), products.get(0));
    map.put(ProductType.RATE_PLAN.getText(), products.get(2));
    map.put(ProductType.RATE_PLAN_UPGRADE.getText(), products.get(3));
    map.put(ProductType.SERVICE_PRODUCT.getText(), products.get(4));
    map.put(ProductType.RESTOCK.getText(), products.get(5));

    // Search By Product Type
    for (ProductType type : search.getProductTypes().get()) {
      session.setText(SEARCH_FLD, map.get(type.getText()));
      session.selectDropDownText(AVAILABLE_PRODUCT_TYPES, type.getText());
      session.click(PRODUCT_TYPE_SELECT_BTN);
      session.click(SUBMIT_BTN);
      waits.waitUntilVisible(verifySearchedProductAtProductsPage(map.get(type.getText())));
      session.clear(SEARCH_FLD);
    }
  }
  @Override
  public void searchForProduct(ProductSearch search) {
    commonActions.navigateTo(NavMenuLink.PRODUCT_TYPES);
    commonActions.selectContentFrame();

    // the default is checked
    if (search.isActive().isPresent()) {
      session.setChecked(ACTIVE_CHK_BOX, search.isActive().get());
    }

    // the default is un-checked
    if (search.isInActive().isPresent()) {
      if (search.isInActive().get() == true) {
        if (!session.existsNow(CHECKED_INACTIVE_CHK_BOX)) {
          session.click(INACTIVE_CHK_BOX);
        }
      }
      if (search.isInActive().get() == false) {
        if (session.existsNow(CHECKED_INACTIVE_CHK_BOX)) {
          session.click(INACTIVE_CHK_BOX);
        }
      }
    }

    session.setText(SEARCH_FLD, search.getProductName());

    if (search.getUpcs().isPresent()) {
      session.clear(SEARCH_FLD);
      session.setText(UPCS_FLD, Joiners.COMMA.join(search.getUpcs().get()));
    }

    if (search.getRowsPerPage().isPresent()) {
      session.selectDropDownText(
          ROWS_PER_PAGE, String.valueOf(search.getRowsPerPage().get().getRowsPerPage()));
    }

    if (search.getProductTypes().isPresent()) {
      for (ProductType type : search.getProductTypes().get()) {
        session.selectDropDownText(AVAILABLE_PRODUCT_TYPES, type.getText());
        session.click(PRODUCT_TYPE_SELECT_BTN);
      }
    }
    waits.waitForElementToClick(SUBMIT_BTN);
    session.click(SUBMIT_BTN);
  }