@extends('layouts.master')

@section('title', 'Create List')

@section('content')
<div class="container">
    <h1>Create New List</h1>

    @if ($errors->any())
    <div class="alert alert-danger">
        <ul>
            @foreach ($errors->all() as $error)
                <li>{{ $error }}</li>
            @endforeach
        </ul>
    </div>
@endif

    <form action="{{ route('save-list') }}" method="POST" enctype="multipart/form-data">
        @csrf
        <div class="mb-3">
            <label for="city" class="form-label">City</label>
            <input type="text" class="form-control" id="city" name="city" required>
        </div>
        <div class="mb-3">
            <label for="entity_type" class="form-label">Entity Type</label>
            <select name="entity_type_id" class="form-control"  required><option value="">Select an Entity type</option>
                @foreach($entity_type as $type)
                    <option value="{{$type->id}}">{{$type->type_name}}</option>
                @endforeach
            </select>
        </div>
        <div class="mb-3">
            <label for="title" class="form-label">Title</label>
            <input type="text" class="form-control" id="title" name="title" required>
        </div>
        <div class="mb-3">
            <label for="short_title" class="form-label">Short Title</label>
            <input type="text" class="form-control" id="short_title" name="short_title" required>
        </div>
        <div class="mb-3">
            <label for="imageURL">Image</label>
            <input type="file" id="imageURL" name="imageURL" class="form-control" required>
        </div>
        <div class="mb-3">
            <label for="listing_order">Listing Order</label>
            <input type="number" name="listing_order" id="listing_order" class="form-control" required>
        </div>
        <button type="submit" class="btn btn-primary">Submit</button>
    </form>
</div>
@endsection
