Skip to content

Commit

Permalink
ScheduleForm: Add Send Report Now button
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoxhaa committed Aug 2, 2022
1 parent 6d8da47 commit 0e0b6a6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions library/Reporting/Web/Forms/ScheduleForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
use DateTime;
use Icinga\Application\Version;
use Icinga\Authentication\Auth;
use Icinga\Module\Reporting\Actions\SendMail;
use Icinga\Module\Reporting\Database;
use Icinga\Module\Reporting\ProvidedActions;
use Icinga\Module\Reporting\Report;
use Icinga\Module\Reporting\Web\Flatpickr;
use Icinga\Module\Reporting\Web\Forms\Decorator\CompatDecorator;
use Icinga\Web\Notification;
use ipl\Html\Contract\FormSubmitElement;
use ipl\Html\Form;
use ipl\Web\Compat\CompatForm;
Expand Down Expand Up @@ -132,6 +134,20 @@ protected function assemble()

return;
}

$sendButton = $this->createElement('submit', 'send', [
'label' => 'Send Report Now',
'formnovalidate' => true
]);

$this->registerElement($sendButton);
$this->getElement('submit')->getWrapper()->prepend($sendButton);

if ($sendButton->hasBeenPressed()) {
$sendMail = new SendMail();
$sendMail->execute($this->report, $this->getValues());
Notification::success('Report sent successfully');
}
}
}

Expand Down

0 comments on commit 0e0b6a6

Please sign in to comment.