@extends('layouts.admin')
@section('styles')
    <link rel="stylesheet" href="{{ asset('backend/vendor/select2/css/select2.min.css') }}">
@endsection
@section('content')
    <div class="card shadow mb-4">
        <div class="card-header py-3 d-flex">
            <h6 class="m-0 font-weight-bold text-success">
                Create shipping company
            </h6>
            <div class="ml-auto">
                <a href="{{ route('admin.shipping_companies.index') }}" class="btn btn-success">
                    <span class="icon text-white-50">
                        <i class="fa fa-shipping-fast"></i>
                    </span>
                    <span class="text">Back to Shipping companies</span>
                </a>
            </div>
        </div>
        <div class="card-body">
            <form method="POST" action="{{ route('admin.shipping_companies.store') }}">
                @csrf
                <div class="row">
                    <div class="col-6">
                        <div class="form-group">
                            <label for="name" class="text-small text-uppercase">{{ __('Name') }}</label>
                            <input name="name" type="text" class="form-control" id="name"
                                   value="{{ old('name') }}" placeholder="Company Name">
                            @error('name')<span class="text-danger">{{ $message }}</span>@enderror
                        </div>
                    </div>
                    <div class="col-6">
                        <div class="form-group">
                            <label for="code" class="text-small text-uppercase">{{ __('Code') }}</label>
                            <input id="code" type="text" class="form-control" name="code"
                                   value="{{ old('code') }}" placeholder="Company code">
                            @error('code')<span class="text-danger">{{ $message }}</span>@enderror
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-6">
                        {!! BootForm::select('countries[]',__("Countries"),
                    old('countries',null) ,$countries->pluck('name',"id"),
                    ['data-plugin-multiselect',"multiple" => ""])
                   !!}
                    </div>
                    <div class="col-6">
                        <div class="form-group">
                            <label for="cost" class="text-small text-uppercase">{{ __('Cost') }}</label>
                            <input id="cost" type="number" min="0.00" class="form-control" name="cost" value="{{ old('cost') }}" >
                            @error('cost')<span class="text-danger">{{ $message }}</span>@enderror
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-4">
                        <div class="form-group">
                            <label for="description" class="text-small text-uppercase">{{ __('Description') }}</label>
                            <input id="description" value="{{ old('description') }}" class="form-control" name="description">
                            @error('description')<span class="text-danger">{{ $message }}</span>@enderror
                        </div>
                    </div>
                    <div class="col-4">
                        <div class="form-group">
                            <label for="fast">Fast</label>
                            <select name="fast" id="fast" class="form-control">
                                <option value="">---</option>
                                <option value="1" {{ old('fast') == "1" ? 'selected' : null }}>Yes</option>
                                <option value="0" {{ old('fast') == "0" ? 'selected' : null }}>No</option>
                            </select>
                            @error('fast')<span class="text-danger">{{ $message }}</span>@enderror
                        </div>
                    </div>
                    <div class="col-4">
                        <div class="form-group">
                            <label for="active">Status</label>
                            <select name="active" id="active" class="form-control">
                                <option value="">---</option>
                                <option value="1" {{ old('active') == "1" ? 'selected' : null }}>Active</option>
                                <option value="0" {{ old('active') == "0" ? 'selected' : null }}>Inactive</option>
                            </select>
                            @error('active')<span class="text-danger">{{ $message }}</span>@enderror
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <button type="submit" class="btn btn-primary">
                        {{ __('Create') }}
                    </button>
                </div>
            </form>
        </div>
    </div>
@endsection
