Add support for tracking last submitted form and booking object

- Introduced `last_submitted_form` and `form_submission` properties in the `form` class to retain details of the most recently submitted form.
- Updated form submission logic to assign `booking_object` where applicable.
- Enhanced response in `formRoute.php` to include booking data when available.
This commit is contained in:
Jeppe Bundgaard
2025-09-23 16:04:35 +02:00
parent 8604cf39de
commit 11ac183fb1
3 changed files with 8 additions and 1 deletions
+5
View File
@@ -14,6 +14,7 @@ use forms\objects\book_interior_wash_f;
use forms\objects\book_wash_f;
use forms\objects\complete_booking_f;
use forms\objects\generate_booking_wash_certificate_f;
use objects\form_submissions_o;
use traits\form_t;
/** Require the forms using glob */
@@ -40,6 +41,8 @@ class form
* @var complete_booking_f $complete_booking_without_wash_certificate The COMPLETE_BOOKING_WITHOUT_WASH_CERTIFICATE form
*/
public complete_booking_f $complete_booking_without_wash_certificate;
public $last_submitted_form;
public form_submissions_o $form_submission;
public function __construct()
{
@@ -59,6 +62,8 @@ class form
{
/** @var form_t|object $form */
$form->submit();
$this->last_submitted_form = $form;
$this->form_submission = $form->form_submissions_o;
}
/**