@extends('layout.app')

@section('content')
    <div class="card">
        @if ($errors->any())
            <div class="alert alert-danger">
                <ul>
                    @foreach ($errors->all() as $error)
                        <li>{{ $error }}</li>
                    @endforeach
                </ul>
            </div>
        @endif

        <div class="card-body">
            <form action="{{ route('client-source.update', $source->id) }}" method="POST">
                @csrf
                @method('PUT')
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label for="name">Name</label>
                            <input type="text" class="form-control" id="name" name="name"
                                value="{{ $source->name }}" autocomplete="off" required placeholder="Source name">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label for="order">Order</label>
                            <input type="number" class="form-control" id="order" name="order"
                                value="{{ $source->order ?? 1 }}" required>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label for="status">Show In WebSite</label>
                            <select class="form-control" id="status" name="status" required>
                                <option value="no" {{ ($source->status ?? 'no') == 'no' ? 'selected' : '' }}>No</option>
                                <option value="yes" {{ ($source->status ?? 'no') == 'yes' ? 'selected' : '' }}>Yes
                                </option>
                            </select>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label for="transmission_team_status">Transmission Team Status</label>
                            <select class="form-control" id="transmission_team_status" name="transmission_team_status"
                                required>
                                <option value="No" {{ $source->transmission_team_status == 'No' ? 'selected' : '' }}>No
                                </option>
                                <option value="Yes" {{ $source->transmission_team_status == 'Yes' ? 'selected' : '' }}>
                                    Yes</option>
                            </select>
                        </div>
                    </div>
                </div>

                <button type="submit" class="btn btn-primary float-right">
                    Update
                </button>
            </form>
        </div>
    </div>
@endsection
