@extends('layout.app')

@section('content')
    <div class="card">
        <div class="card-header">
            <h3 class="card-title">Create TJ Box</h3>
        </div>
        <div class="card-body">
            <form action="{{ route('tj-box-map.store') }}" method="POST">
                @csrf

                <div class="form-group">
                    <label for="name">Name <span class="text-danger">*</span></label>
                    <input type="text" name="name" id="name" class="form-control"
                        value="{{ old('name') }}" required>
                    @error('name')
                        <span class="text-danger">{{ $message }}</span>
                    @enderror
                </div>

                <div class="form-group">
                    <label for="coordinates">Coordinates (JSON) <span class="text-danger">*</span></label>
                    <textarea name="coordinates" id="coordinates" rows="4" class="form-control" required>{{ old('coordinates') }}</textarea>
                    <small class="form-text text-muted">
                        Store coordinates as valid JSON. Example: <code>{"lat": 23.8103, "lng": 90.4125}</code>
                    </small>
                    @error('coordinates')
                        <span class="text-danger">{{ $message }}</span>
                    @enderror
                </div>

                <div class="form-group">
                    <label for="remarks">Remarks</label>
                    <textarea name="remarks" id="remarks" rows="3" class="form-control">{{ old('remarks') }}</textarea>
                    @error('remarks')
                        <span class="text-danger">{{ $message }}</span>
                    @enderror
                </div>

                <div class="form-group mt-3">
                    <button type="submit" class="btn btn-primary">Save</button>
                    <a href="{{ route('tj-box-map.index') }}" class="btn btn-secondary">Back</a>
                </div>
            </form>
        </div>
    </div>
@endsection

