Save buttons on ShopForm are now disabled if no items on receipt.
This commit is contained in:
@@ -15,6 +15,9 @@ ShopForm::ShopForm(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
m_itemsModel = NULL;
|
||||
|
||||
ui->temporarySaveButton->setEnabled(false);
|
||||
ui->saveButton->setEnabled(false);
|
||||
}
|
||||
|
||||
ShopForm::~ShopForm()
|
||||
@@ -43,6 +46,8 @@ void ShopForm::loadLast()
|
||||
connectItemSignals();
|
||||
|
||||
ui->total->setText(QString::number(m_voucher->totalPrice().toDouble(), 'f', 2));
|
||||
ui->temporarySaveButton->setEnabled(true);
|
||||
ui->saveButton->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,6 +124,8 @@ void ShopForm::onCountChanged()
|
||||
ShopService srv;
|
||||
srv.calculate(m_voucher);
|
||||
ui->total->setText(QString::number(m_voucher->totalPrice().toDouble(), 'f', 2));
|
||||
ui->temporarySaveButton->setEnabled(!m_voucher->items().isEmpty());
|
||||
ui->saveButton->setEnabled(!m_voucher->items().isEmpty());
|
||||
|
||||
if (m_voucher->status() == Voucher::NEW && m_voucher->id() == 0)
|
||||
{
|
||||
@@ -158,6 +165,8 @@ void ShopForm::doTempSave(bool comboChanged)
|
||||
{
|
||||
m_voucher = srv.createVoucher();
|
||||
ui->total->setText("0");
|
||||
ui->temporarySaveButton->setEnabled(false);
|
||||
ui->saveButton->setEnabled(false);
|
||||
}
|
||||
|
||||
fillRaceiptCombo();
|
||||
@@ -181,6 +190,9 @@ void ShopForm::changeReceipt()
|
||||
m_itemsModel->setData(m_voucher->items());
|
||||
ui->total->setText(m_voucher->totalPrice().toString());
|
||||
|
||||
ui->temporarySaveButton->setEnabled(true);
|
||||
ui->saveButton->setEnabled(true);
|
||||
|
||||
fillRaceiptCombo();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user