diff --git a/laravel_app/app/Console/Commands/BuildReports.php b/laravel_app/app/Console/Commands/BuildReports.php index 0ea2f24..a5a958e 100644 --- a/laravel_app/app/Console/Commands/BuildReports.php +++ b/laravel_app/app/Console/Commands/BuildReports.php @@ -27,7 +27,7 @@ class BuildReports extends Command public function handle() { // TODO schedule all the project if mail - Project::all()->each(function (Project $project) { + Project::where(['mail_scheduled' => true])->each(function (Project $project) { $project->schedule(); }); } diff --git a/laravel_app/app/Livewire/Projects/Tabs/Mailings.php b/laravel_app/app/Livewire/Projects/Tabs/Mailings.php index 6002703..a366f7f 100644 --- a/laravel_app/app/Livewire/Projects/Tabs/Mailings.php +++ b/laravel_app/app/Livewire/Projects/Tabs/Mailings.php @@ -2,6 +2,7 @@ namespace App\Livewire\Projects\Tabs; +use App\Mail\ReportMailer; use App\Models\Project; use App\Models\ProjectMailing; use Livewire\Component; @@ -79,4 +80,9 @@ public function render() 'mailings' => $mailings, ]); } + + public function getMailPreview($mail) + { + return new ReportMailer($mail); + } } diff --git a/laravel_app/app/Mail/ReportMailer.php b/laravel_app/app/Mail/ReportMailer.php index 1c975d1..a333bdc 100644 --- a/laravel_app/app/Mail/ReportMailer.php +++ b/laravel_app/app/Mail/ReportMailer.php @@ -50,8 +50,9 @@ public function content(): Content markdown: 'emails.scheduled-report', with: [ 'mailingContent' => $this->mailing->message, - 'logoPath'=> Storage::disk('app')->path('images/smartcane.png'), + 'logoPath'=> Storage::disk('local')->path('images/smartcane.png'), 'subject' => $this->mailing->subject, + 'mailing' => $this->mailing, ], //htmlString: $this->mailing->message ); diff --git a/laravel_app/app/Models/Project.php b/laravel_app/app/Models/Project.php index 3f62558..a2c719e 100644 --- a/laravel_app/app/Models/Project.php +++ b/laravel_app/app/Models/Project.php @@ -258,10 +258,7 @@ public function startDownload(Carbon $date) public function schedule() { -// if ($this->shouldSchedule()) { - $this->scheduleReport(); -// } - + $this->scheduleReport(); } public function shouldSchedule(): bool @@ -304,7 +301,7 @@ public function scheduleReport($year = null, $week = null) Bus::chain([ Bus::batch($this->getFileDownloadsFor($year, $week)), Bus::batch($this->getMosaicsFor($year, $week)), - Bus::batch([$this->getReportFor($year, $week, true)]), + Bus::batch([$this->getReportFor($year, $week,true)]), ]) ->dispatch(); return "done"; diff --git a/laravel_app/composer.json b/laravel_app/composer.json index 7224a2a..856998f 100644 --- a/laravel_app/composer.json +++ b/laravel_app/composer.json @@ -20,6 +20,7 @@ "plesk/ext-laravel-integration": "^7.0" }, "require-dev": { + "barryvdh/laravel-debugbar": "*", "fakerphp/faker": "^1.23", "laravel/pint": "^1.13", "laravel/sail": "^1.26", diff --git a/laravel_app/composer.lock b/laravel_app/composer.lock index f738706..87da303 100644 --- a/laravel_app/composer.lock +++ b/laravel_app/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "02a769bc324ca6d387d9e85c61229c6b", + "content-hash": "3780ed65b4c427fb760c558bbcc7441e", "packages": [ { "name": "bacon/bacon-qr-code", @@ -8069,6 +8069,90 @@ } ], "packages-dev": [ + { + "name": "barryvdh/laravel-debugbar", + "version": "v3.13.5", + "source": { + "type": "git", + "url": "https://github.com/barryvdh/laravel-debugbar.git", + "reference": "92d86be45ee54edff735e46856f64f14b6a8bb07" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/92d86be45ee54edff735e46856f64f14b6a8bb07", + "reference": "92d86be45ee54edff735e46856f64f14b6a8bb07", + "shasum": "" + }, + "require": { + "illuminate/routing": "^9|^10|^11", + "illuminate/session": "^9|^10|^11", + "illuminate/support": "^9|^10|^11", + "maximebf/debugbar": "~1.22.0", + "php": "^8.0", + "symfony/finder": "^6|^7" + }, + "require-dev": { + "mockery/mockery": "^1.3.3", + "orchestra/testbench-dusk": "^5|^6|^7|^8|^9", + "phpunit/phpunit": "^9.6|^10.5", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.13-dev" + }, + "laravel": { + "providers": [ + "Barryvdh\\Debugbar\\ServiceProvider" + ], + "aliases": { + "Debugbar": "Barryvdh\\Debugbar\\Facades\\Debugbar" + } + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Barryvdh\\Debugbar\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "PHP Debugbar integration for Laravel", + "keywords": [ + "debug", + "debugbar", + "laravel", + "profiler", + "webprofiler" + ], + "support": { + "issues": "https://github.com/barryvdh/laravel-debugbar/issues", + "source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.13.5" + }, + "funding": [ + { + "url": "https://fruitcake.nl", + "type": "custom" + }, + { + "url": "https://github.com/barryvdh", + "type": "github" + } + ], + "time": "2024-04-12T11:20:37+00:00" + }, { "name": "fakerphp/faker", "version": "v1.23.1", @@ -8383,6 +8467,74 @@ }, "time": "2024-03-20T20:09:31+00:00" }, + { + "name": "maximebf/debugbar", + "version": "v1.22.3", + "source": { + "type": "git", + "url": "https://github.com/maximebf/php-debugbar.git", + "reference": "7aa9a27a0b1158ed5ad4e7175e8d3aee9a818b96" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/7aa9a27a0b1158ed5ad4e7175e8d3aee9a818b96", + "reference": "7aa9a27a0b1158ed5ad4e7175e8d3aee9a818b96", + "shasum": "" + }, + "require": { + "php": "^7.2|^8", + "psr/log": "^1|^2|^3", + "symfony/var-dumper": "^4|^5|^6|^7" + }, + "require-dev": { + "dbrekelmans/bdi": "^1", + "phpunit/phpunit": "^8|^9", + "symfony/panther": "^1|^2.1", + "twig/twig": "^1.38|^2.7|^3.0" + }, + "suggest": { + "kriswallsmith/assetic": "The best way to manage assets", + "monolog/monolog": "Log using Monolog", + "predis/predis": "Redis storage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.22-dev" + } + }, + "autoload": { + "psr-4": { + "DebugBar\\": "src/DebugBar/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Maxime Bouroumeau-Fuseau", + "email": "maxime.bouroumeau@gmail.com", + "homepage": "http://maximebf.com" + }, + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "Debug bar in the browser for php application", + "homepage": "https://github.com/maximebf/php-debugbar", + "keywords": [ + "debug", + "debugbar" + ], + "support": { + "issues": "https://github.com/maximebf/php-debugbar/issues", + "source": "https://github.com/maximebf/php-debugbar/tree/v1.22.3" + }, + "time": "2024-04-03T19:39:26+00:00" + }, { "name": "mockery/mockery", "version": "1.6.11", diff --git a/laravel_app/resources/views/components/form-modal.blade.php b/laravel_app/resources/views/components/form-modal.blade.php index 94c7bd4..0a755de 100644 --- a/laravel_app/resources/views/components/form-modal.blade.php +++ b/laravel_app/resources/views/components/form-modal.blade.php @@ -3,8 +3,6 @@
|
+ + + + |
+ + + | +
|
+ + + + |
+ + + | +
|
+ + + + |
+ + + | +
SmartCane is an innovative spinoff from the Resilience Network, which includes SmartFarming BV and IRIPO Lda.
++ © {{ date('Y') }} {{ config('app.name') }}. {{ __('All rights reserved.') }} +
+ +