feat: add bulk delete with validation to IP Pool and update provisioning logic and email notifications
This commit is contained in:
@@ -64,19 +64,23 @@ class SendVmCredentialsEmailJob implements ShouldQueue
|
||||
$orderItem = $vm->order?->orderItems?->first();
|
||||
$months = (int) ($orderItem?->months ?? 0);
|
||||
|
||||
$osGroupName = $vm->os?->osGroup?->name ?? '';
|
||||
$isWindows = str_contains(strtolower($osGroupName), 'windows');
|
||||
$osUsername = $isWindows ? 'Administrator' : 'root';
|
||||
|
||||
$emailData = [
|
||||
'company_name' => $settingValue->company ?? 'Thế Giới Số',
|
||||
'company_logo' => $settingValue->logo ?? '',
|
||||
'client_name' => trim($customer->firstname . ' ' . $customer->lastname),
|
||||
'client_name' => $customer->fullname ?? '',
|
||||
'product_name' => $orderItem?->getProductAttribute()?->name ?? 'Cloud VPS',
|
||||
'product_billing' => $this->billingLabel($months),
|
||||
'product_price' => $orderItem ? number_format((float) $orderItem->price, 0, ',', '.') : 'N/A',
|
||||
'service_host' => $vm->ip ?? 'N/A',
|
||||
'service_username' => $vm->user,
|
||||
'service_username' => $osUsername,
|
||||
'service_port' => $vm->port,
|
||||
'service_password' => $vm->plain_password ?? '(xem tài khoản quản lý)',
|
||||
'os_name' => $vm->os
|
||||
? (($vm->os->osGroup?->name ?? '') . ' ' . $vm->os->version)
|
||||
? (($osGroupName . ' ' . $vm->os->version))
|
||||
: 'Unknown OS',
|
||||
'service_due_exp' => $vm->next_due_date
|
||||
? date('d/m/Y', (int) $vm->next_due_date)
|
||||
@@ -117,7 +121,7 @@ class SendVmCredentialsEmailJob implements ShouldQueue
|
||||
// Notify admin with VM credentials after successful provisioning
|
||||
$order = $vm->order;
|
||||
AdminOrderNotificationJob::dispatch([
|
||||
'customer_name' => trim($customer->firstname . ' ' . $customer->lastname),
|
||||
'customer_name' => $customer->fullname ?? '',
|
||||
'customer_email' => $customer->email,
|
||||
'client_ip' => null,
|
||||
'order_num' => $order?->order_num ?? $order?->id ?? 'N/A',
|
||||
@@ -127,7 +131,7 @@ class SendVmCredentialsEmailJob implements ShouldQueue
|
||||
'total' => $orderItem?->price ?? 0,
|
||||
'created_at' => $order?->created_at?->format('d/m/Y H:i:s') ?? now()->format('d/m/Y H:i:s'),
|
||||
'ip' => $vm->ip ?? '',
|
||||
'username' => $vm->user ?? '',
|
||||
'username' => $osUsername,
|
||||
'password' => $vm->plain_password ?? '',
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user