update revisi
This commit is contained in:
@@ -68,3 +68,13 @@ VITE_APP_NAME="${APP_NAME}"
|
|||||||
NEXT_CLOUD_URL=
|
NEXT_CLOUD_URL=
|
||||||
NEXT_CLOUD_USERNAME=
|
NEXT_CLOUD_USERNAME=
|
||||||
NEXT_CLOUD_PASSWORD=
|
NEXT_CLOUD_PASSWORD=
|
||||||
|
|
||||||
|
WABLAS_HOST=
|
||||||
|
WABLAS_TOKEN=
|
||||||
|
|
||||||
|
STARTING_DATE='12'
|
||||||
|
CLOSING_DATE='10'
|
||||||
|
|
||||||
|
BREVO_API_KEY=
|
||||||
|
BREVO_MAIL_FROM_ADDRESS=
|
||||||
|
BREVO_MAIL_FROM_NAME=
|
||||||
|
|||||||
@@ -8,6 +8,15 @@ use Illuminate\Support\Str;
|
|||||||
|
|
||||||
class WhatsappHelper
|
class WhatsappHelper
|
||||||
{
|
{
|
||||||
|
protected $wablasHost;
|
||||||
|
protected $wablasToken;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
self::$wablasHost = env('WABLAS_HOST');
|
||||||
|
self::$wablasToken = env('WABLAS_TOKEN');
|
||||||
|
}
|
||||||
|
|
||||||
public static function approveExpense($phones, $expense_number, $url = null, $tanggal, $total, $name)
|
public static function approveExpense($phones, $expense_number, $url = null, $tanggal, $total, $name)
|
||||||
{
|
{
|
||||||
$client = new Client();
|
$client = new Client();
|
||||||
@@ -39,9 +48,9 @@ class WhatsappHelper
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Send the request to the WABLAS API
|
// Send the request to the WABLAS API
|
||||||
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
|
$response = $client->post(self::$wablasHost . '/api/v2/send-message', [
|
||||||
'headers' => [
|
'headers' => [
|
||||||
'Authorization' => env('WABLAS_TOKEN'),
|
'Authorization' => self::$wablasToken,
|
||||||
'Content-Type' => 'application/json'
|
'Content-Type' => 'application/json'
|
||||||
],
|
],
|
||||||
'json' => [
|
'json' => [
|
||||||
@@ -88,9 +97,9 @@ class WhatsappHelper
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Send the request to the WABLAS API
|
// Send the request to the WABLAS API
|
||||||
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
|
$response = $client->post(self::$wablasHost . '/api/v2/send-message', [
|
||||||
'headers' => [
|
'headers' => [
|
||||||
'Authorization' => env('WABLAS_TOKEN'),
|
'Authorization' => self::$wablasToken,
|
||||||
'Content-Type' => 'application/json'
|
'Content-Type' => 'application/json'
|
||||||
],
|
],
|
||||||
'json' => [
|
'json' => [
|
||||||
@@ -137,9 +146,9 @@ class WhatsappHelper
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Send the request to the WABLAS API
|
// Send the request to the WABLAS API
|
||||||
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
|
$response = $client->post(self::$wablasHost . '/api/v2/send-message', [
|
||||||
'headers' => [
|
'headers' => [
|
||||||
'Authorization' => env('WABLAS_TOKEN'),
|
'Authorization' => self::$wablasToken,
|
||||||
'Content-Type' => 'application/json'
|
'Content-Type' => 'application/json'
|
||||||
],
|
],
|
||||||
'json' => [
|
'json' => [
|
||||||
@@ -186,9 +195,9 @@ class WhatsappHelper
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Send the request to the WABLAS API
|
// Send the request to the WABLAS API
|
||||||
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
|
$response = $client->post(self::$wablasHost . '/api/v2/send-message', [
|
||||||
'headers' => [
|
'headers' => [
|
||||||
'Authorization' => env('WABLAS_TOKEN'),
|
'Authorization' => self::$wablasToken,
|
||||||
'Content-Type' => 'application/json'
|
'Content-Type' => 'application/json'
|
||||||
],
|
],
|
||||||
'json' => [
|
'json' => [
|
||||||
@@ -235,9 +244,9 @@ class WhatsappHelper
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Send the request to the WABLAS API
|
// Send the request to the WABLAS API
|
||||||
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
|
$response = $client->post(self::$wablasHost . '/api/v2/send-message', [
|
||||||
'headers' => [
|
'headers' => [
|
||||||
'Authorization' => env('WABLAS_TOKEN'),
|
'Authorization' => self::$wablasToken,
|
||||||
'Content-Type' => 'application/json'
|
'Content-Type' => 'application/json'
|
||||||
],
|
],
|
||||||
'json' => [
|
'json' => [
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ use App\Rules\FileType;
|
|||||||
use App\Helpers\BudgetHelper;
|
use App\Helpers\BudgetHelper;
|
||||||
use App\Helpers\NotificationHelper;
|
use App\Helpers\NotificationHelper;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use App\Services\BrevoService;
|
||||||
|
|
||||||
class FormEntertainmentPresentationController extends Controller
|
class FormEntertainmentPresentationController extends Controller
|
||||||
{
|
{
|
||||||
@@ -232,15 +233,22 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
WhatsappHelper::newExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::newExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new ExpenseCreated(
|
$mail = new ExpenseCreated(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseCreated($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
@@ -394,16 +402,23 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
$url = route('forms.entertainment.view', $form->id);
|
$url = route('forms.entertainment.view', $form->id);
|
||||||
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// // Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new ExpenseApproved(
|
$mail = new ExpenseApproved(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseApproved($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
@@ -478,16 +493,23 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
$url = route('forms.entertainment.view', $form->id);
|
$url = route('forms.entertainment.view', $form->id);
|
||||||
WhatsappHelper::approve2Expense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::approve2Expense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// // Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new ExpenseApproved2(
|
$mail = new ExpenseApproved2(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseApproved2($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
@@ -571,15 +593,22 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
WhatsappHelper::finalApprove($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::finalApprove($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new FinalApprove(
|
$mail = new FinalApprove(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseFinalApproved($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
@@ -629,15 +658,22 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new ExpenseRejected(
|
$mail = new ExpenseRejected(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseRejected($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ use App\Models\Admin;
|
|||||||
use App\Helpers\BudgetHelper;
|
use App\Helpers\BudgetHelper;
|
||||||
use App\Helpers\NotificationHelper;
|
use App\Helpers\NotificationHelper;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use App\Services\BrevoService;
|
||||||
|
|
||||||
class FormMeetingSeminarController extends Controller
|
class FormMeetingSeminarController extends Controller
|
||||||
{
|
{
|
||||||
@@ -268,15 +269,22 @@ class FormMeetingSeminarController extends Controller
|
|||||||
WhatsappHelper::newExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::newExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new ExpenseCreated(
|
$mail = new ExpenseCreated(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseCreated($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
@@ -476,16 +484,23 @@ class FormMeetingSeminarController extends Controller
|
|||||||
$url = route('forms.meeting.view', $form->id);
|
$url = route('forms.meeting.view', $form->id);
|
||||||
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// // Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new ExpenseApproved(
|
$mail = new ExpenseApproved(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseApproved($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
@@ -560,16 +575,23 @@ class FormMeetingSeminarController extends Controller
|
|||||||
$url = route('forms.meeting.view', $form->id);
|
$url = route('forms.meeting.view', $form->id);
|
||||||
WhatsappHelper::approve2Expense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::approve2Expense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// // Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new ExpenseApproved2(
|
$mail = new ExpenseApproved2(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseApproved2($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
@@ -711,15 +733,22 @@ class FormMeetingSeminarController extends Controller
|
|||||||
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new ExpenseRejected(
|
$mail = new ExpenseRejected(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseRejected($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ use App\Helpers\BudgetHelper;
|
|||||||
use App\Helpers\NotificationHelper;
|
use App\Helpers\NotificationHelper;
|
||||||
use App\Models\Cabang;
|
use App\Models\Cabang;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use App\Services\BrevoService;
|
||||||
|
|
||||||
class FormOtherController extends Controller
|
class FormOtherController extends Controller
|
||||||
{
|
{
|
||||||
@@ -226,15 +227,22 @@ class FormOtherController extends Controller
|
|||||||
WhatsappHelper::newExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::newExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new ExpenseCreated(
|
$mail = new ExpenseCreated(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseCreated($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
@@ -383,16 +391,23 @@ class FormOtherController extends Controller
|
|||||||
$url = route('forms.other.view', $form->id);
|
$url = route('forms.other.view', $form->id);
|
||||||
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// // Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new ExpenseApproved(
|
$mail = new ExpenseApproved(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseApproved($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
@@ -466,16 +481,23 @@ class FormOtherController extends Controller
|
|||||||
$url = route('forms.other.view', $form->id);
|
$url = route('forms.other.view', $form->id);
|
||||||
WhatsappHelper::approve2Expense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::approve2Expense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// // Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new ExpenseApproved2(
|
$mail = new ExpenseApproved2(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseApproved2($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
@@ -559,15 +581,22 @@ class FormOtherController extends Controller
|
|||||||
WhatsappHelper::finalApprove($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::finalApprove($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new FinalApprove(
|
$mail = new FinalApprove(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseFinalApproved($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
@@ -617,15 +646,22 @@ class FormOtherController extends Controller
|
|||||||
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new ExpenseRejected(
|
$mail = new ExpenseRejected(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseRejected($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ use App\Models\Admin;
|
|||||||
use App\Helpers\BudgetHelper;
|
use App\Helpers\BudgetHelper;
|
||||||
use App\Helpers\NotificationHelper;
|
use App\Helpers\NotificationHelper;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use App\Services\BrevoService;
|
||||||
|
|
||||||
class FormUpCountryController extends Controller
|
class FormUpCountryController extends Controller
|
||||||
{
|
{
|
||||||
@@ -297,15 +298,22 @@ class FormUpCountryController extends Controller
|
|||||||
WhatsappHelper::newExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::newExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new ExpenseCreated(
|
$mail = new ExpenseCreated(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseCreated($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
@@ -534,15 +542,23 @@ class FormUpCountryController extends Controller
|
|||||||
$url = route('forms.up-country.view', $form->id);
|
$url = route('forms.up-country.view', $form->id);
|
||||||
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new ExpenseApproved(
|
$mail = new ExpenseApproved(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseApproved($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
@@ -616,16 +632,23 @@ class FormUpCountryController extends Controller
|
|||||||
$url = route('forms.up-country.view', $form->id);
|
$url = route('forms.up-country.view', $form->id);
|
||||||
WhatsappHelper::approve2Expense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::approve2Expense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// // Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new ExpenseApproved2(
|
$mail = new ExpenseApproved2(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseApproved2($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
@@ -709,15 +732,22 @@ class FormUpCountryController extends Controller
|
|||||||
WhatsappHelper::finalApprove($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::finalApprove($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new FinalApprove(
|
$mail = new FinalApprove(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseFinalApproved($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
@@ -767,15 +797,22 @@ class FormUpCountryController extends Controller
|
|||||||
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new ExpenseRejected(
|
$mail = new ExpenseRejected(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseRejected($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ use App\Models\Admin;
|
|||||||
use App\Helpers\BudgetHelper;
|
use App\Helpers\BudgetHelper;
|
||||||
use App\Helpers\NotificationHelper;
|
use App\Helpers\NotificationHelper;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use App\Services\BrevoService;
|
||||||
|
|
||||||
class FormVehicleController extends Controller
|
class FormVehicleController extends Controller
|
||||||
{
|
{
|
||||||
@@ -233,15 +234,22 @@ class FormVehicleController extends Controller
|
|||||||
WhatsappHelper::newExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::newExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new ExpenseCreated(
|
$mail = new ExpenseCreated(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseCreated($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
@@ -396,16 +404,23 @@ class FormVehicleController extends Controller
|
|||||||
$url = route('forms.vehicle.view', $form->id);
|
$url = route('forms.vehicle.view', $form->id);
|
||||||
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// // Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new ExpenseApproved(
|
$mail = new ExpenseApproved(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseApproved($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
@@ -480,16 +495,23 @@ class FormVehicleController extends Controller
|
|||||||
$url = route('forms.vehicle.view', $form->id);
|
$url = route('forms.vehicle.view', $form->id);
|
||||||
WhatsappHelper::approve2Expense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::approve2Expense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// // Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new ExpenseApproved2(
|
$mail = new ExpenseApproved2(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseApproved2($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
@@ -574,15 +596,22 @@ class FormVehicleController extends Controller
|
|||||||
WhatsappHelper::finalApprove($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::finalApprove($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new FinalApprove(
|
$mail = new FinalApprove(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseFinalApproved($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
@@ -632,15 +661,22 @@ class FormVehicleController extends Controller
|
|||||||
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
|
$brevoService = app(BrevoService::class);
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
try {
|
try {
|
||||||
Mail::to($recipient)->send(new ExpenseRejected(
|
$mail = new ExpenseRejected(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
);
|
||||||
|
|
||||||
|
$response = $brevoService->expenseRejected($recipient, $name, $mail);
|
||||||
|
|
||||||
|
if (isset($response['success']) && $response['success'] === false) {
|
||||||
|
Log::warning("Email to {$recipient} failed: " . ($response['message'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
Log::error("Failed to send email to {$recipient}: " . $e->getMessage());
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class Kernel extends HttpKernel
|
|||||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
|
\App\Http\Middleware\SessionTimeout::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
'api' => [
|
'api' => [
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
class SessionTimeout
|
||||||
|
{
|
||||||
|
public function handle(Request $request, Closure $next)
|
||||||
|
{
|
||||||
|
// Get last activity time
|
||||||
|
$lastActivity = session('lastActivityTime');
|
||||||
|
|
||||||
|
// Set logout time in minutes (30 minutes)
|
||||||
|
$timeout = 30 * 60;
|
||||||
|
|
||||||
|
if ($lastActivity && (time() - $lastActivity > $timeout)) {
|
||||||
|
Auth::logout();
|
||||||
|
session()->flush();
|
||||||
|
return redirect('/login')->with('message', 'Session expired due to inactivity.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update session activity time
|
||||||
|
session(['lastActivityTime' => time()]);
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,19 +3,16 @@
|
|||||||
namespace App\Mail;
|
namespace App\Mail;
|
||||||
|
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Mail\Mailable;
|
use Illuminate\Mail\Mailable;
|
||||||
use Illuminate\Mail\Mailables\Content;
|
use Illuminate\Mail\Mailables\Content;
|
||||||
use Illuminate\Mail\Mailables\Envelope;
|
use Illuminate\Mail\Mailables\Envelope;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use Illuminate\Support\Facades\View;
|
||||||
|
|
||||||
class ExpenseApproved extends Mailable
|
class ExpenseApproved extends Mailable
|
||||||
{
|
{
|
||||||
use Queueable, SerializesModels;
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new message instance.
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected string $name,
|
protected string $name,
|
||||||
protected string $expense_number,
|
protected string $expense_number,
|
||||||
@@ -24,9 +21,6 @@ class ExpenseApproved extends Mailable
|
|||||||
protected string $url,
|
protected string $url,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the message envelope.
|
|
||||||
*/
|
|
||||||
public function envelope(): Envelope
|
public function envelope(): Envelope
|
||||||
{
|
{
|
||||||
return new Envelope(
|
return new Envelope(
|
||||||
@@ -34,9 +28,6 @@ class ExpenseApproved extends Mailable
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the message content definition.
|
|
||||||
*/
|
|
||||||
public function content(): Content
|
public function content(): Content
|
||||||
{
|
{
|
||||||
return new Content(
|
return new Content(
|
||||||
@@ -51,13 +42,22 @@ class ExpenseApproved extends Mailable
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the attachments for the message.
|
|
||||||
*
|
|
||||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
|
||||||
*/
|
|
||||||
public function attachments(): array
|
public function attachments(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the Blade email template as HTML string (for Brevo API).
|
||||||
|
*/
|
||||||
|
public function renderHtml(): string
|
||||||
|
{
|
||||||
|
return View::make('mail.approved', [
|
||||||
|
'name' => $this->name,
|
||||||
|
'expense_number' => $this->expense_number,
|
||||||
|
'tanggal' => $this->tanggal,
|
||||||
|
'total' => $this->total,
|
||||||
|
'url' => $this->url,
|
||||||
|
])->render();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,26 +3,33 @@
|
|||||||
namespace App\Mail;
|
namespace App\Mail;
|
||||||
|
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Mail\Mailable;
|
use Illuminate\Mail\Mailable;
|
||||||
use Illuminate\Mail\Mailables\Content;
|
use Illuminate\Mail\Mailables\Content;
|
||||||
use Illuminate\Mail\Mailables\Envelope;
|
use Illuminate\Mail\Mailables\Envelope;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use Illuminate\Support\Facades\View;
|
||||||
|
|
||||||
class ExpenseApproved2 extends Mailable
|
class ExpenseApproved2 extends Mailable
|
||||||
{
|
{
|
||||||
use Queueable, SerializesModels;
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
protected string $name;
|
||||||
|
protected string $expense_number;
|
||||||
|
protected string $tanggal;
|
||||||
|
protected int $total;
|
||||||
|
protected string $url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new message instance.
|
* Create a new message instance.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(string $name, string $expense_number, string $tanggal, int $total, string $url)
|
||||||
protected string $name,
|
{
|
||||||
protected string $expense_number,
|
$this->name = $name;
|
||||||
protected string $tanggal,
|
$this->expense_number = $expense_number;
|
||||||
protected int $total,
|
$this->tanggal = $tanggal;
|
||||||
protected string $url,
|
$this->total = $total;
|
||||||
) {}
|
$this->url = $url;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the message envelope.
|
* Get the message envelope.
|
||||||
@@ -60,4 +67,18 @@ class ExpenseApproved2 extends Mailable
|
|||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the Blade email template as an HTML string (for Brevo API).
|
||||||
|
*/
|
||||||
|
public function renderHtml(): string
|
||||||
|
{
|
||||||
|
return View::make('mail.approved2', [
|
||||||
|
'name' => $this->name,
|
||||||
|
'expense_number' => $this->expense_number,
|
||||||
|
'tanggal' => $this->tanggal,
|
||||||
|
'total' => $this->total,
|
||||||
|
'url' => $this->url,
|
||||||
|
])->render();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,26 +3,33 @@
|
|||||||
namespace App\Mail;
|
namespace App\Mail;
|
||||||
|
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Mail\Mailable;
|
use Illuminate\Mail\Mailable;
|
||||||
use Illuminate\Mail\Mailables\Content;
|
use Illuminate\Mail\Mailables\Content;
|
||||||
use Illuminate\Mail\Mailables\Envelope;
|
use Illuminate\Mail\Mailables\Envelope;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use Illuminate\Support\Facades\View;
|
||||||
|
|
||||||
class ExpenseCreated extends Mailable
|
class ExpenseCreated extends Mailable
|
||||||
{
|
{
|
||||||
use Queueable, SerializesModels;
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
protected string $name;
|
||||||
|
protected string $expense_number;
|
||||||
|
protected string $tanggal;
|
||||||
|
protected int $total;
|
||||||
|
protected string $url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new message instance.
|
* Create a new message instance.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(string $name, string $expense_number, string $tanggal, int $total, string $url)
|
||||||
protected string $name,
|
{
|
||||||
protected string $expense_number,
|
$this->name = $name;
|
||||||
protected string $tanggal,
|
$this->expense_number = $expense_number;
|
||||||
protected int $total,
|
$this->tanggal = $tanggal;
|
||||||
protected string $url,
|
$this->total = $total;
|
||||||
) {}
|
$this->url = $url;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the message envelope.
|
* Get the message envelope.
|
||||||
@@ -60,4 +67,18 @@ class ExpenseCreated extends Mailable
|
|||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the Blade email template as an HTML string (for Brevo API).
|
||||||
|
*/
|
||||||
|
public function renderHtml(): string
|
||||||
|
{
|
||||||
|
return View::make('mail.created', [
|
||||||
|
'name' => $this->name,
|
||||||
|
'expense_number' => $this->expense_number,
|
||||||
|
'tanggal' => $this->tanggal,
|
||||||
|
'total' => $this->total,
|
||||||
|
'url' => $this->url,
|
||||||
|
])->render();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,26 +3,33 @@
|
|||||||
namespace App\Mail;
|
namespace App\Mail;
|
||||||
|
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Mail\Mailable;
|
use Illuminate\Mail\Mailable;
|
||||||
use Illuminate\Mail\Mailables\Content;
|
use Illuminate\Mail\Mailables\Content;
|
||||||
use Illuminate\Mail\Mailables\Envelope;
|
use Illuminate\Mail\Mailables\Envelope;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use Illuminate\Support\Facades\View;
|
||||||
|
|
||||||
class ExpenseRejected extends Mailable
|
class ExpenseRejected extends Mailable
|
||||||
{
|
{
|
||||||
use Queueable, SerializesModels;
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
protected string $name;
|
||||||
|
protected string $expense_number;
|
||||||
|
protected string $tanggal;
|
||||||
|
protected int $total;
|
||||||
|
protected string $url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new message instance.
|
* Create a new message instance.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(string $name, string $expense_number, string $tanggal, int $total, string $url)
|
||||||
protected string $name,
|
{
|
||||||
protected string $expense_number,
|
$this->name = $name;
|
||||||
protected string $tanggal,
|
$this->expense_number = $expense_number;
|
||||||
protected int $total,
|
$this->tanggal = $tanggal;
|
||||||
protected string $url,
|
$this->total = $total;
|
||||||
) {}
|
$this->url = $url;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the message envelope.
|
* Get the message envelope.
|
||||||
@@ -60,4 +67,18 @@ class ExpenseRejected extends Mailable
|
|||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the Blade email template as an HTML string (for Brevo API).
|
||||||
|
*/
|
||||||
|
public function renderHtml(): string
|
||||||
|
{
|
||||||
|
return View::make('mail.rejected', [
|
||||||
|
'name' => $this->name,
|
||||||
|
'expense_number' => $this->expense_number,
|
||||||
|
'tanggal' => $this->tanggal,
|
||||||
|
'total' => $this->total,
|
||||||
|
'url' => $this->url,
|
||||||
|
])->render();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,26 +3,33 @@
|
|||||||
namespace App\Mail;
|
namespace App\Mail;
|
||||||
|
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Mail\Mailable;
|
use Illuminate\Mail\Mailable;
|
||||||
use Illuminate\Mail\Mailables\Content;
|
use Illuminate\Mail\Mailables\Content;
|
||||||
use Illuminate\Mail\Mailables\Envelope;
|
use Illuminate\Mail\Mailables\Envelope;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use Illuminate\Support\Facades\View;
|
||||||
|
|
||||||
class FinalApprove extends Mailable
|
class FinalApprove extends Mailable
|
||||||
{
|
{
|
||||||
use Queueable, SerializesModels;
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
protected string $name;
|
||||||
|
protected string $expense_number;
|
||||||
|
protected string $tanggal;
|
||||||
|
protected int $total;
|
||||||
|
protected string $url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new message instance.
|
* Create a new message instance.
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(string $name, string $expense_number, string $tanggal, int $total, string $url)
|
||||||
protected string $name,
|
{
|
||||||
protected string $expense_number,
|
$this->name = $name;
|
||||||
protected string $tanggal,
|
$this->expense_number = $expense_number;
|
||||||
protected int $total,
|
$this->tanggal = $tanggal;
|
||||||
protected string $url,
|
$this->total = $total;
|
||||||
) {}
|
$this->url = $url;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the message envelope.
|
* Get the message envelope.
|
||||||
@@ -60,4 +67,18 @@ class FinalApprove extends Mailable
|
|||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the Blade email template as an HTML string (for Brevo API).
|
||||||
|
*/
|
||||||
|
public function renderHtml(): string
|
||||||
|
{
|
||||||
|
return View::make('mail.closed', [
|
||||||
|
'name' => $this->name,
|
||||||
|
'expense_number' => $this->expense_number,
|
||||||
|
'tanggal' => $this->tanggal,
|
||||||
|
'total' => $this->total,
|
||||||
|
'url' => $this->url,
|
||||||
|
])->render();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,218 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services;
|
||||||
|
|
||||||
|
use GuzzleHttp\Client;
|
||||||
|
use GuzzleHttp\Exception\RequestException;
|
||||||
|
use App\Mail\ExpenseCreated;
|
||||||
|
use App\Mail\ExpenseApproved;
|
||||||
|
use App\Mail\ExpenseApproved2;
|
||||||
|
use App\Mail\ExpenseRejected;
|
||||||
|
use App\Mail\FinalApprove;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class BrevoService
|
||||||
|
{
|
||||||
|
protected $client;
|
||||||
|
protected $apiKey;
|
||||||
|
protected $mailFromAddress;
|
||||||
|
protected $mailFromName;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->client = new Client();
|
||||||
|
$this->apiKey = env('BREVO_API_KEY');
|
||||||
|
$this->mailFromAddress = env('BREVO_MAIL_FROM_ADDRESS');
|
||||||
|
$this->mailFromName = env('BREVO_MAIL_FROM_NAME');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function expenseCreated($recipientEmail, $recipientName, ExpenseCreated $mail)
|
||||||
|
{
|
||||||
|
$htmlContent = $mail->renderHtml(); // Convert Blade view to HTML
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = $this->client->post('https://api.brevo.com/v3/smtp/email', [
|
||||||
|
'headers' => [
|
||||||
|
'accept' => 'application/json',
|
||||||
|
'api-key' => $this->apiKey,
|
||||||
|
'content-type' => 'application/json',
|
||||||
|
],
|
||||||
|
'json' => [
|
||||||
|
'sender' => [
|
||||||
|
'name' => $this->mailFromName,
|
||||||
|
'email' => $this->mailFromAddress,
|
||||||
|
],
|
||||||
|
'to' => [
|
||||||
|
[
|
||||||
|
'email' => $recipientEmail,
|
||||||
|
'name' => $recipientName,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'subject' => 'Expense Created',
|
||||||
|
'htmlContent' => $htmlContent,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
return json_decode($response->getBody(), true);
|
||||||
|
} catch (RequestException $e) {
|
||||||
|
Log::error('Brevo email failed to send', [
|
||||||
|
'error' => $e->getMessage(),
|
||||||
|
'recipient' => $recipientEmail,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function expenseApproved($recipientEmail, $recipientName, ExpenseApproved $mail)
|
||||||
|
{
|
||||||
|
$htmlContent = $mail->renderHtml(); // Convert Blade view to HTML
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = $this->client->post('https://api.brevo.com/v3/smtp/email', [
|
||||||
|
'headers' => [
|
||||||
|
'accept' => 'application/json',
|
||||||
|
'api-key' => $this->apiKey,
|
||||||
|
'content-type' => 'application/json',
|
||||||
|
],
|
||||||
|
'json' => [
|
||||||
|
'sender' => [
|
||||||
|
'name' => $this->mailFromName,
|
||||||
|
'email' => $this->mailFromAddress,
|
||||||
|
],
|
||||||
|
'to' => [
|
||||||
|
[
|
||||||
|
'email' => $recipientEmail,
|
||||||
|
'name' => $recipientName,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'subject' => 'Expense First Approval',
|
||||||
|
'htmlContent' => $htmlContent,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
return json_decode($response->getBody(), true);
|
||||||
|
} catch (RequestException $e) {
|
||||||
|
Log::error('Brevo email failed to send', [
|
||||||
|
'error' => $e->getMessage(),
|
||||||
|
'recipient' => $recipientEmail,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function expenseApproved2($recipientEmail, $recipientName, ExpenseApproved2 $mail)
|
||||||
|
{
|
||||||
|
$htmlContent = $mail->renderHtml(); // Convert Blade view to HTML
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = $this->client->post('https://api.brevo.com/v3/smtp/email', [
|
||||||
|
'headers' => [
|
||||||
|
'accept' => 'application/json',
|
||||||
|
'api-key' => $this->apiKey,
|
||||||
|
'content-type' => 'application/json',
|
||||||
|
],
|
||||||
|
'json' => [
|
||||||
|
'sender' => [
|
||||||
|
'name' => $this->mailFromName,
|
||||||
|
'email' => $this->mailFromAddress,
|
||||||
|
],
|
||||||
|
'to' => [
|
||||||
|
[
|
||||||
|
'email' => $recipientEmail,
|
||||||
|
'name' => $recipientName,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'subject' => 'Expense Second Approval',
|
||||||
|
'htmlContent' => $htmlContent,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
return json_decode($response->getBody(), true);
|
||||||
|
} catch (RequestException $e) {
|
||||||
|
Log::error('Brevo email failed to send', [
|
||||||
|
'error' => $e->getMessage(),
|
||||||
|
'recipient' => $recipientEmail,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function expenseFinalApproved($recipientEmail, $recipientName, FinalApprove $mail)
|
||||||
|
{
|
||||||
|
$htmlContent = $mail->renderHtml(); // Convert Blade view to HTML
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = $this->client->post('https://api.brevo.com/v3/smtp/email', [
|
||||||
|
'headers' => [
|
||||||
|
'accept' => 'application/json',
|
||||||
|
'api-key' => $this->apiKey,
|
||||||
|
'content-type' => 'application/json',
|
||||||
|
],
|
||||||
|
'json' => [
|
||||||
|
'sender' => [
|
||||||
|
'name' => $this->mailFromName,
|
||||||
|
'email' => $this->mailFromAddress,
|
||||||
|
],
|
||||||
|
'to' => [
|
||||||
|
[
|
||||||
|
'email' => $recipientEmail,
|
||||||
|
'name' => $recipientName,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'subject' => 'Expense Final Approval',
|
||||||
|
'htmlContent' => $htmlContent,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
return json_decode($response->getBody(), true);
|
||||||
|
} catch (RequestException $e) {
|
||||||
|
Log::error('Brevo email failed to send', [
|
||||||
|
'error' => $e->getMessage(),
|
||||||
|
'recipient' => $recipientEmail,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function expenseRejected($recipientEmail, $recipientName, ExpenseRejected $mail)
|
||||||
|
{
|
||||||
|
$htmlContent = $mail->renderHtml(); // Convert Blade view to HTML
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = $this->client->post('https://api.brevo.com/v3/smtp/email', [
|
||||||
|
'headers' => [
|
||||||
|
'accept' => 'application/json',
|
||||||
|
'api-key' => $this->apiKey,
|
||||||
|
'content-type' => 'application/json',
|
||||||
|
],
|
||||||
|
'json' => [
|
||||||
|
'sender' => [
|
||||||
|
'name' => $this->mailFromName,
|
||||||
|
'email' => $this->mailFromAddress,
|
||||||
|
],
|
||||||
|
'to' => [
|
||||||
|
[
|
||||||
|
'email' => $recipientEmail,
|
||||||
|
'name' => $recipientName,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'subject' => 'Expense Rejected',
|
||||||
|
'htmlContent' => $htmlContent,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
return json_decode($response->getBody(), true);
|
||||||
|
} catch (RequestException $e) {
|
||||||
|
Log::error('Brevo email failed to send', [
|
||||||
|
'error' => $e->getMessage(),
|
||||||
|
'recipient' => $recipientEmail,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -31,7 +31,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'lifetime' => env('SESSION_LIFETIME', 120),
|
'lifetime' => 30,
|
||||||
|
|
||||||
'expire_on_close' => false,
|
'expire_on_close' => false,
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
@foreach ($kategori as $item)
|
@foreach ($kategori as $item)
|
||||||
@php
|
@php
|
||||||
$drValue = $nominals[$item->id] ?? 0;
|
$drValue = $nominals[$item->id] ?? 0;
|
||||||
$drFormatted = $drValue == 0 ? '' : number_format($drValue, 0, ',', '.');
|
$drFormatted = $drValue == 0 ? '' : number_format($drValue, 0, ',', ',');
|
||||||
$totalDr += $drValue;
|
$totalDr += $drValue;
|
||||||
@endphp
|
@endphp
|
||||||
<tr>
|
<tr>
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
@php
|
@php
|
||||||
$crValue = $budget && $budget->amount != 0 ? $budget->amount : 0;
|
$crValue = $budget && $budget->amount != 0 ? $budget->amount : 0;
|
||||||
$totalCr += $crValue;
|
$totalCr += $crValue;
|
||||||
echo $crValue == 0 ? '' : number_format($crValue, 0, ',', '.');
|
echo $crValue == 0 ? '' : number_format($crValue, 0, ',', ',');
|
||||||
@endphp
|
@endphp
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
@php
|
@php
|
||||||
$totalCr += 500000;
|
$totalCr += 500000;
|
||||||
@endphp
|
@endphp
|
||||||
{{ number_format(500000, 0, ',', '.') }}
|
{{ number_format(500000, 0, ',', ',') }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@
|
|||||||
@php
|
@php
|
||||||
$totalDr += 500000;
|
$totalDr += 500000;
|
||||||
@endphp
|
@endphp
|
||||||
{{ number_format(500000, 0, ',', '.') }}
|
{{ number_format(500000, 0, ',', ',') }}
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -124,8 +124,8 @@
|
|||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3" class="text-right"><strong>Total</strong></td>
|
<td colspan="3" class="text-right"><strong>Total</strong></td>
|
||||||
<td>{{ number_format($totalDr, 0, ',', '.') }}</td>
|
<td>{{ number_format($totalDr, 0, ',', ',') }}</td>
|
||||||
<td>{{ number_format($totalCr, 0, ',', '.') }}</td>
|
<td>{{ number_format($totalCr, 0, ',', ',') }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -281,3 +281,28 @@
|
|||||||
|
|
||||||
periode.textContent = `${month} (12 ${month} - 10 ${nextMonth} ${year})`;
|
periode.textContent = `${month} (12 ${month} - 10 ${nextMonth} ${year})`;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
let logoutTimer;
|
||||||
|
|
||||||
|
function resetLogoutTimer() {
|
||||||
|
clearTimeout(logoutTimer);
|
||||||
|
logoutTimer = setTimeout(() => {
|
||||||
|
fetch("{{ route('admin.logout.submit') }}", {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"X-CSRF-TOKEN": "{{ csrf_token() }}",
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
},
|
||||||
|
body: JSON.stringify({})
|
||||||
|
}).then(() => {
|
||||||
|
window.location.href = "{{ url('/login') }}";
|
||||||
|
});
|
||||||
|
}, 30 * 60 * 1000); // 30 minutes
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('mousemove', resetLogoutTimer);
|
||||||
|
document.addEventListener('keydown', resetLogoutTimer);
|
||||||
|
|
||||||
|
resetLogoutTimer();
|
||||||
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user