|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
#include "mainwindow.h"
|
|
|
|
|
|
|
|
|
|
#include "sellerdialog.h"
|
|
|
|
|
#include "pricedialog.h"
|
|
|
|
|
#include "sellerdialog.h"
|
|
|
|
|
|
|
|
|
|
#include <regex>
|
|
|
|
|
|
|
|
|
@ -45,28 +45,30 @@ void MainWindow::on_sellerNoEdit_checkSellerNo()
|
|
|
|
|
auto inputText = ui_.sellerNoEdit->text().toStdString();
|
|
|
|
|
|
|
|
|
|
if (inputText.empty()) {
|
|
|
|
|
|
|
|
|
|
if (marketplace_->basketSize() > 0) {
|
|
|
|
|
marketplace_->finishCurrentSale();
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
regex pattern{R"(\d{1,5})"};
|
|
|
|
|
smatch result;
|
|
|
|
|
|
|
|
|
|
if (!regex_match(inputText, result, pattern)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int sellerNo = std::stoi(result[0]);
|
|
|
|
|
|
|
|
|
|
auto seller = marketplace_->findSellerWithSellerNo(sellerNo);
|
|
|
|
|
if (seller) {
|
|
|
|
|
std::cout << "!!! Seller gefunden: " << seller->getFirstName() << "\n";
|
|
|
|
|
PriceDialog priceDialog(this);
|
|
|
|
|
auto dialogResult = priceDialog.exec();
|
|
|
|
|
if (dialogResult == QDialog::Accepted)
|
|
|
|
|
{
|
|
|
|
|
if (dialogResult == QDialog::Accepted) {
|
|
|
|
|
int price = priceDialog.getPrice();
|
|
|
|
|
auto article = std::make_unique<Article>(price);
|
|
|
|
|
article->setSeller(seller);
|
|
|
|
|
std::cout << "!!! Neuer Artikel: " << article->getPrice() << "Cent \n";
|
|
|
|
|
std::cout << "!!! Neuer Artikel: " << article->getPrice() << " Cent \n";
|
|
|
|
|
marketplace_->addArticleToBasket(std::move(article));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|