Deploy Ladill Merchant / deploy (push) Successful in 30s
- New Products page (merchant.products.*) with full CRUD proxied to the Ladill CRM products API via a new CrmClient + config/crm.php (owner-scoped, type=product). - Sidebar gains a Products entry. - The new storefront form loads the merchant's catalog: each shop/menu section gets an "Add from products…" picker that drops a CRM product in as an item (name, price, description). Catalog fetch is resilient — empty if CRM is down. Wires CRM_API_URL + CRM_API_KEY_MERCHANT on the merchant env (matches CRM). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
75 lines
4.0 KiB
PHP
75 lines
4.0 KiB
PHP
<x-user-layout>
|
|
<x-slot name="title">Create storefront</x-slot>
|
|
@php
|
|
$prefill = $prefill ?? [];
|
|
$createType = old('type', $prefill['type'] ?? $requestedType ?? \App\Models\QrCode::TYPE_SHOP);
|
|
$prefillContent = [];
|
|
if (!empty($prefill)) {
|
|
$prefillContent = array_filter([
|
|
'title' => $prefill['shop_title'] ?? null,
|
|
'sections' => $prefill['sections'] ?? null,
|
|
'accepts_payment' => $prefill['accepts_payment'] ?? true,
|
|
], fn ($v) => $v !== null);
|
|
}
|
|
@endphp
|
|
|
|
<div class="mx-auto max-w-2xl space-y-6" x-data="{ type: @js($createType) }">
|
|
<div>
|
|
<a href="{{ route('merchant.storefronts.index') }}" class="inline-flex items-center gap-1 text-sm text-slate-500 hover:text-slate-700">
|
|
<svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 19.5 8.25 12l7.5-7.5"/></svg>
|
|
All storefronts
|
|
</a>
|
|
<h1 class="mt-2 text-xl font-semibold text-slate-900">Create storefront</h1>
|
|
<p class="mt-1 text-sm text-slate-500">Pick what you're selling, then add your products, menu, or bookable services.</p>
|
|
</div>
|
|
|
|
@if(!empty($prefill))
|
|
<div class="rounded-xl border border-indigo-200 bg-indigo-50 px-4 py-3 text-sm text-indigo-900">
|
|
Prefilled from Ladill CRM. Review products and payment settings, then create your storefront.
|
|
</div>
|
|
@endif
|
|
|
|
@if(session('error'))
|
|
<div class="rounded-xl border border-red-100 bg-red-50 px-4 py-3 text-sm text-red-700">{{ session('error') }}</div>
|
|
@endif
|
|
@if($errors->any())
|
|
<div class="rounded-xl border border-red-100 bg-red-50 px-4 py-3 text-sm text-red-700">
|
|
<ul class="list-inside list-disc space-y-0.5">
|
|
@foreach($errors->all() as $error)<li>{{ $error }}</li>@endforeach
|
|
</ul>
|
|
</div>
|
|
@endif
|
|
|
|
<form method="post" action="{{ route('merchant.storefronts.store') }}" enctype="multipart/form-data" class="space-y-5 rounded-2xl border border-slate-200 bg-white p-6">
|
|
@csrf
|
|
|
|
<div>
|
|
<p class="mb-2 text-xs font-semibold text-slate-600">Storefront type</p>
|
|
<div class="grid grid-cols-3 gap-2">
|
|
@foreach(\App\Support\Qr\QrTypeCatalog::all() as $key => $meta)
|
|
<button type="button" @click="type = '{{ $key }}'"
|
|
:class="type === '{{ $key }}' ? 'border-indigo-500 bg-indigo-50 text-indigo-700' : 'border-slate-200 bg-white text-slate-500 hover:border-slate-300'"
|
|
class="rounded-xl border-2 px-3 py-3 text-left transition">
|
|
<span class="block text-sm font-semibold">{{ $meta['label'] }}</span>
|
|
<span class="mt-0.5 block text-[11px] leading-tight opacity-80">{{ $meta['description'] }}</span>
|
|
</button>
|
|
@endforeach
|
|
</div>
|
|
<input type="hidden" name="type" :value="type">
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium text-slate-700">Dashboard label</label>
|
|
<input type="text" name="label" value="{{ old('label', $prefill['label'] ?? '') }}" required maxlength="120"
|
|
placeholder="e.g. Main shop"
|
|
class="mt-1 w-full rounded-xl border-slate-200 text-sm focus:border-indigo-500 focus:ring-indigo-500">
|
|
<p class="mt-1 text-xs text-slate-400">Private name to find this storefront in your dashboard.</p>
|
|
</div>
|
|
|
|
@include('merchant.storefronts.partials.editor-fields', ['content' => $prefillContent ?? [], 'catalog' => $catalog ?? []])
|
|
|
|
<button type="submit" class="btn-primary w-full">Create storefront</button>
|
|
</form>
|
|
</div>
|
|
</x-user-layout>
|