@extends('admin.layouts.dashboard') @section('title', 'Edit Partner') @section('content') @php $locations = old('locations'); if (! is_array($locations) || count($locations) === 0) { $locations = $partner->locations->map(function ($location) { return [ 'label' => $location->label, 'address' => $location->address, 'map_location_url' => $location->map_location_url, 'map_lat' => $location->map_lat, 'map_lng' => $location->map_lng, 'business_logo' => $location->business_logo, 'business_image' => $location->business_image, 'is_primary' => $location->is_primary, ]; })->values()->all(); } if (count($locations) === 0) { $locations = [[ 'label' => 'Main Branch', 'address' => $partner->business_address, 'map_location_url' => $partner->map_location_url, 'map_lat' => $partner->map_lat, 'map_lng' => $partner->map_lng, 'business_logo' => $partner->business_logo, 'business_image' => $partner->business_image, 'is_primary' => true, ]]; } $mainBranch = collect($locations)->firstWhere('is_primary', true) ?? ($locations[0] ?? null); @endphp

Edit Partner

Update partner profile and manage all branch locations in one place.

Back to Partners
@if ($errors->any())
@endif
@csrf @method('put')
@if ($mainBranch)

Current Main Branch Details

Primary

Main Branch Address

{{ $mainBranch['address'] ?: 'N/A' }}

Main Branch Google Map Link

@if (!empty($mainBranch['map_location_url'])) Open Map @else

N/A

@endif
@endif

Branch Locations

Main branch comes from Step 2 registration details. Update it here or add more branches.

@foreach ($locations as $index => $location)

Location #{{ $index + 1 }}

If map URL is not exact, set Latitude/Longitude manually below.

@if (!empty($location['existing_business_logo'] ?? $location['business_logo'] ?? null)) Branch logo @elseif ($partner->business_logo)

Fallback: main logo

@endif
@if (!empty($location['existing_business_image'] ?? $location['business_image'] ?? null)) Branch image @elseif ($partner->business_image)

Fallback: main store image

@endif
@endforeach
@error('locations')

{{ $message }}

@enderror
@endsection