diff --git a/laravel_app/app/Helper.php b/laravel_app/app/Helper.php new file mode 100644 index 0000000..e4e6689 --- /dev/null +++ b/laravel_app/app/Helper.php @@ -0,0 +1,27 @@ +startOfWeek(); + + $daysOfWeek = collect([]); + for ($i = 0; $i < 7; $i++) { + $daysOfWeek->add($startOfWeek->copy()->addDays($i)->format('l')); + } + + return $daysOfWeek; + } + + public static function getMailFrequencies(): \Illuminate\Support\Collection + { + return collect([ + 'Weekly', + 'Monthly', + ]); + } + +} diff --git a/laravel_app/app/Http/Controllers/ProjectController.php b/laravel_app/app/Http/Controllers/ProjectController.php index 703da34..ad96032 100644 --- a/laravel_app/app/Http/Controllers/ProjectController.php +++ b/laravel_app/app/Http/Controllers/ProjectController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use App\Models\Project; use Illuminate\Http\Request; class ProjectController extends Controller @@ -10,5 +11,10 @@ public function index() { return view('projects.index'); } + + public function show(Project $project) + { + return view('projects.show', compact('project')); + } // } diff --git a/laravel_app/app/Livewire/Projects/DownloadManager.php b/laravel_app/app/Livewire/Projects/DownloadManager.php new file mode 100644 index 0000000..c47bb8f --- /dev/null +++ b/laravel_app/app/Livewire/Projects/DownloadManager.php @@ -0,0 +1,21 @@ +path = $project->download_path; + } + + public function render() + { + return view('livewire.projects.download-manager', [ + 'downloads' => $this->project + ]); + } +} diff --git a/laravel_app/app/Livewire/Projects/MailingManager.php b/laravel_app/app/Livewire/Projects/MailingManager.php new file mode 100644 index 0000000..519b049 --- /dev/null +++ b/laravel_app/app/Livewire/Projects/MailingManager.php @@ -0,0 +1,23 @@ +project = $project; + } + + public function render() + { + return view('livewire.projects.mailing-manager', [ + 'mailings' => $this->project->mailings()->orderBy('created_at', 'desc')->get(), + ]); + } +} diff --git a/laravel_app/app/Livewire/Projects/ProjectManager.php b/laravel_app/app/Livewire/Projects/ProjectManager.php index e5dba03..e4e9fe4 100644 --- a/laravel_app/app/Livewire/Projects/ProjectManager.php +++ b/laravel_app/app/Livewire/Projects/ProjectManager.php @@ -4,10 +4,10 @@ use App\Models\Project; use App\Models\ProjectBoundingBox; -use App\Models\Report; +use App\Models\ProjectEmailRecipient; use Illuminate\Support\Facades\Validator; +use Illuminate\Validation\Rule; use Livewire\Component; -use Symfony\Component\Process\Process; class ProjectManager extends Component { @@ -20,6 +20,8 @@ class ProjectManager extends Component public $showProjectModal = false; + public $showMailSettingsModal = false; + public $projectIdBeingDeleted; /** @@ -29,64 +31,59 @@ class ProjectManager extends Component */ public function mount() { - $this->addBoundingBox(); + $this->resetFormData(); } - public function editProject(Project $project) { + public function editProject(Project $project) + { $this->showProjectModal = true; + $this->loadFormData($project); + } + + public function editMailSettings(Project $project) + { + $this->showMailSettingsModal = true; + $this->loadFormData($project); + } + + private function loadFormData(Project $project) + { $this->formData = $project->toArray(); $this->formData['boundingBoxes'] = $project->boundingBoxes->toArray(); + $this->formData['mail_recipients'] = $project->emailRecipients->toArray() ?: [ + [ + 'name' => '', + 'email' => '', + ] + ]; } - /** - * Create a new API token. - * - * @return void - */ - public function createProject() + public function openCreateProjectModal() + { + $this->resetFormData(); + $this->showProjectModal = true; + } + + public function saveProject() { $this->resetErrorBag(); - Validator::make([ - 'name' => $this->formData['name'], - 'boundingBoxes' => $this->formData['boundingBoxes'], - ], [ - 'name' => ['required', 'string', 'max:255'], - 'boundingBoxes' => ['required', 'array', 'min:1'], - 'boundingBoxes.*.name' => ['required', 'string', 'max:255'], - 'boundingBoxes.*.top_left_latitude' => ['required', 'string'], - 'boundingBoxes.*.top_left_longitude' => ['required', 'string'], - 'boundingBoxes.*.bottom_right_latitude' => ['required', 'string'], - 'boundingBoxes.*.bottom_right_longitude' => ['required', 'string'], - ])->validateWithBag('createProject'); - - -// Define the unique identifier for the Project (for example, 'id') - $uniqueIdentifier = ['id' =>$this->formData['id'] ?? null]; - -// Using updateOrCreate to either update an existing project or create a new one - $project = Project::updateOrCreate($uniqueIdentifier, $this->formData); - -// Preparing the bounding boxes data for upsert -// Ensure that each bounding box data array includes a 'project_id' field - $boundingBoxesData = array_map(function ($boundingBox) use ($project) { - $boundingBox['project_id'] = $project->id; - unset($boundingBox['created_at']); - unset($boundingBox['updated_at']); - if (!array_key_exists('id', $boundingBox)) { - $boundingBox['id'] = null; - } - return $boundingBox; - }, $this->formData['boundingBoxes'] ?? []); - -// Using upsert to update or create bounding boxes -// You need to specify the unique fields and the fields to be updated - ProjectBoundingBox::upsert($boundingBoxesData, ['id', 'project_id'], ['name', 'top_left_latitude', 'top_left_longitude', 'bottom_right_latitude', 'bottom_right_longitude']); - + $this->validateForm(); + Project::saveWithFormData($this->formData); $this->resetFormData(); $this->showProjectModal = false; $this->dispatch('saved'); } + public function saveMailSettings() + { + $this->resetErrorBag(); + $this->validateEmailSettingsForm(); + Project::saveWithFormData($this->formData); + $this->resetFormData(); + $this->showMailSettingsModal = false; + $this->dispatch('saved'); + } + public function addBoundingBox() { $this->formData['boundingBoxes'][] = @@ -99,9 +96,19 @@ public function addBoundingBox() ]; } + public function addEmailRecipient() + { + $this->formData['mail_recipients'][] = + [ + 'name' => '', + 'email' => '', + ]; + } + + public function deleteBoundingBox($index) { - if(array_key_exists('id', $this->formData['boundingBoxes'][$index])) { + if (array_key_exists('id', $this->formData['boundingBoxes'][$index])) { ProjectBoundingBox::whereId($this->formData['boundingBoxes'][$index]['id'])->delete(); } unset($this->formData['boundingBoxes'][$index]); @@ -109,6 +116,16 @@ public function deleteBoundingBox($index) $this->dispatch('saved'); } + public function deleteEmailRecipient($index) + { + if (array_key_exists('id', $this->formData['mail_recipients'][$index])) { + ProjectEmailRecipient::whereId($this->formData['mail_recipients'][$index]['id'])->delete(); + } + unset($this->formData['mail_recipients'][$index]); + $this->formData['mail_recipients'] = array_values($this->formData['mail_recipients']); + $this->dispatch('saved'); + } + /** * Confirm that the given Project should be deleted. @@ -154,9 +171,57 @@ public function render() private function resetFormData() { $this->formData = [ - 'name' => '', - 'boundingBoxes' => [], + 'name' => '', + 'boundingBoxes' => [], + 'mail_subject' => '', + 'mail_template' => '', + 'mail_frequency' => '', + 'mail_day' => '', + 'mail_recipients' => [], ]; $this->addBoundingBox(); + $this->addEmailRecipient(); + } + + private function validateForm() + { + $projectIdentifier = $this->formData['id'] ?? null; + + Validator::make([ + 'name' => $this->formData['name'], + 'boundingBoxes' => $this->formData['boundingBoxes'], + ], [ + 'name' => [ + 'required', + Rule::unique('projects')->ignore($projectIdentifier), + 'string', + 'max:255' + ], + 'boundingBoxes' => ['required', 'array', 'min:1'], + 'boundingBoxes.*.name' => ['required', 'string', 'max:255'], + 'boundingBoxes.*.top_left_latitude' => ['required', 'string'], + 'boundingBoxes.*.top_left_longitude' => ['required', 'string'], + 'boundingBoxes.*.bottom_right_latitude' => ['required', 'string'], + 'boundingBoxes.*.bottom_right_longitude' => ['required', 'string'], + ])->validateWithBag('saveProject'); + } + + private function validateEmailSettingsForm() + { + Validator::make([ + 'mail_template' => $this->formData['mail_template'], + 'mail_subject' => $this->formData['mail_subject'], + 'mail_frequency' => $this->formData['mail_frequency'], + 'mail_day' => $this->formData['mail_day'], + 'mail_recipients' => $this->formData['mail_recipients'], + ], [ + 'mail_template' => ['required', 'string',], + 'mail_subject' => ['required', 'string',], + 'mail_frequency' => ['required', 'string',], + 'mail_day' => ['required', 'string',], + 'mail_recipients' => ['required', 'array', 'min:1'], + 'mail_recipients.*.name' => ['required', 'string', 'max:255'], + 'mail_recipients.*.email' => ['required', 'email'], + ])->validateWithBag('saveEmailSettingsForm'); } } diff --git a/laravel_app/app/Livewire/Projects/ReportManager.php b/laravel_app/app/Livewire/Projects/ReportManager.php new file mode 100644 index 0000000..94c35a6 --- /dev/null +++ b/laravel_app/app/Livewire/Projects/ReportManager.php @@ -0,0 +1,13 @@ + $formData['id'] ?? null]; + $project = Project::updateOrCreate($uniqueIdentifier, $formData); + $project->upsertBoundingBox($formData); + $project->upsertMailRecipients($formData); + } + + private function upsertBoundingBox($formData) + { + $boundingBoxesData = array_map(function ($boundingBox) { + $boundingBox['project_id'] = $this->id; + unset($boundingBox['created_at']); + unset($boundingBox['updated_at']); + $boundingBox['id'] ??= null; + return $boundingBox; + }, $formData['boundingBoxes'] ?? []); + + ProjectBoundingBox::upsert( + $boundingBoxesData, + ['id', 'project_id'], + [ + 'name', + 'top_left_latitude', + 'top_left_longitude', + 'bottom_right_latitude', + 'bottom_right_longitude' + ] + ); + } + + private function upsertMailRecipients($formData) + { + $mailRecipientsData = array_map(function ($mailRecipient) { + $mailRecipient['project_id'] = $this->id; + unset($mailRecipient['created_at']); + unset($mailRecipient['updated_at']); + $mailRecipient['id'] ??= null; + return $mailRecipient; + }, $formData['mail_recipients'] ?? []); + ProjectEmailRecipient::upsert( + $mailRecipientsData, + ['id', 'project_id'], + ['name', 'email',] + ); + } + protected static function boot() { parent::boot(); // TODO: Change the autogenerated stub static::deleting(function ($project) { $project->boundingBoxes()->delete(); + $project->emailRecipients()->delete(); + $project->mailings()->each(function ($mailing) { + $mailing->attachments()->delete(); + $mailing->recipients()->delete(); + }); + $project->mailings()->delete(); }); } @@ -25,4 +84,19 @@ public function boundingBoxes() { return $this->hasMany(ProjectBoundingBox::class); } + + public function emailRecipients() + { + return $this->hasMany(ProjectEmailRecipient::class); + } + + public function mailings() + { + return $this->hasMany(ProjectMailing::class); + } + + public function downloads() + { + return $this->hasMany(ProjectDownload::class); + } } diff --git a/laravel_app/app/Models/ProjectDownload.php b/laravel_app/app/Models/ProjectDownload.php new file mode 100644 index 0000000..e7c39f4 --- /dev/null +++ b/laravel_app/app/Models/ProjectDownload.php @@ -0,0 +1,11 @@ +belongsTo(Project::class); + } + + public function recipients() + { + return $this->hasMany(ProjectMailingRecipient::class); + } + + public function attachments() + { + return $this->hasMany(ProjectMailingAttachment::class); + } +} diff --git a/laravel_app/app/Models/ProjectMailingAttachment.php b/laravel_app/app/Models/ProjectMailingAttachment.php new file mode 100644 index 0000000..1c1e4c1 --- /dev/null +++ b/laravel_app/app/Models/ProjectMailingAttachment.php @@ -0,0 +1,16 @@ +string('name')->unique(); $table->text('mail_template')->nullable(); $table->string('mail_subject')->nullable(); - $table->string('mail_frequentie')->default('weekly'); - $table->string('mail_day')->default('friday'); + $table->string('mail_frequency')->default('Weekly'); + $table->string('download_path')->unique(); + $table->string('mail_day')->default('Friday'); $table->timestamps(); }); } diff --git a/laravel_app/database/migrations/2023_11_20_103515_create_project_email_recipients_table.php b/laravel_app/database/migrations/2023_11_20_103515_create_project_email_recipients_table.php new file mode 100644 index 0000000..2f6b918 --- /dev/null +++ b/laravel_app/database/migrations/2023_11_20_103515_create_project_email_recipients_table.php @@ -0,0 +1,31 @@ +id(); + $table->foreignIdFor(Project::class); + $table->string('email'); + $table->string('name'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('project_email_recipients'); + } +}; diff --git a/laravel_app/database/migrations/2023_11_21_125040_create_project_mailings_table.php b/laravel_app/database/migrations/2023_11_21_125040_create_project_mailings_table.php new file mode 100644 index 0000000..9c7d61a --- /dev/null +++ b/laravel_app/database/migrations/2023_11_21_125040_create_project_mailings_table.php @@ -0,0 +1,31 @@ +id(); + $table->foreignId('project_id'); + $table->string('subject'); + $table->text('message'); +// $table->text('recipients'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('project_mailings'); + } +}; diff --git a/laravel_app/database/migrations/2023_11_21_125712_create_project_mailing_recipients_table.php b/laravel_app/database/migrations/2023_11_21_125712_create_project_mailing_recipients_table.php new file mode 100644 index 0000000..14ab8a9 --- /dev/null +++ b/laravel_app/database/migrations/2023_11_21_125712_create_project_mailing_recipients_table.php @@ -0,0 +1,30 @@ +id(); + $table->foreignId('project_mailing_id'); + $table->string('email'); + $table->string('name')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('project_mailing_recipients'); + } +}; diff --git a/laravel_app/database/migrations/2023_11_21_125723_create_project_mailing_attachments_table.php b/laravel_app/database/migrations/2023_11_21_125723_create_project_mailing_attachments_table.php new file mode 100644 index 0000000..fe6bd49 --- /dev/null +++ b/laravel_app/database/migrations/2023_11_21_125723_create_project_mailing_attachments_table.php @@ -0,0 +1,30 @@ +id(); + $table->foreignId('project_mailing_id'); + $table->string('name'); + $table->string('path'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('project_mailing_attachments'); + } +}; diff --git a/laravel_app/database/migrations/2023_11_21_142339_create_project_downloads_table.php b/laravel_app/database/migrations/2023_11_21_142339_create_project_downloads_table.php new file mode 100644 index 0000000..0735dd9 --- /dev/null +++ b/laravel_app/database/migrations/2023_11_21_142339_create_project_downloads_table.php @@ -0,0 +1,30 @@ +id(); + $table->foreignId('project_id'); + $table->string('name'); + $table->string('path'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('project_downloads'); + } +}; diff --git a/laravel_app/database/seeders/DatabaseSeeder.php b/laravel_app/database/seeders/DatabaseSeeder.php index 460e8c4..63dae47 100644 --- a/laravel_app/database/seeders/DatabaseSeeder.php +++ b/laravel_app/database/seeders/DatabaseSeeder.php @@ -14,11 +14,244 @@ public function run(): void { // \App\Models\User::factory(10)->create(); - \App\Models\User::factory()->create([ - 'name' => 'Martin Folkerts', - 'email' => 'martin@sobit.nl', - 'password' => '$2y$10$hZZaAaiv1KXmCqq5vZ6PEeRWzvwGbaHKcfqeEMlTn.y22EEPVtofi', + \App\Models\User::factory()->create([ + 'name' => 'Martin Folkerts', + 'email' => 'martin@sobit.nl', + 'password' => '$2y$10$hZZaAaiv1KXmCqq5vZ6PEeRWzvwGbaHKcfqeEMlTn.y22EEPVtofi', + ]); - ]); + $this->createChembaProject(); + $this->createXinavaneProject(); + $this->createKakiraProject(); + + + } + + private function createChembaProject() + { + $chembaProject = \App\Models\Project::create([ + 'name' => 'Chemba', + 'mail_template' => 'Mail template for Chemba', + 'mail_subject' => 'SmartCane update Chemba for {date}', + 'mail_frequency' => 'Weekly', + 'mail_day' => 'Friday', + 'download_path' => 'chemba', + 'created_at' => '2021-01-01 00:00:00', + 'updated_at' => '2021-01-01 00:00:00', + ]); + + $chembaProject->boundingBoxes()->createMany([ + [ + 'name' => 'Chemba West', + 'top_left_latitude' => 34.9460, + 'top_left_longitude' => -17.3516, + 'bottom_right_latitude' => 34.9380, + 'bottom_right_longitude' => -17.2917, + 'created_at' => '2021-01-01 00:00:00', + 'updated_at' => '2021-01-01 00:00:00', + ], + [ + 'name' => 'Chemba East', + 'top_left_latitude' => 34.8830, + 'top_left_longitude' => -17.3516, + 'bottom_right_latitude' => 34.9380, + 'bottom_right_longitude' => -17.2917, + 'created_at' => '2021-01-01 00:00:00', + 'updated_at' => '2021-01-01 00:00:00', + ], + ]); + + $chembaProject->emailRecipients()->createMany([ + [ + 'name' => 'Martin Folkerts', + 'email' => 'martin@sobit.nl', + 'created_at' => '2021-01-01 00:00:00', + 'updated_at' => '2021-01-01 00:00:00', + ], [ + 'name' => 'Timon Weitkamp', + 'email' => 'timon@smartfarmingtech.com', + 'created_at' => '2021-01-01 00:00:00', + 'updated_at' => '2021-01-01 00:00:00', + ], + ]); + + $chembaProject->mailings()->createMany([ + [ + 'subject' => 'Chemba 2021-01-01', + 'message' => 'Chemba 2021-01-01', + 'created_at' => '2021-01-01 00:00:00', + 'updated_at' => '2021-01-01 00:00:00', + ], [ + 'subject' => 'Chemba 2021-01-08', + 'message' => 'Chemba 2021-01-08', + 'created_at' => '2021-01-08 00:00:00', + 'updated_at' => '2021-01-08 00:00:00', + ], + ]); + + foreach ($chembaProject->mailings as $mailing) { + $mailing->recipients()->createMany([ + [ + 'name' => 'Martin Folkerts', + 'email' => 'martin@sobit.nl', + 'created_at' => $mailing->created_at, + 'updated_at' => $mailing->updated_at, + ], [ + 'name' => 'Timon Weitkamp', + 'email' => 'timon@smartfarmingtech.com', + 'created_at' => $mailing->created_at, + 'updated_at' => $mailing->updated_at, + ], + ]); + } + } + + private function createXinavaneProject() + { + $project = \App\Models\Project::create([ + 'name' => 'Xinavane', + 'mail_template' => 'Mail template for Xinavane', + 'mail_subject' => 'SmartCane update Xinavane for {date}', + 'mail_frequency' => 'Weekly', + 'mail_day' => 'Friday', + 'download_path' => 'xinavane', + 'created_at' => '2021-01-01 00:00:00', + 'updated_at' => '2021-01-01 00:00:00', + ]); + + $project->boundingBoxes()->createMany([ + [ + 'name' => 'Xinavane West', + 'top_left_latitude' => 32.6213, + 'top_left_longitude' => -25.0647, + 'bottom_right_latitude' => 32.6284, + 'bottom_right_longitude' => -25.0570, + 'created_at' => '2021-01-01 00:00:00', + 'updated_at' => '2021-01-01 00:00:00', + ], + [ + 'name' => 'Xinavane East', + 'top_left_latitude' => 32.6790, + 'top_left_longitude' => -25.0333, + 'bottom_right_latitude' => 32.7453, + 'bottom_right_longitude' => -25.0235, + 'created_at' => '2021-01-01 00:00:00', + 'updated_at' => '2021-01-01 00:00:00', + ], + ]); + + $project->emailRecipients()->createMany([ + [ + 'name' => 'Martin Folkerts', + 'email' => 'martin@sobit.nl', + 'created_at' => '2021-01-01 00:00:00', + 'updated_at' => '2021-01-01 00:00:00', + ], [ + 'name' => 'Timon Weitkamp', + 'email' => 'timon@smartfarmingtech.com', + 'created_at' => '2021-01-01 00:00:00', + 'updated_at' => '2021-01-01 00:00:00', + ], + ]); + + $project->mailings()->createMany([ + [ + 'subject' => 'Xinavane 2021-01-01', + 'message' => 'Xinavane 2021-01-01', + 'created_at' => '2021-01-01 00:00:00', + 'updated_at' => '2021-01-01 00:00:00', + ], [ + 'subject' => 'Xinavane 2021-01-08', + 'message' => 'Xinavane 2021-01-08', + 'created_at' => '2021-01-08 00:00:00', + 'updated_at' => '2021-01-08 00:00:00', + ], + ]); + + foreach ($project->mailings as $mailing) { + $mailing->recipients()->createMany([ + [ + 'name' => 'Martin Folkerts', + 'email' => 'martin@sobit.nl', + 'created_at' => $mailing->created_at, + 'updated_at' => $mailing->updated_at, + ], [ + 'name' => 'Timon Weitkamp', + 'email' => 'timon@smartfarmingtech.com', + 'created_at' => $mailing->created_at, + 'updated_at' => $mailing->updated_at, + ], + ]); + } + } + + private function createKakiraProject() + { + $project = \App\Models\Project::create([ + 'name' => 'Kakira', + 'mail_template' => 'Mail template for Kakira', + 'mail_subject' => 'SmartCane update Kakira for {date}', + 'mail_frequency' => 'Weekly', + 'mail_day' => 'Friday', + 'download_path' => 'kakira', + 'created_at' => '2021-01-01 00:00:00', + 'updated_at' => '2021-01-01 00:00:00', + ]); + + $project->boundingBoxes()->createMany([ + [ + 'name' => 'kakira_demo', + 'top_left_latitude' => 33.289993827426535, + 'top_left_longitude' => 0.491981861534345, + 'bottom_right_latitude' => 33.32572075441914, + 'bottom_right_longitude' => 0.5144195937114393, + 'created_at' => '2021-01-01 00:00:00', + 'updated_at' => '2021-01-01 00:00:00', + ], + ]); + + $project->emailRecipients()->createMany([ + [ + 'name' => 'Martin Folkerts', + 'email' => 'martin@sobit.nl', + 'created_at' => '2021-01-01 00:00:00', + 'updated_at' => '2021-01-01 00:00:00', + ], [ + 'name' => 'Timon Weitkamp', + 'email' => 'timon@smartfarmingtech.com', + 'created_at' => '2021-01-01 00:00:00', + 'updated_at' => '2021-01-01 00:00:00', + ], + ]); + + $project->mailings()->createMany([ + [ + 'subject' => 'Kakira 2021-01-01', + 'message' => 'Kakira 2021-01-01', + 'created_at' => '2021-01-01 00:00:00', + 'updated_at' => '2021-01-01 00:00:00', + ], [ + 'subject' => 'Kakira 2021-01-08', + 'message' => 'Kakira 2021-01-08', + 'created_at' => '2021-01-08 00:00:00', + 'updated_at' => '2021-01-08 00:00:00', + ], + ]); + + foreach ($project->mailings as $mailing) { + $mailing->recipients()->createMany([ + [ + 'name' => 'Martin Folkerts', + 'email' => 'martin@sobit.nl', + 'created_at' => $mailing->created_at, + 'updated_at' => $mailing->updated_at, + ], [ + 'name' => 'Timon Weitkamp', + 'email' => 'timon@smartfarmingtech.com', + 'created_at' => $mailing->created_at, + 'updated_at' => $mailing->updated_at, + ], + ]); + } } } diff --git a/laravel_app/resources/views/components/form-modal.blade.php b/laravel_app/resources/views/components/form-modal.blade.php new file mode 100644 index 0000000..6d7a78d --- /dev/null +++ b/laravel_app/resources/views/components/form-modal.blade.php @@ -0,0 +1,25 @@ +@props(['submit']) + +
| Id + | +Created | +Subject | +# | +Attachment | ++ Edit + | +
|---|---|---|---|---|---|
| {{ $mail->id }} | +{{ $mail->created_at }} | +{{ $mail->subject }} | +{{ $mail->recipients()->count() }} | +{{ $mail->attachments()->get('name')->implode(', ') }} | ++ + | +