renewals added

This commit is contained in:
giomba 2020-09-20 22:03:35 +02:00
parent 6ffca6cbdd
commit 956ecb0d86
3 changed files with 271 additions and 373 deletions

View File

@ -1,7 +1,10 @@
#include "EditWindow.h" #include "EditWindow.h"
#include "ui_EditWindow.h" #include "ui_EditWindow.h"
EditWindow::EditWindow(int idSocio, QWidget* parent) : QMainWindow(parent), ui(new Ui::EditWindow) { EditWindow::EditWindow(int idSocio, QWidget* parent) :
QDialog(parent),
ui(new Ui::EditWindow)
{
ui->setupUi(this); ui->setupUi(this);
QSqlQuery query; QSqlQuery query;
@ -79,6 +82,29 @@ void EditWindow::on_buttonAnnulla_clicked() {
this->close(); this->close();
} }
void EditWindow::on_buttonRinnova_clicked() {
int ret = QMessageBox::information(
this,
"Rinnovo iscrizione socio",
QString("Confermando verrà rinnovata l'iscrizione di %1 %2 per l'anno corrente. Confermi?")
.arg(ui->lineNome->text())
.arg(ui->lineCognome->text()),
QMessageBox::Cancel | QMessageBox::Ok);
if (ret == QMessageBox::Ok) {
qint64 id_socio = ui->lineID->text().toInt();
QSqlQuery query;
query.prepare("INSERT INTO iscrizione (socio) VALUES (:socio)");
query.bindValue(":socio", id_socio);
if (query.exec()) {
status(Ui::SUCCESS, "registration renewal successfull");
} else {
status(Ui::ERROR, "registration renewal error: " + query.lastError().text());
}
}
}
EditWindow::~EditWindow() EditWindow::~EditWindow()
{ {
delete mapper; delete mapper;

View File

@ -17,7 +17,7 @@ namespace Ui {
class EditWindow; class EditWindow;
} }
class EditWindow : public QMainWindow { class EditWindow : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
@ -27,6 +27,7 @@ public:
private slots: private slots:
void on_buttonSalva_clicked(); void on_buttonSalva_clicked();
void on_buttonAnnulla_clicked(); void on_buttonAnnulla_clicked();
void on_buttonRinnova_clicked();
private: private:
QSqlQuery query; QSqlQuery query;

View File

@ -1,387 +1,258 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>EditWindow</class> <class>EditWindow</class>
<widget class="QMainWindow" name="EditWindow"> <widget class="QDialog" name="EditWindow">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>652</width> <width>422</width>
<height>273</height> <height>609</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Edit Window</string> <string>Modifica socio</string>
</property> </property>
<widget class="QWidget" name="centralWidget"> <layout class="QGridLayout" name="gridLayout">
<widget class="QLineEdit" name="lineID"> <item row="0" column="0">
<property name="enabled"> <layout class="QVBoxLayout" name="verticalLayout">
<bool>false</bool> <item>
</property> <widget class="QGroupBox" name="groupBox_2">
<property name="geometry"> <property name="title">
<rect> <string>Anagrafica</string>
<x>10</x> </property>
<y>20</y> <layout class="QGridLayout" name="gridLayout_4">
<width>51</width> <item row="0" column="0">
<height>32</height> <layout class="QFormLayout" name="formLayout">
</rect> <item row="0" column="0">
</property> <widget class="QLabel" name="label">
<property name="readOnly"> <property name="text">
<bool>true</bool> <string>ID</string>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label"> </item>
<property name="geometry"> <item row="0" column="1">
<rect> <widget class="QLineEdit" name="lineID">
<x>10</x> <property name="enabled">
<y>0</y> <bool>false</bool>
<width>14</width> </property>
<height>18</height> <property name="readOnly">
</rect> <bool>true</bool>
</property> </property>
<property name="text"> </widget>
<string>ID</string> </item>
</property> <item row="1" column="0">
</widget> <widget class="QLabel" name="label_2">
<widget class="QLabel" name="label_2"> <property name="text">
<property name="geometry"> <string>Nome</string>
<rect> </property>
<x>70</x> </widget>
<y>0</y> </item>
<width>38</width> <item row="1" column="1">
<height>18</height> <widget class="QLineEdit" name="lineNome">
</rect> <property name="text">
</property> <string/>
<property name="text"> </property>
<string>Nome</string> </widget>
</property> </item>
</widget> <item row="2" column="0">
<widget class="QLabel" name="label_"> <widget class="QLabel" name="label_">
<property name="geometry"> <property name="text">
<rect> <string>Cognome</string>
<x>360</x> </property>
<y>0</y> </widget>
<width>60</width> </item>
<height>18</height> <item row="2" column="1">
</rect> <widget class="QLineEdit" name="lineCognome"/>
</property> </item>
<property name="text"> <item row="3" column="0">
<string>Cognome</string> <widget class="QLabel" name="label_4">
</property> <property name="text">
</widget> <string>Data di Nascita</string>
<widget class="QLineEdit" name="lineNome"> </property>
<property name="geometry"> <property name="wordWrap">
<rect> <bool>true</bool>
<x>70</x> </property>
<y>20</y> </widget>
<width>281</width> </item>
<height>32</height> <item row="3" column="1">
</rect> <widget class="QDateEdit" name="dateDataNascita">
</property> <property name="displayFormat">
<property name="text"> <string>dd/MM/yyyy</string>
<string/> </property>
</property> <property name="calendarPopup">
</widget> <bool>true</bool>
<widget class="QLineEdit" name="lineCognome"> </property>
<property name="geometry"> </widget>
<rect> </item>
<x>360</x> <item row="4" column="0">
<y>20</y> <widget class="QLabel" name="label_5">
<width>281</width> <property name="text">
<height>32</height> <string>Comune di Residenza</string>
</rect> </property>
</property> <property name="wordWrap">
</widget> <bool>true</bool>
<widget class="QLineEdit" name="lineComuneResidenza"> </property>
<property name="geometry"> </widget>
<rect> </item>
<x>120</x> <item row="4" column="1">
<y>80</y> <widget class="QLineEdit" name="lineComuneResidenza"/>
<width>231</width> </item>
<height>32</height> <item row="5" column="0">
</rect> <widget class="QLabel" name="label_8">
</property> <property name="text">
</widget> <string>Email</string>
<widget class="QLineEdit" name="lineEmail"> </property>
<property name="geometry"> <property name="wordWrap">
<rect> <bool>true</bool>
<x>360</x> </property>
<y>80</y> </widget>
<width>281</width> </item>
<height>32</height> <item row="5" column="1">
</rect> <widget class="QLineEdit" name="lineEmail"/>
</property> </item>
</widget> <item row="6" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_9">
<property name="geometry"> <property name="text">
<rect> <string>Professione</string>
<x>10</x> </property>
<y>60</y> <property name="wordWrap">
<width>92</width> <bool>true</bool>
<height>18</height> </property>
</rect> </widget>
</property> </item>
<property name="text"> <item row="6" column="1">
<string>Data di Nascita</string> <widget class="QComboBox" name="comboProfessione"/>
</property> </item>
<property name="wordWrap"> <item row="7" column="0">
<bool>true</bool> <widget class="QLabel" name="label_10">
</property> <property name="text">
</widget> <string>Fonte</string>
<widget class="QLabel" name="label_5"> </property>
<property name="geometry"> <property name="wordWrap">
<rect> <bool>true</bool>
<x>120</x> </property>
<y>60</y> </widget>
<width>132</width> </item>
<height>18</height> <item row="7" column="1">
</rect> <widget class="QComboBox" name="comboFonte"/>
</property> </item>
<property name="text"> </layout>
<string>Comune di Residenza</string> </item>
</property> </layout>
<property name="wordWrap"> </widget>
<bool>true</bool> </item>
</property> <item>
</widget> <widget class="QGroupBox" name="groupBox">
<widget class="QLabel" name="label_8"> <property name="title">
<property name="geometry"> <string>Questionario</string>
<rect> </property>
<x>360</x> <layout class="QGridLayout" name="gridLayout_3">
<y>50</y> <item row="0" column="0">
<width>41</width> <layout class="QGridLayout" name="gridLayout_2">
<height>31</height> <item row="0" column="0">
</rect> <widget class="QLabel" name="label_12">
</property> <property name="text">
<property name="text"> <string>Ultima compilazione</string>
<string>Email</string> </property>
</property> <property name="wordWrap">
<property name="wordWrap"> <bool>true</bool>
<bool>true</bool> </property>
</property> </widget>
</widget> </item>
<widget class="QLabel" name="label_9"> <item row="0" column="1">
<property name="geometry"> <widget class="QDateEdit" name="dateDataCompilazione">
<rect> <property name="enabled">
<x>10</x> <bool>false</bool>
<y>110</y> </property>
<width>71</width> <property name="readOnly">
<height>21</height> <bool>true</bool>
</rect> </property>
</property> <property name="displayFormat">
<property name="text"> <string>dd/MM/yyyy</string>
<string>Professione</string> </property>
</property> <property name="calendarPopup">
<property name="wordWrap"> <bool>true</bool>
<bool>true</bool> </property>
</property> </widget>
</widget> </item>
<widget class="QLabel" name="label_10"> <item row="1" column="1">
<property name="geometry"> <widget class="QLineEdit" name="linePin">
<rect> <property name="enabled">
<x>330</x> <bool>false</bool>
<y>110</y> </property>
<width>41</width> <property name="readOnly">
<height>21</height> <bool>true</bool>
</rect> </property>
</property> <property name="placeholderText">
<property name="text"> <string>OTP</string>
<string>Fonte</string> </property>
</property> </widget>
<property name="wordWrap"> </item>
<bool>true</bool> <item row="1" column="0">
</property> <widget class="QCheckBox" name="checkAbilitaQuestionario">
</widget> <property name="text">
<widget class="QDateEdit" name="dateDataNascita"> <string>Abilita</string>
<property name="geometry"> </property>
<rect> </widget>
<x>10</x> </item>
<y>80</y> </layout>
<width>101</width> </item>
<height>32</height> </layout>
</rect> </widget>
</property> </item>
<property name="displayFormat"> <item>
<string>dd/MM/yyyy</string> <widget class="QGroupBox" name="groupBox_3">
</property> <property name="title">
<property name="calendarPopup"> <string>Operazioni</string>
<bool>true</bool> </property>
</property> <layout class="QGridLayout" name="gridLayout_5">
</widget> <item row="0" column="0">
<widget class="QComboBox" name="comboProfessione"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="geometry"> <item>
<rect> <spacer name="horizontalSpacer">
<x>10</x> <property name="orientation">
<y>130</y> <enum>Qt::Horizontal</enum>
<width>311</width> </property>
<height>32</height> <property name="sizeHint" stdset="0">
</rect> <size>
</property> <width>40</width>
</widget> <height>20</height>
<widget class="QComboBox" name="comboFonte"> </size>
<property name="geometry"> </property>
<rect> </spacer>
<x>330</x> </item>
<y>130</y> <item>
<width>311</width> <widget class="QPushButton" name="buttonRinnova">
<height>32</height> <property name="text">
</rect> <string>Rinnova</string>
</property> </property>
</widget> </widget>
<widget class="Line" name="line"> </item>
<property name="geometry"> <item>
<rect> <widget class="QPushButton" name="buttonAnnulla">
<x>10</x> <property name="text">
<y>210</y> <string>Annulla</string>
<width>631</width> </property>
<height>16</height> </widget>
</rect> </item>
</property> <item>
<property name="orientation"> <widget class="QPushButton" name="buttonSalva">
<enum>Qt::Horizontal</enum> <property name="text">
</property> <string>Salva</string>
</widget> </property>
<widget class="QPushButton" name="buttonSalva"> </widget>
<property name="geometry"> </item>
<rect> </layout>
<x>550</x> </item>
<y>230</y> </layout>
<width>91</width> </widget>
<height>34</height> </item>
</rect> </layout>
</property> </item>
<property name="text"> </layout>
<string>Salva</string>
</property>
</widget>
<widget class="QCheckBox" name="checkAbilitaQuestionario">
<property name="geometry">
<rect>
<x>450</x>
<y>170</y>
<width>71</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Abilita</string>
</property>
</widget>
<widget class="QDateEdit" name="dateDataCompilazione">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>230</x>
<y>170</y>
<width>101</width>
<height>32</height>
</rect>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="displayFormat">
<string>dd/MM/yyyy</string>
</property>
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_11">
<property name="geometry">
<rect>
<x>10</x>
<y>170</y>
<width>80</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Questionario</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="buttonAnnulla">
<property name="geometry">
<rect>
<x>450</x>
<y>230</y>
<width>91</width>
<height>34</height>
</rect>
</property>
<property name="text">
<string>Annulla</string>
</property>
</widget>
<widget class="QLabel" name="label_12">
<property name="geometry">
<rect>
<x>100</x>
<y>170</y>
<width>131</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Ultima compilazione</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QLineEdit" name="linePin">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>370</x>
<y>170</y>
<width>71</width>
<height>32</height>
</rect>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_13">
<property name="geometry">
<rect>
<x>340</x>
<y>170</y>
<width>31</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>OTP</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</widget>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<tabstops>
<tabstop>lineID</tabstop>
<tabstop>lineNome</tabstop>
<tabstop>lineCognome</tabstop>
<tabstop>dateDataNascita</tabstop>
<tabstop>lineComuneResidenza</tabstop>
<tabstop>lineEmail</tabstop>
<tabstop>comboProfessione</tabstop>
<tabstop>comboFonte</tabstop>
<tabstop>dateDataCompilazione</tabstop>
<tabstop>checkAbilitaQuestionario</tabstop>
<tabstop>buttonSalva</tabstop>
</tabstops>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>