finish current sale
This commit is contained in:
parent
8b534e1229
commit
150ce946d1
5 changed files with 81 additions and 11 deletions
|
@ -11,9 +11,12 @@ find_package(Qt5Widgets CONFIG REQUIRED)
|
|||
set(GUI_SOURCES
|
||||
kima2.cpp
|
||||
mainwindow.cpp
|
||||
mainwindow.ui
|
||||
sellerdialog.cpp
|
||||
sellerdialog.ui
|
||||
sellermodel.cpp
|
||||
pricedialog.cpp
|
||||
pricedialog.ui
|
||||
)
|
||||
|
||||
add_executable(kima2 ${GUI_SOURCES})
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,54 @@
|
|||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="sellerNoEdit"/>
|
||||
<widget class="QLineEdit" name="sellerNoEdit">
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>197</red>
|
||||
<green>255</green>
|
||||
<blue>169</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>197</red>
|
||||
<green>255</green>
|
||||
<blue>169</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>239</red>
|
||||
<green>239</green>
|
||||
<blue>239</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Eingabe Verk.-Nr.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="paidButton">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue