openclassify/Modules/Listing/resources/views/create.blade.php
2026-03-03 12:49:08 +03:00

57 lines
3.9 KiB
PHP

@extends('layouts.app')
@section('content')
<div class="container mx-auto px-4 py-8">
<div class="max-w-2xl mx-auto">
<h1 class="text-2xl font-bold mb-6">Post a New Listing</h1>
<form method="POST" action="{{ route('listings.store') }}" class="bg-white rounded-lg shadow-md p-6 space-y-4">
@csrf
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Title *</label>
<input type="text" name="title" value="{{ old('title') }}" required class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500">
@error('title')<p class="text-red-500 text-sm mt-1">{{ $message }}</p>@enderror
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Description</label>
<textarea name="description" rows="4" class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500">{{ old('description') }}</textarea>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Price</label>
<input type="number" name="price" value="{{ old('price') }}" step="0.01" class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500">
@error('price')<p class="text-red-500 text-sm mt-1">{{ $message }}</p>@enderror
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Currency</label>
<select name="currency" class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500">
@php($defaultCurrency = old('currency', $currencies[0] ?? 'USD'))
@foreach(($currencies ?? ['USD']) as $currency)
<option value="{{ $currency }}" @selected($defaultCurrency === $currency)>{{ $currency }}</option>
@endforeach
</select>
@error('currency')<p class="text-red-500 text-sm mt-1">{{ $message }}</p>@enderror
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">City</label>
<input type="text" name="city" value="{{ old('city') }}" class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500">
@error('city')<p class="text-red-500 text-sm mt-1">{{ $message }}</p>@enderror
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Country</label>
<input type="text" name="country" value="{{ old('country') }}" class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500">
@error('country')<p class="text-red-500 text-sm mt-1">{{ $message }}</p>@enderror
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Contact Email</label>
<input type="email" name="contact_email" value="{{ old('contact_email') }}" class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500">
@error('contact_email')<p class="text-red-500 text-sm mt-1">{{ $message }}</p>@enderror
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Contact Phone</label>
<input type="text" name="contact_phone" value="{{ old('contact_phone') }}" class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500">
@error('contact_phone')<p class="text-red-500 text-sm mt-1">{{ $message }}</p>@enderror
</div>
<button type="submit" class="w-full bg-blue-600 text-white py-3 rounded-lg hover:bg-blue-700 transition font-medium">Post Listing</button>
</form>
</div>
</div>
@endsection