From 66071a40aba0f0c27f2b2fdd4d33ef05cfe27255 Mon Sep 17 00:00:00 2001
From: Aziz <104441723+AzGasim@users.noreply.github.com>
Date: Fri, 13 Dec 2024 09:24:33 +0100
Subject: [PATCH] update mail template, dynamic columns for tabs
---
config/expiry.php | 6 +++---
.../views/emails/escalated_expiries.blade.php | 2 ++
packages/expiry/src/Jobs/SendEscalatedExpiriesJob.php | 1 +
packages/expiry/src/Resources/ExpiryResource.php | 10 ++++++++--
4 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/config/expiry.php b/config/expiry.php
index 9af0551b4..012f87dd1 100644
--- a/config/expiry.php
+++ b/config/expiry.php
@@ -63,7 +63,7 @@
'icon' => 'gmdi-text-snippet',
'query' => [
[
- 'field' => 'expiry_job',
+ 'field' => 'category',
'operator' => '=',
'value' => 'Documents',
],
@@ -77,7 +77,7 @@
'icon' => 'gmdi-account-circle',
'query' => [
[
- 'field' => 'expiry_job',
+ 'field' => 'category',
'operator' => '=',
'value' => 'Articles',
],
@@ -91,7 +91,7 @@
'icon' => 'gmdi-no-accounts',
'query' => [
[
- 'field' => 'expiry_job',
+ 'field' => 'category',
'operator' => '=',
'value' => 'Tasks',
],
diff --git a/packages/expiry/resources/views/emails/escalated_expiries.blade.php b/packages/expiry/resources/views/emails/escalated_expiries.blade.php
index 2f4fed156..360be1d14 100644
--- a/packages/expiry/resources/views/emails/escalated_expiries.blade.php
+++ b/packages/expiry/resources/views/emails/escalated_expiries.blade.php
@@ -110,6 +110,7 @@
{{ __('core::core.title') }} |
{{ __('core::expiry.notifyUser') }} |
+ {{ __('core::core.category') }} |
{{ __('core::expiry.will_expire_at') }} |
{{ __('core::expiry.processing_deadline') }} |
{{ __('core::expiry.escalated_at') }} |
@@ -120,6 +121,7 @@
{{ $entry['title'] }} |
{{ $entry['notified_to'] }} |
+ {{ $entry['category'] }} |
{{ $entry['expired_at'] }} |
{{ $entry['processing_deadline'] }} |
{{ $entry['escalated_at'] }} |
diff --git a/packages/expiry/src/Jobs/SendEscalatedExpiriesJob.php b/packages/expiry/src/Jobs/SendEscalatedExpiriesJob.php
index 595a74466..86db1ec95 100644
--- a/packages/expiry/src/Jobs/SendEscalatedExpiriesJob.php
+++ b/packages/expiry/src/Jobs/SendEscalatedExpiriesJob.php
@@ -47,6 +47,7 @@ public function handle()
'escalated_at' => Carbon::parse($entry->escalated_at)->format('d.m.Y'),
'notified_to' => config('expiry.user_model')::where('ID', $entry->notified_to)->first()?->display_name,
'user_email' => config('expiry.user_model')::where('ID', $entry->notified_to)->first()?->email,
+ 'category' => $entry->category,
];
}),
];
diff --git a/packages/expiry/src/Resources/ExpiryResource.php b/packages/expiry/src/Resources/ExpiryResource.php
index 426ebbf3b..c51f5fe02 100644
--- a/packages/expiry/src/Resources/ExpiryResource.php
+++ b/packages/expiry/src/Resources/ExpiryResource.php
@@ -59,7 +59,10 @@ public static function table(Table $table): Table
->toggleable()
->sortable()
->since()
- ->visible(fn () => Expiry::query()->whereNotNull('processing_deadline')->exists()),
+ ->hidden(fn () => ! Expiry::query()->whereNotNull('processing_deadline')->exists())
+ ->visible(
+ fn ($livewire) => isset($livewire->activeTab)
+ && in_array($livewire->activeTab, ['all', 'documents', 'tasks'])),
Tables\Columns\TextColumn::make('escalated_at')
->label(__('core::expiry.escalated_at'))
->toggleable()
@@ -67,7 +70,10 @@ public static function table(Table $table): Table
->date()
->icon('gmdi-warning')
->color('warning')
- ->visible(fn () => Expiry::query()->whereNotNull('escalated_at')->exists()),
+ ->hidden(fn () => ! Expiry::query()->whereNotNull('escalated_at')->exists())
+ ->visible(
+ fn ($livewire) => isset($livewire->activeTab)
+ && in_array($livewire->activeTab, ['all', 'documents', 'tasks'])),
Tables\Columns\TextColumn::make('cycle')
->label(__('core::expiry.cycle'))
->toggleable()