Compare commits

..

2 commits

3 changed files with 11 additions and 1 deletions

Binary file not shown.

Binary file not shown.

View file

@ -13,7 +13,7 @@ SellerDialog::SellerDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(parent,
model_ = std::make_unique<SellerModel>(market_, ui_.tableView); model_ = std::make_unique<SellerModel>(market_, ui_.tableView);
ui_.tableView->setModel(model_.get()); ui_.tableView->setModel(model_.get());
ui_.tableView->setColumnHidden(0, true); // hide the uuid ui_.tableView->setColumnHidden(0, true); // hide the uuid
ui_.tableView->setRowHidden(0, true); // hide the special "Sonderkonto" user ui_.tableView->setRowHidden(0, true); // hide the special "Sonderkonto" user
connect(ui_.newButton, &QPushButton::clicked, this, &SellerDialog::on_newButton_clicked); connect(ui_.newButton, &QPushButton::clicked, this, &SellerDialog::on_newButton_clicked);
connect(ui_.deleteButton, &QPushButton::clicked, this, &SellerDialog::on_deleteButton_clicked); connect(ui_.deleteButton, &QPushButton::clicked, this, &SellerDialog::on_deleteButton_clicked);
connect(model_.get(), &SellerModel::duplicateSellerNo, this, connect(model_.get(), &SellerModel::duplicateSellerNo, this,
@ -24,6 +24,16 @@ SellerDialog::SellerDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(parent,
void SellerDialog::on_newButton_clicked() void SellerDialog::on_newButton_clicked()
{ {
// Don't allow new seller if market has already started
if (market_->getSales().size() > 0) {
QMessageBox(QMessageBox::Icon::Warning, "Hinweis",
"Da die Verkaufsphase schon begonnen hat (Artikel wurden bereits verkauft) "
"können Sie keine Verkäufer mehr hinzufügen.",
QMessageBox::StandardButton::Ok, this)
.exec();
return;
}
ui_.tableView->reset(); ui_.tableView->reset();
ui_.tableView->model()->insertRows(ui_.tableView->model()->rowCount(), 1); ui_.tableView->model()->insertRows(ui_.tableView->model()->rowCount(), 1);
ui_.tableView->scrollToBottom(); ui_.tableView->scrollToBottom();