@php use App\General\SettingsClass; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Config; use App\Models\User; // Email type configuration $emailTypes = [ 'referral_signup_user' => [ 'subject' => 'Your Referral Request is Pending Approval', 'status_text' => 'Pending Approval', 'color' => '#f59e0b', // Amber 'background' => 'linear-gradient(135deg, #fef3c7 0%, #fde68a 100%)', 'icon' => '⏳', 'message' => 'Thank you for your interest in becoming a referral partner! Your application is currently under review.', 'action_required' => false, 'action_message' => '' ], 'referral_signup_admin' => [ 'subject' => 'New Referral Signup Request', 'status_text' => 'New Request', 'color' => '#3b82f6', // Blue 'background' => 'linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%)', 'icon' => '🔔', 'message' => 'A new referral partner has signed up and is waiting for your approval.', 'action_required' => true, 'action_message' => 'Please review and approve/reject this application.' ], 'referral_approved' => [ 'subject' => 'Referral Partnership Approved!', 'status_text' => 'Approved', 'color' => '#059669', // Green 'background' => 'linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%)', 'icon' => '🎉', 'message' => 'Congratulations! Your referral partnership has been approved and you can now start earning commissions.', 'action_required' => true, 'action_message' => 'Access your dashboard to start referring customers!' ] ]; // Get email type configuration $emailType = $emailTypes[$email_type ?? 'referral_signup_user'] ?? $emailTypes['referral_signup_user']; $logoPath = null; $companyName = env('APP_NAME', 'WMS'); $companyAddress = ''; $companyCity = ''; $companyState = ''; $companyPostCode = ''; $companyCountry = ''; $companyPhone = 'Contact Information'; $companyEmail = env('EMAIL_ADDRESS', 'support@example.com'); // Get admin settings data $admin = User::where('user_type', config('constants.user_types.admin'))->first(); if ($admin) { $adminSettings = DB::table('adminsettings') ->where('customer_id', $admin->id) ->whereIn('key', [ 'company_logo', 'company_name', 'company_address', 'company_city', 'company_state', 'company_post_code', 'company_country', 'company_phone', 'company_email' ]) ->pluck('value', 'key') ->toArray(); $logoPath = $adminSettings['company_logo'] ?? null; $companyName = $adminSettings['company_name'] ?? $companyName; $companyAddress = $adminSettings['company_address'] ?? $companyAddress; $companyCity = $adminSettings['company_city'] ?? $companyCity; $companyState = $adminSettings['company_state'] ?? $companyState; $companyPostCode = $adminSettings['company_post_code'] ?? $companyPostCode; $companyCountry = $adminSettings['company_country'] ?? $companyCountry; $companyPhone = $adminSettings['company_phone'] ?? $companyPhone; $companyEmail = $adminSettings['company_email'] ?? $companyEmail; } $fullAddress = trim(implode(', ', array_filter([ $companyAddress, $companyCity, $companyState, $companyPostCode, $companyCountry ]))); @endphp {{ $emailType['subject'] }}
@if(!empty($logoPath) && file_exists(public_path($logoPath))) WMS Logo @else

{{ $companyName }}

@endif
@if($email_type == 'referral_signup_admin') Hello, Admin @else Hello, {{ $name ?? 'Valued Partner' }} @endif
{{ $emailType['subject'] }}

{{ $emailType['message'] }}

@if($emailType['action_required']) @endif
Thank you,
{{ $companyName }} Team