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 "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);
QSqlQuery query;
@ -79,6 +82,29 @@ void EditWindow::on_buttonAnnulla_clicked() {
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()
{
delete mapper;

View File

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

View File

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