Refactor Filament module UX

This commit is contained in:
fatihalp 2026-03-07 02:30:09 +03:00
parent 08d0b68349
commit 154b226a03
34 changed files with 725 additions and 314 deletions

View File

@ -4,4 +4,4 @@ Act as a Senior Laravel & FilamentPHP Architect. Refactor the attached code as a
3. Refactoring: Move all database logic into Models and extract repetitive Filament code into dedicated Helper classes. Identify and fix any existing logical errors.
4. Database: Consolidate migrations into a single file per table or topic (e.g., users, cache, jobs) to reduce the overall number of migration files.
5. Modularity: Use the `laravel-modules` package to encapsulate all features, routing, and Filament resources strictly inside their respective modules.
6. Frontend: Optimize and reduce the CSS footprint while maintaining the exact same visual output.
6. Frontend: Optimize and reduce the CSS footprint while maintaining the exact same visual output.

7
AGENTS.md Normal file
View File

@ -0,0 +1,7 @@
Act as a Senior Laravel & FilamentPHP Architect. Refactor the attached code as a greenfield project adhering to the following strict constraints:
1. Architecture: Enforce strict SOLID principles, prioritize brevity, and completely ignore backward compatibility.
2. Cleanup: Remove all legacy code, comments, tests, and PHPDocs.
3. Refactoring: Move all database logic into Models and extract repetitive Filament code into dedicated Helper classes. Identify and fix any existing logical errors.
4. Database: Consolidate migrations into a single file per table or topic (e.g., users, cache, jobs) to reduce the overall number of migration files.
5. Modularity: Use the `laravel-modules` package to encapsulate all features, routing, and Filament resources strictly inside their respective modules.
6. Frontend: Optimize and reduce the CSS footprint while maintaining the exact same visual output.

View File

@ -33,16 +33,51 @@ class ManageGeneralSettings extends SettingsPage
protected static ?int $navigationSort = 1;
protected function mutateFormDataBeforeFill(array $data): array
{
$defaults = $this->defaultFormData();
return [
'site_name' => filled($data['site_name'] ?? null) ? $data['site_name'] : $defaults['site_name'],
'site_description' => filled($data['site_description'] ?? null) ? $data['site_description'] : $defaults['site_description'],
'home_slides' => $this->normalizeHomeSlides($data['home_slides'] ?? $defaults['home_slides']),
'site_logo' => $data['site_logo'] ?? null,
'sender_name' => filled($data['sender_name'] ?? null) ? $data['sender_name'] : $defaults['sender_name'],
'sender_email' => filled($data['sender_email'] ?? null) ? $data['sender_email'] : $defaults['sender_email'],
'default_language' => filled($data['default_language'] ?? null) ? $data['default_language'] : $defaults['default_language'],
'default_country_code' => filled($data['default_country_code'] ?? null) ? $data['default_country_code'] : $defaults['default_country_code'],
'currencies' => $this->normalizeCurrencies($data['currencies'] ?? $defaults['currencies']),
'linkedin_url' => filled($data['linkedin_url'] ?? null) ? $data['linkedin_url'] : $defaults['linkedin_url'],
'instagram_url' => filled($data['instagram_url'] ?? null) ? $data['instagram_url'] : $defaults['instagram_url'],
'whatsapp' => filled($data['whatsapp'] ?? null) ? $data['whatsapp'] : $defaults['whatsapp'],
'enable_google_maps' => (bool) ($data['enable_google_maps'] ?? $defaults['enable_google_maps']),
'google_maps_api_key' => $data['google_maps_api_key'] ?? null,
'enable_google_login' => (bool) ($data['enable_google_login'] ?? $defaults['enable_google_login']),
'google_client_id' => $data['google_client_id'] ?? null,
'google_client_secret' => $data['google_client_secret'] ?? null,
'enable_facebook_login' => (bool) ($data['enable_facebook_login'] ?? $defaults['enable_facebook_login']),
'facebook_client_id' => $data['facebook_client_id'] ?? null,
'facebook_client_secret' => $data['facebook_client_secret'] ?? null,
'enable_apple_login' => (bool) ($data['enable_apple_login'] ?? $defaults['enable_apple_login']),
'apple_client_id' => $data['apple_client_id'] ?? null,
'apple_client_secret' => $data['apple_client_secret'] ?? null,
];
}
public function form(Schema $schema): Schema
{
$defaults = $this->defaultFormData();
return $schema
->components([
TextInput::make('site_name')
->label('Site Adı')
->default($defaults['site_name'])
->required()
->maxLength(255),
Textarea::make('site_description')
->label('Site Açıklaması')
->default($defaults['site_description'])
->rows(3)
->maxLength(500),
Repeater::make('home_slides')
@ -70,7 +105,7 @@ class ManageGeneralSettings extends SettingsPage
->required()
->maxLength(120),
])
->default($this->defaultHomeSlides())
->default($defaults['home_slides'])
->minItems(1)
->collapsible()
->reorderableWithButtons()
@ -86,26 +121,30 @@ class ManageGeneralSettings extends SettingsPage
->visibility('public'),
TextInput::make('sender_name')
->label('Gönderici Adı')
->default($defaults['sender_name'])
->required()
->maxLength(120),
TextInput::make('sender_email')
->label('Gönderici E-postası')
->email()
->default($defaults['sender_email'])
->required()
->maxLength(255),
Select::make('default_language')
->label('Varsayılan Dil')
->options($this->localeOptions())
->default($defaults['default_language'])
->required()
->searchable(),
CountryCodeSelect::make('default_country_code')
->label('Varsayılan Ülke')
->default('+90')
->default($defaults['default_country_code'])
->required()
->helperText('Panel formlarında varsayılan ülke olarak kullanılır.'),
TagsInput::make('currencies')
->label('Para Birimleri')
->placeholder('TRY')
->default($defaults['currencies'])
->helperText('TRY, USD, EUR gibi 3 harfli para birimi kodları ekleyin.')
->required()
->rules(['array', 'min:1'])
@ -114,22 +153,25 @@ class ManageGeneralSettings extends SettingsPage
TextInput::make('linkedin_url')
->label('LinkedIn URL')
->url()
->default($defaults['linkedin_url'])
->nullable()
->maxLength(255),
TextInput::make('instagram_url')
->label('Instagram URL')
->url()
->default($defaults['instagram_url'])
->nullable()
->maxLength(255),
PhoneInput::make('whatsapp')
->label('WhatsApp')
->defaultCountry(CountryCodeManager::defaultCountryIso2())
->default($defaults['whatsapp'])
->nullable()
->formatAsYouType()
->helperText('Uluslararası format kullanın. Örnek: +905551112233'),
Toggle::make('enable_google_maps')
->label('Google Maps Aktif')
->default(false),
->default($defaults['enable_google_maps']),
TextInput::make('google_maps_api_key')
->label('Google Maps API Anahtarı')
->password()
@ -139,7 +181,7 @@ class ManageGeneralSettings extends SettingsPage
->helperText('İlan formlarındaki harita alanlarını açmak için gereklidir.'),
Toggle::make('enable_google_login')
->label('Google ile Giriş Aktif')
->default(false),
->default($defaults['enable_google_login']),
TextInput::make('google_client_id')
->label('Google Client ID')
->nullable()
@ -152,7 +194,7 @@ class ManageGeneralSettings extends SettingsPage
->maxLength(255),
Toggle::make('enable_facebook_login')
->label('Facebook ile Giriş Aktif')
->default(false),
->default($defaults['enable_facebook_login']),
TextInput::make('facebook_client_id')
->label('Facebook Client ID')
->nullable()
@ -165,7 +207,7 @@ class ManageGeneralSettings extends SettingsPage
->maxLength(255),
Toggle::make('enable_apple_login')
->label('Apple ile Giriş Aktif')
->default(false),
->default($defaults['enable_apple_login']),
TextInput::make('apple_client_id')
->label('Apple Client ID')
->nullable()
@ -179,6 +221,30 @@ class ManageGeneralSettings extends SettingsPage
]);
}
private function defaultFormData(): array
{
$siteName = (string) config('app.name', 'OpenClassify');
$siteHost = parse_url((string) config('app.url', 'https://oc2.test'), PHP_URL_HOST) ?: 'oc2.test';
return [
'site_name' => $siteName,
'site_description' => 'Alim satim icin hizli ve guvenli ilan platformu.',
'home_slides' => $this->defaultHomeSlides(),
'sender_name' => $siteName,
'sender_email' => (string) config('mail.from.address', 'info@' . $siteHost),
'default_language' => in_array(config('app.locale'), array_keys($this->localeOptions()), true) ? (string) config('app.locale') : 'tr',
'default_country_code' => CountryCodeManager::normalizeCountryCode(config('app.default_country_code', '+90')),
'currencies' => $this->normalizeCurrencies(config('app.currencies', ['TRY'])),
'linkedin_url' => 'https://www.linkedin.com/company/openclassify',
'instagram_url' => 'https://www.instagram.com/openclassify',
'whatsapp' => '+905551112233',
'enable_google_maps' => false,
'enable_google_login' => false,
'enable_facebook_login' => false,
'enable_apple_login' => false,
];
}
private function localeOptions(): array
{
$labels = [

View File

@ -45,7 +45,7 @@ class CategoryResource extends Resource
TextColumn::make('listings_count')->counts('listings')->label('Listings'),
IconColumn::make('is_active')->boolean(),
TextColumn::make('sort_order')->sortable(),
])->actions([
])->defaultSort('id', 'desc')->actions([
EditAction::make(),
Action::make('activities')
->icon('heroicon-o-clock')

View File

@ -46,7 +46,7 @@ class CityResource extends Resource
TextColumn::make('districts_count')->counts('districts')->label('Districts')->sortable(),
IconColumn::make('is_active')->boolean(),
TextColumn::make('created_at')->dateTime()->sortable()->toggleable(isToggledHiddenByDefault: true),
])->filters([
])->defaultSort('id', 'desc')->filters([
SelectFilter::make('country_id')
->label('Country')
->relationship('country', 'name')

View File

@ -48,7 +48,7 @@ class DistrictResource extends Resource
TextColumn::make('city.country.name')->label('Country'),
IconColumn::make('is_active')->boolean(),
TextColumn::make('created_at')->dateTime()->sortable()->toggleable(isToggledHiddenByDefault: true),
])->filters([
])->defaultSort('id', 'desc')->filters([
SelectFilter::make('country_id')
->label('Country')
->options(fn (): array => Country::query()->orderBy('name')->pluck('name', 'id')->all())

View File

@ -105,7 +105,7 @@ class ListingCustomFieldResource extends Resource
IconColumn::make('is_active')->boolean()->label('Active'),
TextColumn::make('sort_order')->sortable(),
])
->defaultSort('sort_order')
->defaultSort('id', 'desc')
->actions([
EditAction::make(),
DeleteAction::make(),

View File

@ -194,6 +194,7 @@ class ListingResource extends Resource
->filtersFormColumns(3)
->filtersFormWidth('7xl')
->persistFiltersInSession()
->defaultSort('id', 'desc')
->actions([
EditAction::make(),
Action::make('activities')

View File

@ -46,7 +46,7 @@ class LocationResource extends Resource
TextColumn::make('cities_count')->counts('cities')->label('Cities')->sortable(),
IconColumn::make('is_active')->boolean(),
TextColumn::make('created_at')->dateTime()->sortable()->toggleable(isToggledHiddenByDefault: true),
])->filters([
])->defaultSort('id', 'desc')->filters([
TernaryFilter::make('is_active')->label('Active'),
])->actions([
EditAction::make(),

View File

@ -43,7 +43,7 @@ class UserResource extends Resource
TextColumn::make('roles.name')->badge()->label('Roles'),
StateFusionSelectColumn::make('status'),
TextColumn::make('created_at')->dateTime()->sortable(),
])->filters([
])->defaultSort('id', 'desc')->filters([
StateFusionSelectFilter::make('status'),
])->actions([
EditAction::make(),

View File

@ -3,7 +3,6 @@ namespace Modules\Category\Http\Controllers;
use App\Http\Controllers\Controller;
use Modules\Category\Models\Category;
use Modules\Listing\Models\Listing;
use Modules\Theme\Support\ThemeManager;
class CategoryController extends Controller
@ -18,22 +17,4 @@ class CategoryController extends Controller
return view($this->themes->view('category', 'index'), compact('categories'));
}
public function show(Category $category)
{
$category->loadMissing([
'children' => fn ($query) => $query->active()->ordered(),
]);
$categoryIds = $category->descendantAndSelfIds()->all();
$listings = Listing::query()
->where('status', 'active')
->whereIn('category_id', $categoryIds)
->with('category:id,name')
->latest('id')
->paginate(12);
return view($this->themes->view('category', 'show'), compact('category', 'listings'));
}
}

View File

@ -6,6 +6,7 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Collection;
use Modules\Listing\Models\Listing;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
@ -78,6 +79,58 @@ class Category extends Model
->get();
}
public static function listingDirectory(?int $selectedCategoryId): array
{
$categories = static::query()
->active()
->ordered()
->get(['id', 'name', 'parent_id']);
$activeListingCounts = Listing::query()
->active()
->whereNotNull('category_id')
->selectRaw('category_id, count(*) as aggregate')
->groupBy('category_id')
->pluck('aggregate', 'category_id')
->map(fn ($count): int => (int) $count);
return [
'categories' => static::buildListingDirectoryTree($categories, $activeListingCounts),
'selectedCategory' => $selectedCategoryId
? $categories->firstWhere('id', $selectedCategoryId)
: null,
'filterIds' => static::listingFilterIds($selectedCategoryId, $categories),
];
}
public static function listingFilterIds(?int $selectedCategoryId, ?Collection $categories = null): ?array
{
if (! $selectedCategoryId) {
return null;
}
if ($categories instanceof Collection) {
$selectedCategory = $categories->firstWhere('id', $selectedCategoryId);
if (! $selectedCategory instanceof self) {
return [];
}
return static::descendantAndSelfIdsFromCollection($selectedCategoryId, $categories);
}
$selectedCategory = static::query()
->active()
->whereKey($selectedCategoryId)
->first(['id']);
if (! $selectedCategory) {
return [];
}
return $selectedCategory->descendantAndSelfIds()->all();
}
public function descendantAndSelfIds(): Collection
{
$ids = collect([(int) $this->getKey()]);
@ -127,4 +180,54 @@ class Category extends Model
{
return $this->hasMany(\Modules\Listing\Models\Listing::class)->where('status', 'active');
}
private static function buildListingDirectoryTree(Collection $categories, Collection $activeListingCounts, ?int $parentId = null): Collection
{
return $categories
->filter(fn (Category $category): bool => $parentId === null
? $category->parent_id === null
: (int) $category->parent_id === $parentId)
->values()
->map(function (Category $category) use ($categories, $activeListingCounts): Category {
$children = static::buildListingDirectoryTree($categories, $activeListingCounts, (int) $category->getKey());
$directActiveListingsCount = (int) $activeListingCounts->get((int) $category->getKey(), 0);
$activeListingTotal = $directActiveListingsCount + $children->sum(
fn (Category $child): int => (int) $child->getAttribute('active_listing_total')
);
$category->setRelation('children', $children);
$category->setAttribute('direct_active_listings_count', $directActiveListingsCount);
$category->setAttribute('active_listing_total', $activeListingTotal);
return $category;
})
->values();
}
private static function descendantAndSelfIdsFromCollection(int $selectedCategoryId, Collection $categories): array
{
$ids = collect([$selectedCategoryId]);
$frontier = collect([$selectedCategoryId]);
while ($frontier->isNotEmpty()) {
$children = $categories
->filter(fn (Category $category): bool => $category->parent_id !== null && in_array((int) $category->parent_id, $frontier->all(), true))
->pluck('id')
->map(fn ($id): int => (int) $id)
->values();
if ($children->isEmpty()) {
break;
}
$ids = $ids
->merge($children)
->unique()
->values();
$frontier = $children;
}
return $ids->all();
}
}

View File

@ -4,7 +4,7 @@
<h1 class="text-3xl font-bold mb-6">{{ __('messages.categories') }}</h1>
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4">
@foreach($categories as $category)
<a href="{{ route('categories.show', $category) }}" class="bg-white rounded-lg shadow-md p-6 text-center hover:shadow-lg transition hover:bg-blue-50">
<a href="{{ route('listings.index', ['category' => $category->id]) }}" class="bg-white rounded-lg shadow-md p-6 text-center hover:shadow-lg transition hover:bg-blue-50">
<div class="text-4xl mb-3">{{ $category->icon ?? '📦' }}</div>
<h3 class="font-semibold text-gray-900">{{ $category->name }}</h3>
<p class="text-gray-500 text-sm mt-1">{{ $category->children->count() }} subcategories</p>

View File

@ -1,33 +0,0 @@
@extends('app::layouts.app')
@section('content')
<div class="container mx-auto px-4 py-8">
<div class="mb-6">
<h1 class="text-3xl font-bold">{{ $category->icon ?? '' }} {{ $category->name }}</h1>
@if($category->description)<p class="text-gray-600 mt-2">{{ $category->description }}</p>@endif
</div>
@if($category->children->count())
<div class="grid grid-cols-2 md:grid-cols-4 gap-4 mb-8">
@foreach($category->children as $child)
<a href="{{ route('categories.show', $child) }}" class="bg-blue-50 rounded-lg p-4 text-center hover:bg-blue-100 transition">
<h3 class="font-medium text-blue-800">{{ $child->name }}</h3>
</a>
@endforeach
</div>
@endif
<h2 class="text-xl font-bold mb-4">Listings in {{ $category->name }}</h2>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
@forelse($listings as $listing)
<div class="bg-white rounded-lg shadow-md overflow-hidden">
<div class="p-4">
<h3 class="font-semibold">{{ $listing->title }}</h3>
<p class="text-green-600 font-bold">{{ $listing->price ? number_format($listing->price, 0).' '.$listing->currency : 'Free' }}</p>
<a href="{{ route('listings.show', $listing) }}" class="mt-2 block text-blue-600 hover:underline">View </a>
</div>
</div>
@empty
<p class="text-gray-500 col-span-3">No listings in this category yet.</p>
@endforelse
</div>
<div class="mt-6">{{ $listings->links() }}</div>
</div>
@endsection

View File

@ -4,7 +4,7 @@
<h1 class="text-3xl font-bold mb-6">{{ __('messages.categories') }}</h1>
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4">
@foreach($categories as $category)
<a href="{{ route('categories.show', $category) }}" class="bg-white rounded-lg shadow-md p-6 text-center hover:shadow-lg transition hover:bg-blue-50">
<a href="{{ route('listings.index', ['category' => $category->id]) }}" class="bg-white rounded-lg shadow-md p-6 text-center hover:shadow-lg transition hover:bg-blue-50">
<div class="text-4xl mb-3">{{ $category->icon ?? '📦' }}</div>
<h3 class="font-semibold text-gray-900">{{ $category->name }}</h3>
<p class="text-gray-500 text-sm mt-1">{{ $category->children->count() }} subcategories</p>

View File

@ -1,33 +0,0 @@
@extends('app::layouts.app')
@section('content')
<div class="container mx-auto px-4 py-8">
<div class="mb-6">
<h1 class="text-3xl font-bold">{{ $category->icon ?? '' }} {{ $category->name }}</h1>
@if($category->description)<p class="text-gray-600 mt-2">{{ $category->description }}</p>@endif
</div>
@if($category->children->count())
<div class="grid grid-cols-2 md:grid-cols-4 gap-4 mb-8">
@foreach($category->children as $child)
<a href="{{ route('categories.show', $child) }}" class="bg-blue-50 rounded-lg p-4 text-center hover:bg-blue-100 transition">
<h3 class="font-medium text-blue-800">{{ $child->name }}</h3>
</a>
@endforeach
</div>
@endif
<h2 class="text-xl font-bold mb-4">Listings in {{ $category->name }}</h2>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
@forelse($listings as $listing)
<div class="bg-white rounded-lg shadow-md overflow-hidden">
<div class="p-4">
<h3 class="font-semibold">{{ $listing->title }}</h3>
<p class="text-green-600 font-bold">{{ $listing->price ? number_format($listing->price, 0).' '.$listing->currency : 'Free' }}</p>
<a href="{{ route('listings.show', $listing) }}" class="mt-2 block text-blue-600 hover:underline">View </a>
</div>
</div>
@empty
<p class="text-gray-500 col-span-3">No listings in this category yet.</p>
@endforelse
</div>
<div class="mt-6">{{ $listings->links() }}</div>
</div>
@endsection

View File

@ -4,7 +4,7 @@
<h1 class="text-3xl font-bold mb-6">{{ __('messages.categories') }}</h1>
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4">
@foreach($categories as $category)
<a href="{{ route('categories.show', $category) }}" class="bg-white rounded-lg shadow-md p-6 text-center hover:shadow-lg transition hover:bg-blue-50">
<a href="{{ route('listings.index', ['category' => $category->id]) }}" class="bg-white rounded-lg shadow-md p-6 text-center hover:shadow-lg transition hover:bg-blue-50">
<div class="text-4xl mb-3">{{ $category->icon ?? '📦' }}</div>
<h3 class="font-semibold text-gray-900">{{ $category->name }}</h3>
<p class="text-gray-500 text-sm mt-1">{{ $category->children->count() }} subcategories</p>

View File

@ -1,33 +0,0 @@
@extends('app::layouts.app')
@section('content')
<div class="container mx-auto px-4 py-8">
<div class="mb-6">
<h1 class="text-3xl font-bold">{{ $category->icon ?? '' }} {{ $category->name }}</h1>
@if($category->description)<p class="text-gray-600 mt-2">{{ $category->description }}</p>@endif
</div>
@if($category->children->count())
<div class="grid grid-cols-2 md:grid-cols-4 gap-4 mb-8">
@foreach($category->children as $child)
<a href="{{ route('categories.show', $child) }}" class="bg-blue-50 rounded-lg p-4 text-center hover:bg-blue-100 transition">
<h3 class="font-medium text-blue-800">{{ $child->name }}</h3>
</a>
@endforeach
</div>
@endif
<h2 class="text-xl font-bold mb-4">Listings in {{ $category->name }}</h2>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
@forelse($listings as $listing)
<div class="bg-white rounded-lg shadow-md overflow-hidden">
<div class="p-4">
<h3 class="font-semibold">{{ $listing->title }}</h3>
<p class="text-green-600 font-bold">{{ $listing->price ? number_format($listing->price, 0).' '.$listing->currency : 'Free' }}</p>
<a href="{{ route('listings.show', $listing) }}" class="mt-2 block text-blue-600 hover:underline">View </a>
</div>
</div>
@empty
<p class="text-gray-500 col-span-3">No listings in this category yet.</p>
@endforelse
</div>
<div class="mt-6">{{ $listings->links() }}</div>
</div>
@endsection

View File

@ -4,5 +4,4 @@ use Modules\Category\Http\Controllers\CategoryController;
Route::prefix('categories')->name('categories.')->group(function () {
Route::get('/', [CategoryController::class, 'index'])->name('index');
Route::get('/{category}', [CategoryController::class, 'show'])->name('show');
});

View File

@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Route;
use Modules\Conversation\App\Http\Controllers\ConversationController;
Route::middleware('auth')->prefix('panel')->name('panel.')->group(function () {
Route::get('/gelen-kutusu', [ConversationController::class, 'inbox'])->name('inbox.index');
Route::get('/inbox', [ConversationController::class, 'inbox'])->name('inbox.index');
});
Route::middleware('auth')->name('conversations.')->group(function () {

View File

@ -65,11 +65,13 @@ class ListingController extends Controller
$selectedCityName
);
$listingDirectory = Category::listingDirectory($categoryId);
$listingsQuery = Listing::query()
->where('status', 'active')
->active()
->with('category:id,name')
->searchTerm($search)
->forCategory($categoryId)
->forCategoryIds($listingDirectory['filterIds'])
->when($selectedCountryName, fn ($query) => $query->where('country', $selectedCountryName))
->when($selectedCityName, fn ($query) => $query->where('city', $selectedCityName))
->when(! is_null($minPrice), fn ($query) => $query->whereNotNull('price')->where('price', '>=', $minPrice))
@ -82,28 +84,8 @@ class ListingController extends Controller
->paginate(16)
->withQueryString();
$categories = Category::query()
->where('is_active', true)
->whereNull('parent_id')
->withCount([
'listings as active_listings_count' => fn ($query) => $query->where('status', 'active'),
])
->with([
'children' => fn ($query) => $query
->where('is_active', true)
->withCount([
'listings as active_listings_count' => fn ($childQuery) => $childQuery->where('status', 'active'),
])
->orderBy('sort_order')
->orderBy('name'),
])
->orderBy('sort_order')
->orderBy('name')
->get(['id', 'name', 'parent_id']);
$selectedCategory = $categoryId
? Category::query()->whereKey($categoryId)->first(['id', 'name'])
: null;
$categories = $listingDirectory['categories'];
$selectedCategory = $listingDirectory['selectedCategory'];
$favoriteListingIds = [];
$isCurrentSearchSaved = false;

View File

@ -2,11 +2,12 @@
namespace Modules\Listing\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Modules\Category\Models\Category;
use Modules\Listing\States\ListingStatus;
use Modules\Listing\Support\ListingPanelHelper;
use Spatie\Activitylog\LogOptions;
@ -72,11 +73,16 @@ class Listing extends Model implements HasMedia
public function scopePublicFeed(Builder $query): Builder
{
return $query
->where('status', 'active')
->active()
->orderByDesc('is_featured')
->orderByDesc('created_at');
}
public function scopeActive(Builder $query): Builder
{
return $query->where('status', 'active');
}
public function scopeSearchTerm(Builder $query, string $search): Builder
{
$search = trim($search);
@ -96,11 +102,20 @@ class Listing extends Model implements HasMedia
public function scopeForCategory(Builder $query, ?int $categoryId): Builder
{
if (! $categoryId) {
return $query->forCategoryIds(Category::listingFilterIds($categoryId));
}
public function scopeForCategoryIds(Builder $query, ?array $categoryIds): Builder
{
if ($categoryIds === null) {
return $query;
}
return $query->where('category_id', $categoryId);
if ($categoryIds === []) {
return $query->whereRaw('1 = 0');
}
return $query->whereIn('category_id', $categoryIds);
}
public function themeGallery(): array

View File

@ -43,8 +43,7 @@
@foreach($categories as $category)
@php
$childCount = (int) $category->children->sum('active_listings_count');
$categoryCount = (int) $category->active_listings_count + $childCount;
$categoryCount = (int) $category->active_listing_total;
$isSelectedParent = (int) $categoryId === (int) $category->id;
$categoryUrl = route('listings.index', array_filter(array_merge($baseCategoryQuery, [
'category' => $category->id,
@ -64,7 +63,7 @@
@endphp
<a href="{{ $childUrl }}" class="ml-2 flex items-center justify-between rounded-lg px-2 py-1.5 text-[13px] font-medium {{ $isSelectedChild ? 'bg-rose-50 text-rose-600' : 'text-slate-600 hover:bg-slate-100' }}">
<span>{{ $childCategory->name }}</span>
<span>{{ number_format((int) $childCategory->active_listings_count, 0, ',', '.') }}</span>
<span>{{ number_format((int) $childCategory->active_listing_total, 0, ',', '.') }}</span>
</a>
@endforeach
@endforeach

View File

@ -43,8 +43,7 @@
@foreach($categories as $category)
@php
$childCount = (int) $category->children->sum('active_listings_count');
$categoryCount = (int) $category->active_listings_count + $childCount;
$categoryCount = (int) $category->active_listing_total;
$isSelectedParent = (int) $categoryId === (int) $category->id;
$categoryUrl = route('listings.index', array_filter(array_merge($baseCategoryQuery, [
'category' => $category->id,
@ -64,7 +63,7 @@
@endphp
<a href="{{ $childUrl }}" class="ml-2 flex items-center justify-between rounded-lg px-2 py-1.5 text-[13px] font-medium {{ $isSelectedChild ? 'bg-rose-50 text-rose-600' : 'text-slate-600 hover:bg-slate-100' }}">
<span>{{ $childCategory->name }}</span>
<span>{{ number_format((int) $childCategory->active_listings_count, 0, ',', '.') }}</span>
<span>{{ number_format((int) $childCategory->active_listing_total, 0, ',', '.') }}</span>
</a>
@endforeach
@endforeach

View File

@ -43,8 +43,7 @@
@foreach($categories as $category)
@php
$childCount = (int) $category->children->sum('active_listings_count');
$categoryCount = (int) $category->active_listings_count + $childCount;
$categoryCount = (int) $category->active_listing_total;
$isSelectedParent = (int) $categoryId === (int) $category->id;
$categoryUrl = route('listings.index', array_filter(array_merge($baseCategoryQuery, [
'category' => $category->id,
@ -64,7 +63,7 @@
@endphp
<a href="{{ $childUrl }}" class="ml-2 flex items-center justify-between rounded-lg px-2 py-1.5 text-[13px] font-medium {{ $isSelectedChild ? 'bg-rose-50 text-rose-600' : 'text-slate-600 hover:bg-slate-100' }}">
<span>{{ $childCategory->name }}</span>
<span>{{ number_format((int) $childCategory->active_listings_count, 0, ',', '.') }}</span>
<span>{{ number_format((int) $childCategory->active_listing_total, 0, ',', '.') }}</span>
</a>
@endforeach
@endforeach

View File

@ -33,7 +33,7 @@
<a href="{{ route('home') }}">Anasayfa</a>
@foreach(($breadcrumbCategories ?? collect()) as $crumb)
<span></span>
<a href="{{ route('categories.show', $crumb) }}">{{ $crumb->name }}</a>
<a href="{{ route('listings.index', ['category' => $crumb->id]) }}">{{ $crumb->name }}</a>
@endforeach
<span></span>
<span>{{ $displayTitle }}</span>

View File

@ -174,7 +174,7 @@ class ListingResource extends Resource
StateFusionSelectColumn::make('status'),
TextColumn::make('city'),
TextColumn::make('created_at')->dateTime()->sortable(),
])->filters([
])->defaultSort('id', 'desc')->filters([
StateFusionSelectFilter::make('status'),
SelectFilter::make('category_id')
->label('Category')

View File

@ -188,13 +188,13 @@ class PanelQuickListingForm extends Component
} catch (Throwable $exception) {
report($exception);
$this->isPublishing = false;
session()->flash('error', 'İlan oluşturulamadı. Lütfen tekrar deneyin.');
session()->flash('error', 'The listing could not be created. Please try again.');
return;
}
$this->isPublishing = false;
session()->flash('success', 'İlan başarıyla oluşturuldu.');
session()->flash('success', 'Your listing has been created successfully.');
$this->redirectRoute('panel.listings.index');
}
@ -243,23 +243,23 @@ class PanelQuickListingForm extends Component
public function getCurrentParentNameProperty(): string
{
if (! $this->activeParentCategoryId) {
return 'Kategori Seçimi';
return 'Category Selection';
}
$category = collect($this->categories)->firstWhere('id', $this->activeParentCategoryId);
return (string) ($category['name'] ?? 'Kategori Seçimi');
return (string) ($category['name'] ?? 'Category Selection');
}
public function getCurrentStepTitleProperty(): string
{
return match ($this->currentStep) {
1 => 'Fotoğraf',
2 => 'Kategori Seçimi',
3 => 'İlan Bilgileri',
4 => 'İlan Özellikleri',
5 => 'İlan Önizlemesi',
default => 'İlan Ver',
1 => 'Photos',
2 => 'Category Selection',
3 => 'Listing Details',
4 => 'Attributes',
5 => 'Preview',
default => 'Create Listing',
};
}
@ -352,7 +352,7 @@ class PanelQuickListingForm extends Component
public function getCurrentUserNameProperty(): string
{
return (string) (auth()->user()?->name ?: 'Kullanıcı');
return (string) (auth()->user()?->name ?: 'User');
}
public function getCurrentUserInitialProperty(): string
@ -402,8 +402,8 @@ class PanelQuickListingForm extends Component
Rule::in(collect($this->categories)->pluck('id')->all()),
],
], [
'selectedCategoryId.required' => 'Lütfen bir kategori seçin.',
'selectedCategoryId.in' => 'Geçerli bir kategori seçin.',
'selectedCategoryId.required' => 'Please choose a category.',
'selectedCategoryId.in' => 'Please choose a valid category.',
]);
}
@ -426,18 +426,18 @@ class PanelQuickListingForm extends Component
->contains(fn (array $city): bool => $city['id'] === (int) $value);
if (! $cityExists) {
$fail('Seçtiğiniz şehir, seçilen ülkeye ait değil.');
$fail('The selected city does not belong to the chosen country.');
}
},
],
], [
'listingTitle.required' => 'İlan başlığı zorunludur.',
'listingTitle.max' => 'İlan başlığı en fazla 70 karakter olabilir.',
'price.required' => 'Fiyat zorunludur.',
'price.numeric' => 'Fiyat sayısal olmalıdır.',
'description.required' => 'Açıklama zorunludur.',
'description.max' => 'ıklama en fazla 1450 karakter olabilir.',
'selectedCountryId.required' => 'Ülke seçimi zorunludur.',
'listingTitle.required' => 'A title is required.',
'listingTitle.max' => 'The title may not exceed 70 characters.',
'price.required' => 'A price is required.',
'price.numeric' => 'The price must be numeric.',
'description.required' => 'A description is required.',
'description.max' => 'The description may not exceed 1450 characters.',
'selectedCountryId.required' => 'Please choose a country.',
]);
}

View File

@ -188,7 +188,7 @@
$trendSkin = $trendSkins[$index % count($trendSkins)];
$trendIcon = $trendIcons[$index % count($trendIcons)];
@endphp
<a href="{{ route('categories.show', $category) }}" class="group shrink-0 w-[170px] rounded-xl overflow-hidden border border-slate-300/80 bg-white hover:shadow-md transition snap-start">
<a href="{{ route('listings.index', ['category' => $category->id]) }}" class="group shrink-0 w-[170px] rounded-xl overflow-hidden border border-slate-300/80 bg-white hover:shadow-md transition snap-start">
<div class="h-[68px] bg-gradient-to-r {{ $trendSkin['gradient'] }} relative overflow-hidden">
<span class="absolute -left-5 top-2 w-20 h-20 rounded-full {{ $trendSkin['glow'] }} blur-2xl"></span>
<span class="absolute left-5 bottom-2 h-2.5 w-24 rounded-full bg-black/20"></span>

View File

@ -79,21 +79,21 @@
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8" d="M12 21s7-6.2 7-11a7 7 0 10-14 0c0 4.8 7 11 7 11z"/>
<circle cx="12" cy="10" r="2.3" stroke-width="1.8" />
</svg>
<span data-location-label class="max-w-44 truncate">Konum seç</span>
<span data-location-label class="max-w-44 truncate">Choose location</span>
<svg class="w-4 h-4 text-slate-500 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8" d="M6 9l6 6 6-6"/>
</svg>
</summary>
<div class="location-panel absolute right-0 mt-2 bg-white border border-slate-200 shadow-xl rounded-2xl p-4 space-y-3">
<div class="flex items-center justify-between gap-3">
<p class="text-sm font-semibold text-slate-900">Konum Tercihi</p>
<button type="button" data-location-detect class="text-xs font-semibold text-rose-500 hover:text-rose-600 transition">Konumumu Bul</button>
<p class="text-sm font-semibold text-slate-900">Location</p>
<button type="button" data-location-detect class="text-xs font-semibold text-rose-500 hover:text-rose-600 transition">Use my location</button>
</div>
<p data-location-status class="text-xs text-slate-500">Tarayıcı konumuna göre ülke ve şehir otomatik seçilebilir.</p>
<p data-location-status class="text-xs text-slate-500">Auto-select country and city from your browser location.</p>
<div class="space-y-2">
<label class="block text-xs font-semibold text-slate-600">Ülke</label>
<label class="block text-xs font-semibold text-slate-600">Country</label>
<select data-location-country class="w-full">
<option value="">Ülke seç</option>
<option value="">Select country</option>
@foreach($locationCountries as $country)
<option
value="{{ $country['id'] }}"
@ -107,35 +107,35 @@
</select>
</div>
<div class="space-y-2">
<label class="block text-xs font-semibold text-slate-600">Şehir</label>
<label class="block text-xs font-semibold text-slate-600">City</label>
<select data-location-city class="w-full" disabled>
<option value="">Önce ülke seç</option>
<option value="">Select country first</option>
</select>
</div>
<button type="button" data-location-save class="w-full btn-primary px-4 py-2.5 text-sm font-semibold hover:brightness-95 transition">Uygula</button>
<button type="button" data-location-save class="w-full btn-primary px-4 py-2.5 text-sm font-semibold hover:brightness-95 transition">Apply</button>
</div>
</details>
<div class="ml-auto flex items-center gap-2 md:gap-3">
@auth
<a href="{{ $favoritesRoute }}" class="header-utility hidden xl:inline-flex" aria-label="Favoriler">
<a href="{{ $favoritesRoute }}" class="header-utility hidden xl:inline-flex" aria-label="Favorites">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8" d="M12 21l-1.45-1.32C5.4 15.03 2 12.01 2 8.31 2 5.3 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.08A6.04 6.04 0 0116.5 3C19.58 3 22 5.3 22 8.31c0 3.7-3.4 6.72-8.55 11.39L12 21z"/>
</svg>
</a>
<a href="{{ $inboxRoute }}" class="header-utility hidden xl:inline-flex" aria-label="Gelen Kutusu">
<a href="{{ $inboxRoute }}" class="header-utility hidden xl:inline-flex" aria-label="Inbox">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8" d="M4 6h16a1 1 0 011 1v10a1 1 0 01-1 1H4a1 1 0 01-1-1V7a1 1 0 011-1z"/>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8" d="M3 8l9 6 9-6"/>
</svg>
</a>
<a href="{{ $panelListingsRoute }}" class="header-utility hidden xl:inline-flex" aria-label="Panel">
<a href="{{ $panelListingsRoute }}" class="header-utility hidden xl:inline-flex" aria-label="Dashboard">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8" d="M3 12l9-9 9 9M5 10v10h14V10"/>
</svg>
</a>
<a href="{{ $panelCreateRoute }}" class="btn-primary px-4 md:px-5 py-2.5 text-sm font-semibold shadow-sm hover:brightness-95 transition">
İlan Ver
Sell
</a>
<form method="POST" action="{{ $logoutRoute }}" class="hidden xl:block">
@csrf
@ -146,7 +146,7 @@
{{ __('messages.login') }}
</a>
<a href="{{ $panelCreateRoute }}" class="btn-primary px-4 md:px-5 py-2.5 text-sm font-semibold shadow-sm hover:brightness-95 transition">
İlan Ver
Sell
</a>
@endauth
</div>
@ -167,8 +167,8 @@
<button type="submit" class="text-xs text-slate-500">{{ __('messages.search') }}</button>
</form>
<div class="flex items-center gap-2 overflow-x-auto pb-1">
<span class="chip-btn whitespace-nowrap px-4 py-2 text-sm text-slate-700" data-location-label-mobile>Konum seç</span>
<a href="{{ $panelCreateRoute }}" class="chip-btn whitespace-nowrap px-4 py-2 text-sm text-rose-600 font-semibold">İlan Ver</a>
<span class="chip-btn whitespace-nowrap px-4 py-2 text-sm text-slate-700" data-location-label-mobile>Choose location</span>
<a href="{{ $panelCreateRoute }}" class="chip-btn whitespace-nowrap px-4 py-2 text-sm text-rose-600 font-semibold">Sell</a>
</div>
</div>
@ -178,10 +178,10 @@
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8" d="M4 6h16M4 12h16M4 18h16"/>
</svg>
Tüm Kategoriler
All Categories
</a>
@forelse($headerCategories as $headerCategory)
<a href="{{ route('categories.show', ['category' => $headerCategory['id']]) }}" class="px-4 py-2.5 rounded-full text-sm font-medium text-slate-700 hover:bg-slate-100 transition whitespace-nowrap">
<a href="{{ route('listings.index', ['category' => $headerCategory['id']]) }}" class="px-4 py-2.5 rounded-full text-sm font-medium text-slate-700 hover:bg-slate-100 transition whitespace-nowrap">
{{ $headerCategory['name'] }}
</a>
@empty
@ -211,22 +211,22 @@
<p class="text-sm text-slate-500 leading-relaxed">{{ $siteDescription }}</p>
</div>
<div>
<h4 class="text-slate-900 font-medium mb-4">Hızlı Linkler</h4>
<h4 class="text-slate-900 font-medium mb-4">Quick Links</h4>
<ul class="space-y-2 text-sm">
<li><a href="{{ route('home') }}" class="hover:text-slate-900 transition">Ana Sayfa</a></li>
<li><a href="{{ route('categories.index') }}" class="hover:text-slate-900 transition">Kategoriler</a></li>
<li><a href="{{ route('listings.index') }}" class="hover:text-slate-900 transition">Tüm İlanlar</a></li>
<li><a href="{{ route('home') }}" class="hover:text-slate-900 transition">Home</a></li>
<li><a href="{{ route('categories.index') }}" class="hover:text-slate-900 transition">Categories</a></li>
<li><a href="{{ route('listings.index') }}" class="hover:text-slate-900 transition">All Listings</a></li>
</ul>
</div>
<div>
<h4 class="text-slate-900 font-medium mb-4">Hesap</h4>
<h4 class="text-slate-900 font-medium mb-4">Account</h4>
<ul class="space-y-2 text-sm">
<li><a href="{{ $loginRoute }}" class="hover:text-slate-900 transition">{{ __('messages.login') }}</a></li>
<li><a href="{{ $registerRoute }}" class="hover:text-slate-900 transition">{{ __('messages.register') }}</a></li>
</ul>
</div>
<div>
<h4 class="text-slate-900 font-medium mb-4">Bağlantılar</h4>
<h4 class="text-slate-900 font-medium mb-4">Links</h4>
<ul class="space-y-2 text-sm mb-4">
@if($linkedinUrl)
<li><a href="{{ $linkedinUrl }}" target="_blank" rel="noopener" class="hover:text-slate-900 transition">LinkedIn</a></li>
@ -238,10 +238,10 @@
<li><a href="{{ $whatsappUrl }}" target="_blank" rel="noopener" class="hover:text-slate-900 transition">WhatsApp</a></li>
@endif
@if(!$linkedinUrl && !$instagramUrl && !$whatsappUrl)
<li>Henüz sosyal bağlantı eklenmedi.</li>
<li>No social links added yet.</li>
@endif
</ul>
<h4 class="text-slate-900 font-medium mb-3">Diller</h4>
<h4 class="text-slate-900 font-medium mb-3">Languages</h4>
<div class="flex flex-wrap gap-2">
@foreach($availableLocales as $locale)
<a href="{{ route('lang.switch', $locale) }}" class="text-xs {{ app()->getLocale() === $locale ? 'text-slate-900' : 'hover:text-slate-900' }} transition">{{ strtoupper($locale) }}</a>

View File

@ -1,6 +1,6 @@
@extends('app::layouts.app')
@section('title', 'İlan Ver')
@section('title', 'Create Listing')
@section('simple_page', '1')

View File

@ -5,24 +5,24 @@
<aside class="bg-white border border-slate-200 rounded-xl overflow-hidden">
<a href="{{ route('panel.listings.create') }}" class="block px-5 py-4 text-base {{ $activeMenu === 'create' ? 'bg-rose-50 text-rose-600 font-semibold' : 'text-slate-700 hover:bg-slate-50' }}">
İlan Ver
Sell
</a>
<a href="{{ route('panel.listings.index') }}" class="block px-5 py-4 border-t border-slate-200 text-base {{ $activeMenu === 'listings' ? 'bg-rose-50 text-rose-600 font-semibold' : 'text-slate-700 hover:bg-slate-50' }}">
İlanlarım
My Listings
</a>
<a href="{{ route('favorites.index', ['tab' => 'listings']) }}" class="block px-5 py-4 border-t border-slate-200 text-base {{ $activeMenu === 'favorites' ? 'bg-rose-50 text-rose-600 font-semibold' : 'text-slate-700 hover:bg-slate-50' }}">
Favorilerim
Favorites
</a>
<a href="{{ route('favorites.index', ['tab' => 'listings']) }}" class="block px-9 py-3 border-t border-slate-100 text-sm {{ $activeFavoritesTab === 'listings' ? 'bg-rose-50 text-rose-600 font-semibold' : 'text-slate-600 hover:bg-slate-50' }}">
Favori İlanlar
Saved Listings
</a>
<a href="{{ route('favorites.index', ['tab' => 'searches']) }}" class="block px-9 py-3 border-t border-slate-100 text-sm {{ $activeFavoritesTab === 'searches' ? 'bg-rose-50 text-rose-600 font-semibold' : 'text-slate-600 hover:bg-slate-50' }}">
Favori Aramalar
Saved Searches
</a>
<a href="{{ route('favorites.index', ['tab' => 'sellers']) }}" class="block px-9 py-3 border-t border-slate-100 text-sm {{ $activeFavoritesTab === 'sellers' ? 'bg-rose-50 text-rose-600 font-semibold' : 'text-slate-600 hover:bg-slate-50' }}">
Favori Satıcılar
Saved Sellers
</a>
<a href="{{ route('panel.inbox.index') }}" class="block px-5 py-4 border-t border-slate-200 text-base {{ $activeMenu === 'inbox' ? 'bg-rose-50 text-rose-600 font-semibold' : 'text-slate-700 hover:bg-slate-50' }}">
Gelen Kutusu
Inbox
</a>
</aside>

View File

@ -1,4 +1,4 @@
<div class="max-w-[1320px] mx-auto px-4 py-8">
<div class="max-w-[1320px] mx-auto px-4 py-5 sm:py-8">
<style>
.qc-shell {
--qc-card: #ffffff;
@ -853,32 +853,404 @@
grid-template-columns: repeat(3, minmax(0, 1fr));
}
}
.qc-shell {
--qc-card: #ffffff;
--qc-border: #dbe3ee;
--qc-text: #0f172a;
--qc-muted: #64748b;
--qc-primary: #111827;
--qc-primary-soft: #f3f4f6;
--qc-warn: #f8fafc;
color: var(--qc-text);
font-family: "SF Pro Text", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
}
.qc-hero {
display: grid;
gap: 1rem;
margin-bottom: 1rem;
}
.qc-hero-copy {
min-width: 0;
}
.qc-eyebrow {
display: inline-flex;
width: fit-content;
align-items: center;
border-radius: 999px;
background: #f1f5f9;
color: #475569;
font-size: .72rem;
font-weight: 700;
letter-spacing: .08em;
text-transform: uppercase;
padding: .42rem .7rem;
}
.qc-title {
margin-top: .5rem;
font-size: 1.9rem;
line-height: 1.05;
letter-spacing: -0.04em;
font-weight: 700;
text-align: left;
}
.qc-subtitle {
margin-top: .45rem;
color: var(--qc-muted);
font-size: .95rem;
line-height: 1.55;
max-width: 56rem;
text-align: left;
}
.qc-head {
display: grid;
gap: .55rem;
margin: 0;
padding: 0;
min-width: 0;
background: transparent;
border: 0;
box-shadow: none;
}
.qc-progress-wrap {
width: 100%;
justify-content: space-between;
gap: .9rem;
}
.qc-progress {
width: 100%;
gap: .45rem;
}
.qc-progress > span {
height: .3rem;
background: #e2e8f0;
}
.qc-progress > span.is-on {
background: var(--qc-primary);
}
.qc-step-label {
font-size: .92rem;
color: #334155;
font-weight: 700;
}
.qc-stage {
padding: 0;
border: 0;
background: transparent;
box-shadow: none;
}
.qc-card {
border: 1px solid var(--qc-border);
border-radius: 1rem;
background: var(--qc-card);
box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}
.qc-body {
min-height: 0;
padding: 1rem;
}
.qc-body > * {
max-width: 100%;
}
.qc-footer {
padding: 1rem;
justify-content: stretch;
flex-direction: column-reverse;
align-items: stretch;
background: #fff;
}
.qc-btn,
.qc-publish,
.qc-muted-btn,
.qc-upload-btn {
width: 100%;
min-width: 0;
min-height: 3rem;
padding: .82rem 1rem;
font-size: .95rem;
}
.qc-btn-primary,
.qc-publish,
.qc-upload-btn {
background: #111827;
color: #fff;
box-shadow: none;
}
.qc-btn-primary:hover,
.qc-publish:hover,
.qc-upload-btn:hover {
transform: none;
box-shadow: none;
}
.qc-btn-secondary,
.qc-muted-btn {
background: #f8fafc;
color: #0f172a;
border: 1px solid var(--qc-border);
}
.qc-upload-zone,
.qc-warning,
.qc-summary,
.qc-info-box,
.qc-preview-panel,
.qc-seller-card,
.qc-strip {
border-radius: 1rem;
}
.qc-upload-zone {
min-height: 220px;
padding: 1.25rem 1rem;
background: #f8fafc;
}
.qc-upload-zone > * {
max-width: 760px;
margin-left: auto;
margin-right: auto;
}
.qc-upload-title,
.qc-ai-note h3 {
font-size: 1.35rem;
letter-spacing: -0.03em;
}
.qc-photo-grid {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.qc-root-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
padding: 1rem;
}
.qc-root-item {
border: 1px solid var(--qc-border);
border-radius: .9rem;
padding: .85rem .6rem;
background: #fff;
}
.qc-root-item.is-selected {
background: #f8fafc;
border-color: #94a3b8;
}
.qc-root-icon {
background: #f8fafc;
color: #111827;
}
.qc-search input,
.qc-input,
.qc-select,
.qc-textarea {
background: #fff;
border-color: var(--qc-border);
border-radius: .85rem;
padding: .85rem .95rem;
}
.qc-summary {
border-top: 0;
margin-top: 1rem;
padding-top: 0;
border: 1px solid var(--qc-border);
background: #f8fafc;
padding: 1rem;
flex-direction: column;
gap: .6rem;
}
.qc-strip {
grid-template-columns: repeat(3, minmax(0, 1fr));
background: #f8fafc;
}
.qc-dynamic-grid,
.qc-two-col,
.qc-preview-grid,
.qc-seller-actions {
grid-template-columns: 1fr;
}
.qc-preview-grid {
display: grid;
gap: 1rem;
}
.qc-preview-panel,
.qc-seller-card {
background: #fff;
}
.qc-warning {
background: #f8fafc;
border-bottom: 1px solid var(--qc-border);
}
.qc-chip,
.qc-pill {
border-color: var(--qc-border);
background: #fff;
color: #111827;
}
.qc-avatar {
background: #f3f4f6;
color: #111827;
}
.qc-gallery {
grid-template-columns: 1fr;
}
.qc-gallery-item {
min-height: 220px;
}
.qc-feature-row {
grid-template-columns: 1fr;
gap: .2rem;
}
.qc-publish-wrap {
display: grid;
gap: .6rem;
margin-top: .9rem;
}
@media (min-width: 640px) {
.qc-title {
font-size: 2.35rem;
}
.qc-body,
.qc-footer {
padding: 1.25rem;
}
.qc-photo-grid,
.qc-strip {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.qc-gallery {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (min-width: 768px) {
.qc-hero {
grid-template-columns: minmax(0, 1fr) 220px;
align-items: center;
gap: 1.5rem;
}
.qc-head {
justify-items: end;
align-self: center;
}
.qc-footer {
flex-direction: row;
justify-content: flex-end;
}
.qc-btn,
.qc-publish,
.qc-muted-btn {
width: auto;
min-width: 160px;
}
.qc-root-grid {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.qc-dynamic-grid,
.qc-two-col {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.qc-preview-grid {
grid-template-columns: minmax(0, 1fr) 280px;
}
.qc-gallery {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.qc-gallery-item {
min-height: 160px;
}
.qc-seller-actions {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (min-width: 1024px) {
.qc-body {
padding: 1.4rem;
}
.qc-preview-grid {
grid-template-columns: minmax(0, 1fr) 320px;
}
}
</style>
<div class="qc-shell">
<div class="qc-head">
<h1 class="qc-title">{{ $this->currentStepTitle }}</h1>
<div class="qc-progress-wrap">
<div class="qc-progress" aria-hidden="true">
@for ($step = 1; $step <= 5; $step++)
<span @class(['is-on' => $step <= $currentStep])></span>
@endfor
<div class="qc-hero">
<div class="qc-hero-copy">
<span class="qc-eyebrow">Create listing</span>
<h1 class="qc-title">{{ $this->currentStepTitle }}</h1>
<p class="qc-subtitle">A clean, simple flow to publish faster.</p>
</div>
<div class="qc-head">
<div class="qc-step-label">Step {{ $currentStep }} of 5</div>
<div class="qc-progress-wrap">
<div class="qc-progress" aria-hidden="true">
@for ($step = 1; $step <= 5; $step++)
<span @class(['is-on' => $step <= $currentStep])></span>
@endfor
</div>
</div>
<div class="qc-step-label">{{ $currentStep }}/5</div>
</div>
</div>
<div class="qc-stage">
<div class="qc-card">
@if ($currentStep === 1)
<div class="qc-body">
<label class="qc-upload-zone" for="quick-listing-photo-input">
<x-heroicon-o-photo class="h-10 w-10 text-gray-700" />
<div class="qc-upload-title">Ürün fotoğraflarını yükle</div>
<div class="qc-upload-desc">
Yüklemeye başlamak için ürün fotoğraflarını
<strong>bu alana sürükleyip bırakın</strong> veya
</div>
<span class="qc-upload-btn">Fotoğraf Seç</span>
<div class="qc-upload-title">Start with photos</div>
<div class="qc-upload-desc">Add clear images first.</div>
<span class="qc-upload-btn">Choose Photos</span>
</label>
<input
@ -890,10 +1262,7 @@
class="hidden"
/>
<p class="qc-help">
<strong>İpucu:</strong> En az 1 fotoğraf, en çok {{ (int) config('quick-listing.max_photo_count', 20) }} fotoğraf yükleyebilirsin.<br>
Desteklenen formatlar: <strong>.jpg, .jpeg ve .png</strong>
</p>
<p class="qc-help">1 to {{ (int) config('quick-listing.max_photo_count', 20) }} images. JPG and PNG only.</p>
@error('photos')
<div class="qc-error">{{ $message }}</div>
@ -904,17 +1273,17 @@
@enderror
@if (count($photos) > 0)
<h3 class="qc-photo-title">Seçtiğin Fotoğraflar</h3>
<div class="qc-photo-sub">Fotoğrafları sıralamak için tut ve sürükle</div>
<h3 class="qc-photo-title">Selected photos</h3>
<div class="qc-photo-sub">Drag to reorder</div>
<div class="qc-photo-grid">
@for ($index = 0; $index < (int) config('quick-listing.max_photo_count', 20); $index++)
<div class="qc-photo-slot">
@if (isset($photos[$index]))
<img src="{{ $photos[$index]->temporaryUrl() }}" alt="Yüklenen fotoğraf {{ $index + 1 }}">
<img src="{{ $photos[$index]->temporaryUrl() }}" alt="Uploaded photo {{ $index + 1 }}">
<button type="button" class="qc-remove" wire:click="removePhoto({{ $index }})">×</button>
@if ($index === 0)
<div class="qc-cover">KAPAK</div>
<div class="qc-cover">COVER</div>
@endif
@else
<x-heroicon-o-photo class="h-9 w-9 text-gray-400" />
@ -925,11 +1294,8 @@
@else
<div class="qc-ai-note">
<x-heroicon-o-sparkles class="h-10 w-10 text-pink-500" />
<h3>Ürün fotoğraflarını yükle</h3>
<p>
Hızlı ilan vermek için en az 1 fotoğraf yükleyin.<br>
<strong>Laravel AI</strong> sizin için otomatik kategori önerileri sunar.
</p>
<h3>Add at least one photo</h3>
<p>We can suggest a category after the first image.</p>
</div>
@endif
</div>
@ -941,7 +1307,7 @@
wire:click="goToCategoryStep"
@disabled(count($photos) === 0 || $isDetecting)
>
Devam Et
Continue
</button>
</div>
@endif
@ -950,26 +1316,18 @@
@if ($isDetecting)
<div class="qc-warning">
<x-heroicon-o-arrow-path class="h-5 w-5 animate-spin text-gray-700" />
<span>Fotoğraf analiz ediliyor, kategori önerisi hazırlanıyor...</span>
<span>Finding the best category...</span>
</div>
@elseif ($detectedCategoryId)
<div class="qc-warning">
<x-heroicon-o-sparkles class="h-5 w-5 text-pink-500" />
<span>
AI kategori önerdi: <strong>{{ $this->selectedCategoryName }}</strong>
@if ($detectedConfidence)
(Güven: {{ number_format($detectedConfidence * 100, 0) }}%)
@endif
@if ($detectedReason)
<span class="qc-warning-sub">{{ $detectedReason }}</span>
@endif
</span>
<span>Suggested category: <strong>{{ $this->selectedCategoryName }}</strong></span>
</div>
@else
<div class="qc-warning">
<x-heroicon-o-sparkles class="h-5 w-5 text-pink-500" />
<span>
AI ile kategori tespit edilemedi, lütfen kategori seçimi yapın.
Choose a category.
@if ($detectedError)
<span class="qc-warning-sub">{{ $detectedError }}</span>
@endif
@ -995,9 +1353,9 @@
@if (is_null($activeParentCategoryId))
<div class="qc-browser-header">
<span></span>
<strong>Ne Satıyorsun?</strong>
<strong>Choose a category</strong>
<button type="button" class="qc-chip" wire:click="detectCategoryFromImage" @disabled($isDetecting || count($photos) === 0)>
AI ile Tekrar Dene
Refresh suggestion
</button>
</div>
@ -1019,14 +1377,14 @@
<div class="qc-browser-header">
<button type="button" class="qc-back-btn" wire:click="backToRootCategories">
<x-heroicon-o-arrow-left class="h-5 w-5" />
Geri
Back
</button>
<strong>{{ $this->currentParentName }}</strong>
<span></span>
</div>
<div class="qc-search">
<input type="text" placeholder="Kategori Ara" wire:model.live.debounce.300ms="categorySearch">
<input type="text" placeholder="Search categories" wire:model.live.debounce.300ms="categorySearch">
</div>
<div class="qc-list">
@ -1056,7 +1414,7 @@
</div>
@empty
<div class="qc-row">
<span class="qc-row-main">Aramaya uygun kategori bulunamadı.</span>
<span class="qc-row-main">No categories found.</span>
</div>
@endforelse
</div>
@ -1067,18 +1425,18 @@
@endif
@if ($this->selectedCategoryName)
<div class="qc-selection">Seçilen kategori: <strong>{{ $this->selectedCategoryName }}</strong></div>
<div class="qc-selection">Selected: <strong>{{ $this->selectedCategoryName }}</strong></div>
@endif
<div class="qc-footer">
<button type="button" class="qc-btn qc-btn-secondary" wire:click="goToStep(1)">Geri</button>
<button type="button" class="qc-btn qc-btn-secondary" wire:click="goToStep(1)">Back</button>
<button
type="button"
class="qc-btn qc-btn-primary"
wire:click="goToDetailsStep"
@disabled(! $selectedCategoryId)
>
Devam Et
Continue
</button>
</div>
@endif
@ -1088,10 +1446,10 @@
<div class="qc-strip">
@foreach (array_slice($photos, 0, 7) as $index => $photo)
<div class="qc-photo-slot">
<img src="{{ $photo->temporaryUrl() }}" alt="Seçilen fotoğraf {{ $index + 1 }}">
<img src="{{ $photo->temporaryUrl() }}" alt="Selected photo {{ $index + 1 }}">
<button type="button" class="qc-remove" wire:click="removePhoto({{ $index }})">×</button>
@if ($index === 0)
<div class="qc-cover">KAPAK</div>
<div class="qc-cover">COVER</div>
@endif
</div>
@endforeach
@ -1099,45 +1457,45 @@
<div class="qc-summary">
<div>
<h4>Seçilen Kategori</h4>
<h4>Category</h4>
<p>{{ $this->selectedCategoryPath ?: '-' }}</p>
</div>
<button type="button" class="qc-link-btn" wire:click="goToStep(2)">Değiştir</button>
<button type="button" class="qc-link-btn" wire:click="goToStep(2)">Change</button>
</div>
<div class="qc-form-grid">
<div class="qc-field">
<label for="quick-title">İlan Başlığı *</label>
<input id="quick-title" type="text" class="qc-input" placeholder="Başlık girin" wire:model.live.debounce.300ms="listingTitle" maxlength="70">
<p class="qc-hint">Ürünün temel özelliklerinden bahset (ör. marka, model, yaş, tip)</p>
<label for="quick-title">Listing Title *</label>
<input id="quick-title" type="text" class="qc-input" placeholder="Enter a title" wire:model.live.debounce.300ms="listingTitle" maxlength="70">
<p class="qc-hint">Keep it short and clear.</p>
<div class="qc-counter">{{ $this->titleCharacters }}/70</div>
@error('listingTitle')<div class="qc-error">{{ $message }}</div>@enderror
</div>
<div class="qc-field">
<label for="quick-price">Fiyat *</label>
<label for="quick-price">Price *</label>
<div class="qc-input-row">
<input id="quick-price" type="number" step="0.01" class="qc-input" placeholder="Fiyat giriniz" wire:model.live.debounce.300ms="price">
<input id="quick-price" type="number" step="0.01" class="qc-input" placeholder="Enter a price" wire:model.live.debounce.300ms="price">
<span class="qc-input-suffix">{{ \Modules\Listing\Support\ListingPanelHelper::defaultCurrency() }}</span>
</div>
<p class="qc-hint">Lütfen unutma; doğru fiyat daha hızlı satmanıza yardımcı olacaktır</p>
<p class="qc-hint">Use the final asking price.</p>
@error('price')<div class="qc-error">{{ $message }}</div>@enderror
</div>
<div class="qc-field">
<label for="quick-description">ıklama *</label>
<textarea id="quick-description" class="qc-textarea" placeholder="ıklama girin" wire:model.live.debounce.300ms="description" maxlength="1450"></textarea>
<p class="qc-hint">Durum, özellik ve satma nedeni gibi bilgileri ekle</p>
<label for="quick-description">Description *</label>
<textarea id="quick-description" class="qc-textarea" placeholder="Write a description" wire:model.live.debounce.300ms="description" maxlength="1450"></textarea>
<p class="qc-hint">Condition, key details, and anything important.</p>
<div class="qc-counter">{{ $this->descriptionCharacters }}/1450</div>
@error('description')<div class="qc-error">{{ $message }}</div>@enderror
</div>
<div class="qc-field">
<label>Konum *</label>
<label>Location *</label>
<div class="qc-two-col">
<div>
<select class="qc-select" wire:model.live="selectedCountryId">
<option value="">Ülke seçin</option>
<option value="">Select a country</option>
@foreach ($countries as $country)
<option value="{{ $country['id'] }}">{{ $country['name'] }}</option>
@endforeach
@ -1146,7 +1504,7 @@
</div>
<div>
<select class="qc-select" wire:model.live="selectedCityId" @disabled(! $selectedCountryId)>
<option value="">Şehir seçin</option>
<option value="">Select a city</option>
@foreach ($this->availableCities as $city)
<option value="{{ $city['id'] }}">{{ $city['name'] }}</option>
@endforeach
@ -1159,8 +1517,8 @@
</div>
<div class="qc-footer">
<button type="button" class="qc-btn qc-btn-secondary" wire:click="goToStep(2)">Geri</button>
<button type="button" class="qc-btn qc-btn-primary" wire:click="goToFeaturesStep">Devam Et</button>
<button type="button" class="qc-btn qc-btn-secondary" wire:click="goToStep(2)">Back</button>
<button type="button" class="qc-btn qc-btn-primary" wire:click="goToFeaturesStep">Continue</button>
</div>
@endif
@ -1168,15 +1526,15 @@
<div class="qc-body">
<div class="qc-summary" style="margin-top: 0; border-top: 0; padding-top: 0;">
<div>
<h4>Seçilen Kategori</h4>
<h4>Category</h4>
<p>{{ $this->selectedCategoryPath ?: '-' }}</p>
</div>
<button type="button" class="qc-link-btn" wire:click="goToStep(2)">Değiştir</button>
<button type="button" class="qc-link-btn" wire:click="goToStep(2)">Change</button>
</div>
@if ($listingCustomFields === [])
<div class="qc-info-box">
Bu kategori için ek ilan özelliği tanımlı değil. Devam ederek önizleme adımına geçebilirsin.
No extra details needed for this category.
</div>
@else
<div class="qc-dynamic-grid">
@ -1212,7 +1570,7 @@
>
@elseif ($field['type'] === 'select')
<select class="qc-select" wire:model.live="customFieldValues.{{ $field['name'] }}">
<option value="">Seçiniz</option>
<option value="">Select an option</option>
@foreach ($field['options'] as $option)
<option value="{{ $option }}">{{ $option }}</option>
@endforeach
@ -1220,7 +1578,7 @@
@elseif ($field['type'] === 'boolean')
<label class="qc-toggle-line">
<input type="checkbox" wire:model.live="customFieldValues.{{ $field['name'] }}">
<span>Evet</span>
<span>Yes</span>
</label>
@elseif ($field['type'] === 'date')
<input type="date" class="qc-input" wire:model.live="customFieldValues.{{ $field['name'] }}">
@ -1240,21 +1598,21 @@
</div>
<div class="qc-footer">
<button type="button" class="qc-btn qc-btn-secondary" wire:click="goToStep(3)">Geri</button>
<button type="button" class="qc-btn qc-btn-primary" wire:click="goToPreviewStep">Devam Et</button>
<button type="button" class="qc-btn qc-btn-secondary" wire:click="goToStep(3)">Back</button>
<button type="button" class="qc-btn qc-btn-primary" wire:click="goToPreviewStep">Continue</button>
</div>
@endif
@if ($currentStep === 5)
<div class="qc-body">
<div class="qc-preview-breadcrumb">Anasayfa {{ $this->selectedCategoryPath }}</div>
<div class="qc-preview-breadcrumb">Home {{ $this->selectedCategoryPath }}</div>
<div class="qc-preview-grid">
<div class="qc-preview-panel">
<div class="qc-gallery">
@foreach (array_slice($photos, 0, 3) as $photo)
<div class="qc-gallery-item">
<img src="{{ $photo->temporaryUrl() }}" alt="Önizleme fotoğrafı">
<img src="{{ $photo->temporaryUrl() }}" alt="Preview photo">
</div>
@endforeach
@for ($empty = count(array_slice($photos, 0, 3)); $empty < 3; $empty++)
@ -1280,7 +1638,7 @@
</div>
<div class="qc-preview-features">
<h5>İlan Özellikleri</h5>
<h5>Details</h5>
@if ($this->previewCustomFields !== [])
@foreach ($this->previewCustomFields as $field)
<div class="qc-feature-row">
@ -1290,8 +1648,8 @@
@endforeach
@else
<div class="qc-feature-row">
<div class="qc-feature-label">Ek özellik</div>
<div class="qc-feature-value">Bu kategori için seçilmedi</div>
<div class="qc-feature-label">Details</div>
<div class="qc-feature-value">No extra details added</div>
</div>
@endif
</div>
@ -1308,8 +1666,8 @@
</div>
<div class="qc-seller-actions">
<div class="qc-pill">Harita</div>
<div class="qc-pill">Satıcı Profili</div>
<div class="qc-pill">Map</div>
<div class="qc-pill">Profile</div>
</div>
</div>
@ -1320,14 +1678,15 @@
wire:click="publishListing"
@disabled($isPublishing)
>
{{ $isPublishing ? 'Yayınlanıyor...' : 'İlanı Şimdi Yayınla' }}
{{ $isPublishing ? 'Publishing...' : 'Publish Listing' }}
</button>
<button type="button" class="qc-muted-btn" wire:click="goToStep(4)">Geri Dön</button>
<button type="button" class="qc-muted-btn" wire:click="goToStep(4)">Back</button>
</div>
</div>
</div>
</div>
@endif
</div>
</div>
</div>
</div>

View File

@ -15,7 +15,7 @@ Route::get('/dashboard', fn () => auth()->check()
Route::middleware('auth')->prefix('panel')->name('panel.')->group(function () {
Route::get('/', [PanelController::class, 'index'])->name('index');
Route::get('/ilanlarim', [PanelController::class, 'listings'])->name('listings.index');
Route::get('/ilan-ver', [PanelController::class, 'create'])->name('listings.create');
Route::get('/create-listing', [PanelController::class, 'create'])->name('listings.create');
Route::post('/ilanlarim/{listing}/kaldir', [PanelController::class, 'destroyListing'])->name('listings.destroy');
Route::post('/ilanlarim/{listing}/satildi', [PanelController::class, 'markListingAsSold'])->name('listings.mark-sold');
Route::post('/ilanlarim/{listing}/yeniden-yayinla', [PanelController::class, 'republishListing'])->name('listings.republish');