@extends('backend.layout.master')

@section('content')
    <!--<div class="main-content">-->
        <section class="section">
            <div class="section-header">
                <h1>{{ __($pageTitle) }}</h1>
            </div>

            <div class="row">
                <div class="col-12">
                    <div class="card">
                        <div class="card-header">
                            <a href="{{ route('admin.ticker.index') }}" class="btn btn-primary">
                                <i class="fa fa-arrow-left"></i> {{ __('Go Back') }}
                            </a>
                        </div>
                        <div class="card-body">
                            <form action="{{ route('admin.ticker.update', $ticker->id) }}" method="POST">
                                @csrf
                                @method('PUT')
                                <div class="row">
                                    <div class="form-group col-md-6">
                                        <label>{{ __('Date') }}</label>
                                        <input type="date" name="date" class="form-control" value="{{ $ticker->date }}" required>
                                    </div>

                                    <div class="form-group col-md-6">
                                        <label>{{ __('Ticker') }}</label>
                                        <input type="text" name="ticker" class="form-control" value="{{ $ticker->ticker }}" required>
                                    </div>

                                    <div class="form-group col-md-6">
                                        <label>{{ __('Position') }}</label>
                                        <input type="text" name="position" class="form-control" value="{{ $ticker->position }}">
                                    </div>

                                    <div class="form-group col-md-6">
                                        <label>{{ __('Result') }}</label>
                                        <select name="result" class="form-control">
                                            <option value="Profit" {{ $ticker->result === 'Profit' ? 'selected' : '' }}>Profit</option>
                                            <option value="Loss" {{ $ticker->result === 'Loss' ? 'selected' : '' }}>Loss</option>
                                            <option value="Breakeven" {{ $ticker->result === 'Breakeven' ? 'selected' : '' }}>Breakeven</option>
                                        </select>
                                    </div>
                                    
                                   <div class="form-group col-md-6">
    <label for="">{{ __('Select User') }}</label>
    <select name="user_id" class="form-control" required>
        <option value="All" {{ $ticker->user_id == 'All' ? 'selected' : '' }}>All users</option>
        @foreach($users as $user)
            <option value="{{ $user->id }}" {{ $ticker->user_id == $user->id ? 'selected' : '' }}>
                {{ $user->fname }} {{ $user->lname }}
            </option>
        @endforeach
    </select>
</div>
<div class="form-group col-md-6">
                                        <label>{{ __('status') }}</label>
                                        <select name="status" class="form-control">
                                            <option value="Active" {{ $ticker->result === 'Active' ? 'selected' : '' }}>Active</option>
                                            <option value="Inactive" {{ $ticker->result === 'Inactive' ? 'selected' : '' }}>Inactive</option>
                                          
                                        </select>
                                    </div>


                                    <div class="col-md-12">
                                        <button class="btn btn-success" type="submit">{{ __('Update Ticker') }}</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    <!--</div>-->
@endsection
