@php
$businessCards = collect($businesses ?? [])->map(function ($business, $index) {
$tradingName = $business->business_trading_name ?? 'Untitled Business';
$registeredName = $business->business_reg_name ?? null;
$tradeType = $business->business_trade_type ?? 'Business';
$registeredDate = $business->business_reg_date ?? null;
return [
'id' => $business->getKey() ?? ($index + 1),
'trading_name' => $tradingName,
'registered_name' => $registeredName,
'registration_number' => $business->business_reg_number ?? null,
'legal_type' => $business->business_legal_type ?? 'Private Company',
'trade_type' => $tradeType,
'vat_number' => $business->business_VAT_number ?? null,
'registration_date' => $registeredDate ? \Illuminate\Support\Carbon::parse($registeredDate)->format('Y-m-d') : '',
'business_province' => $business->province->name ?? 'Mpumalanga',
'business_town' => $business->town->town_name ?? 'Mbombela',
'status' => $index % 2 === 0 ? 'Active' : 'Review',
'suppliers' => $business->suppliers->map(fn ($supplier) => [
'id' => $supplier->getKey(),
'company_name' => $supplier->company_name,
'contact_person_full_name' => $supplier->name,
'cell_number' => $supplier->phone,
'whatsapp_number' => $supplier->whatsapp,
'email_address' => $supplier->email,
'is_active' => (bool) $supplier->is_active,
'date_added' => $supplier->date_added?->format('Y-m-d') ?? '',
'added_by_name' => $supplier->addedBy?->contact?->full_name ?? $supplier->addedBy?->username,
'consent_authority_confirmed' => (bool) $supplier->consent_authority_confirmed,
])->values()->all(),
'regulatory_contacts' => $business->regulatoryContacts->map(fn ($contact) => [
'id' => $contact->getKey(),
'province' => $contact->province?->name ?? '',
'province_label' => $contact->province?->display_name ?? $contact->province?->name ?? '',
'police_station_office' => $contact->police_station_office,
'officer_name' => $contact->officer_name,
'officer_surname' => $contact->officer_surname,
'rank' => $contact->rank,
'designation_type' => $contact->designation_type?->value,
'designation_label' => $contact->designation_type?->getLabel(),
'cell_number' => $contact->cell_number,
'whatsapp_number' => $contact->whatsapp_number,
'email_address' => $contact->email_address,
'office_landline' => $contact->office_landline,
'physical_area_jurisdiction' => $contact->physical_area_jurisdiction,
'notes' => $contact->notes,
'is_active' => (bool) $contact->is_active,
'popia_confirmation_accepted' => true,
'source_of_information' => $contact->source_of_information?->value,
'source_label' => $contact->source_of_information?->getLabel(),
'date_added' => $contact->date_added?->format('Y-m-d') ?? '',
'last_verified_date' => $contact->last_verified_date?->format('Y-m-d') ?? '',
])->values()->all(),
];
})->values();
$templateBusiness = [
'id' => null,
'state_revision' => 0,
'trading_name' => '',
'registered_name' => '',
'registration_number' => '',
'legal_type' => '',
'trade_type' => '',
'vat_number' => '',
'registration_date' => '',
'business_province' => '',
'business_town' => '',
'status' => 'Draft',
'suppliers' => [],
'regulatory_contacts' => [],
];
$totalSuppliers = $businessCards->sum(fn ($business) => count($business['suppliers'] ?? []));
$provinceOptionMap = collect($provinceOptions ?? [])->mapWithKeys(function ($provinceOption) {
return [
$provinceOption['name'] => $provinceOption['towns'] ?? [],
];
})->all();
@endphp
Client businesses
Your business workspace
View each client business, update the core details, and keep supplier contacts linked in one place.
No businesses yet
Start by adding a new business so the rest of the business workspace can be linked later.
@push('styles')
@endpush