src/EditProductTab9.cpp

changeset 205
ae6109192fb2
parent 175
f1ed3a2a94e9
child 207
3b164a0aea90
--- a/src/EditProductTab9.cpp	Thu May 12 22:41:11 2022 +0200
+++ b/src/EditProductTab9.cpp	Fri May 13 20:51:15 2022 +0200
@@ -18,3 +18,63 @@
  */
 
 
+/**
+ * @brief Check the state by examining the date values.
+ *        1. startdate and enddate invalid, planning/wait status.
+ *           The enddate cannot be set.
+ *        2. startdate valid and endate invalid, brewdate is planned.
+ *           The fase will be brew. Enable setting of enddate.
+ *        3. startdate valid, enddate and start and endtime can be set.
+ *           The enddate cannot be before the startdate and not after 4
+ *           days from the start.
+ *        4. startdate and enddate and times are set and valid. Block
+ *           the startdate setting. But only after setting a lot of
+ *           brewdata move the fase to primary.
+ *
+ */
+void EditProduct::updateBrewday()
+{
+    setStage();
+
+    qDebug() << "updateBrewday" << product->brew_date_start.date() << product->brew_date_end.date();
+
+    ui->brew_startDate->setDate(product->brew_date_start.date());
+    ui->brew_startTime->setTime(product->brew_date_start.time());
+    ui->brew_endDate->setDate(product->brew_date_end.date());
+    ui->brew_endTime->setTime(product->brew_date_end.time());
+}
+
+
+void EditProduct::brew_date_clear()
+{
+    product->brew_date_start.setDate(QDate());
+    ui->brew_startDate->setDate(QDate());
+}
+
+
+void EditProduct::brew_date_today()
+{
+    product->brew_date_start.setDate(QDate::currentDate());
+    ui->brew_startDate->setDate(QDate::currentDate());
+}
+
+
+void EditProduct::brew_start_date_changed(QDate val)
+{
+    product->brew_date_start.setDate(ui->brew_startDate->nullDate());
+    qDebug() << "brew_start_date_changed" << product->brew_date_start.date();
+    updateBrewday();
+}
+
+
+void EditProduct::brew_end_today()
+{
+}
+
+
+void EditProduct::brew_end_date_changed(QDate val)
+{
+    qDebug() << "brew_end_date_changed" << val;
+}
+
+

mercurial