Improved EET integration- switch to online/offline mode now possible.
Application starts to maximized window.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "paydialog.h"
|
||||
#include "ui_paydialog.h"
|
||||
#include "shopservice.h"
|
||||
|
||||
PayDialog::PayDialog(QDecDouble total, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
@@ -10,6 +11,10 @@ PayDialog::PayDialog(QDecDouble total, QWidget *parent) :
|
||||
|
||||
ui->labelTotal->setText(QString::number(total.toDouble(), 'f', 2));
|
||||
ui->labelReturn->setText(QString::number(0, 'f', 2));
|
||||
ui->recieved->setFocus();
|
||||
|
||||
ShopService srv;
|
||||
ui->checkEet->setVisible(srv.isEetEnabled());
|
||||
}
|
||||
|
||||
PayDialog::~PayDialog()
|
||||
@@ -17,6 +22,11 @@ PayDialog::~PayDialog()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
bool PayDialog::sendToEet()
|
||||
{
|
||||
return ui->checkEet->checkState() == Qt::Checked;
|
||||
}
|
||||
|
||||
|
||||
void PayDialog::on_recieved_valueChanged(double value)
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@ class PayDialog : public QDialog
|
||||
public:
|
||||
explicit PayDialog(QDecDouble total, QWidget *parent = 0);
|
||||
~PayDialog();
|
||||
bool sendToEet();
|
||||
|
||||
private slots:
|
||||
|
||||
|
||||
+16
-3
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>449</width>
|
||||
<height>134</height>
|
||||
<width>457</width>
|
||||
<height>168</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -105,7 +105,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@@ -118,6 +118,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="checkEet">
|
||||
<property name="text">
|
||||
<string>Send to EET portal</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
||||
+21
-2
@@ -78,6 +78,16 @@ void ShopForm::loadLast()
|
||||
m_commodityModel->setData(srv.allSellableItems());
|
||||
ui->commodityTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch);
|
||||
ui->commodityTable->setColumnHidden(3, true);
|
||||
|
||||
if (srv.isEetEnabled())
|
||||
{
|
||||
ui->lblEetState->setText(srv.isEetOnline() ? tr("<a href=\"#eet\">Online</a>") : tr("<a href=\"#eet\">Offline</a>"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->labelEete->setVisible(false);
|
||||
ui->lblEetState->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
void ShopForm::fillRaceiptCombo()
|
||||
@@ -320,12 +330,12 @@ void ShopForm::on_payButton_clicked()
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dialog->show();
|
||||
|
||||
connect(dialog, &QDialog::accepted, [this](){
|
||||
connect(dialog, &QDialog::accepted, [this, dialog](){
|
||||
ShopService srv;
|
||||
srv.pay(m_voucher);
|
||||
QString eetMsg;
|
||||
|
||||
if (srv.isEetEnabled())
|
||||
if (srv.isEetEnabled() && dialog->sendToEet())
|
||||
{
|
||||
bool eetRet = srv.processEet(m_voucher, eetMsg);
|
||||
|
||||
@@ -343,6 +353,7 @@ void ShopForm::on_payButton_clicked()
|
||||
if (srv.isEetOnline() && QMessageBox::question(this, tr("EET error"), errMsg) == QMessageBox::Yes)
|
||||
{
|
||||
srv.setEetOnline(false);
|
||||
ui->lblEetState->setText(srv.isEetOnline() ? tr("<a href=\"#eet\">Online</a>") : tr("<a href=\"#eet\">Offline</a>"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -403,3 +414,11 @@ void ShopForm::on_commoditySearch_textChanged(const QString &text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ShopForm::on_lblEetState_linkActivated(const QString &link)
|
||||
{
|
||||
ShopService srv;
|
||||
srv.setEetOnline(!srv.isEetOnline());
|
||||
|
||||
ui->lblEetState->setText(srv.isEetOnline() ? tr("<a href=\"#eet\">Online</a>") : tr("<a href=\"#eet\">Offline</a>"));
|
||||
}
|
||||
|
||||
@@ -44,6 +44,8 @@ private slots:
|
||||
|
||||
void on_commoditySearch_textChanged(const QString &text);
|
||||
|
||||
void on_lblEetState_linkActivated(const QString &link);
|
||||
|
||||
private:
|
||||
Ui::ShopForm *ui;
|
||||
QSharedPointer<Voucher> m_voucher;
|
||||
|
||||
+30
-1
@@ -399,6 +399,35 @@
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_7" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelEete">
|
||||
<property name="text">
|
||||
<string>EET status:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblEetState">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><a href="#eet">dfghdfg</a></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
@@ -571,8 +600,8 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../core/rc.qrc"/>
|
||||
<include location="shoprc.qrc"/>
|
||||
<include location="../core/rc.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user