Wire Ladill domain picker and purchase modal into hosting flows.
Deploy Ladill Hosting / deploy (push) Successful in 51s
Deploy Ladill Hosting / deploy (push) Successful in 51s
Use the Domains API for owned domains across panel, account, and order forms, with an embedded iframe purchase modal instead of redirecting to domains.ladill.com. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -35,50 +35,23 @@
|
||||
|
||||
@if ($nativeForm['requires_domain'])
|
||||
@php
|
||||
$newDomainUrl = ladill_domains_url('/find');
|
||||
$ownedDomainHosts = $userDomains;
|
||||
$selectedOwned = in_array($oldDomainName, $ownedDomainHosts, true) ? $oldDomainName : '';
|
||||
$externalFallback = $initialDomainSource === 'external' ? $oldDomainName : '';
|
||||
@endphp
|
||||
<div>
|
||||
<div class="mb-2 flex items-center justify-between">
|
||||
<label class="text-sm font-medium text-gray-700">Domain</label>
|
||||
<div class="inline-flex items-center rounded-md bg-gray-100 p-0.5 text-[11px] font-medium">
|
||||
<button type="button" @click="domainSource = 'ladill'"
|
||||
:class="domainSource === 'ladill' ? 'bg-white text-gray-900 shadow-sm' : 'text-gray-500'"
|
||||
class="rounded px-2 py-1 transition">Ladill</button>
|
||||
<button type="button" @click="domainSource = 'external'"
|
||||
:class="domainSource === 'external' ? 'bg-white text-gray-900 shadow-sm' : 'text-gray-500'"
|
||||
class="rounded px-2 py-1 transition">External</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div x-show="domainSource === 'ladill'" x-cloak>
|
||||
@if ($userDomains->isNotEmpty())
|
||||
<div class="space-y-2">
|
||||
<select name="domain_name" :disabled="domainSource !== 'ladill'"
|
||||
class="w-full rounded-lg border-gray-200 bg-white px-3 py-2 text-sm focus:border-gray-400 focus:ring-0">
|
||||
<option value="">Choose a domain</option>
|
||||
@foreach ($userDomains as $domain)
|
||||
<option value="{{ $domain->host }}" @selected(old('domain_name') === $domain->host)>{{ $domain->host }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<p class="text-xs text-gray-500">
|
||||
Prefer another?
|
||||
<a href="{{ $newDomainUrl }}" class="font-medium text-gray-700 underline underline-offset-2 hover:text-gray-900">Get a new domain</a>
|
||||
</p>
|
||||
</div>
|
||||
@else
|
||||
<div class="rounded-lg bg-gray-50 px-3 py-2.5 text-center text-xs">
|
||||
<a href="{{ $newDomainUrl }}" class="font-medium text-gray-700 underline underline-offset-2 hover:text-gray-900">Get a new domain</a>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<div x-show="domainSource === 'external'" x-cloak>
|
||||
<input name="domain_name" type="text" x-model="externalDomain" :disabled="domainSource !== 'external'" value="{{ old('domain_name') }}"
|
||||
placeholder="example.com"
|
||||
class="w-full rounded-lg border-gray-200 bg-white px-3 py-2 text-sm placeholder-gray-400 focus:border-gray-400 focus:ring-0">
|
||||
</div>
|
||||
@error('domain_name')
|
||||
<p class="mt-1 text-xs text-red-600">{{ $message }}</p>
|
||||
@enderror
|
||||
<div x-data="ladillDomainSourceForm({
|
||||
domainSource: @js($initialDomainSource),
|
||||
selectedOwnedDomain: @js($selectedOwned),
|
||||
externalDomain: @js($externalFallback),
|
||||
ownedDomains: @js($ownedDomainHosts),
|
||||
ownedUrl: @js(route('hosting.domains.owned')),
|
||||
})">
|
||||
<x-domain-source-fields
|
||||
field-name="domain_name"
|
||||
:owned-domains="$ownedDomainHosts"
|
||||
owned-url="{{ route('hosting.domains.owned') }}"
|
||||
variant="gray"
|
||||
/>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user