@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 col-md-12 col-lg-12">
                    <div class="card">
                        <div class="card-header">
                            <a href="#" class="btn btn-primary" data-toggle="modal" data-target="#modelCoinAdd"> <i class="fa fa-plus"></i> {{__('Add Coin')}}</a>
                        </div>
                        <div class="card-body p-0 table-responsive">
                            <table class="table">
                                <thead>
                                    <tr>
                                        <th>{{__('Name')}}</th>
                                        <th>{{__('Symbol')}}</th>
                                        <th>{{__('status')}}</th>
                                    </tr>
                                </thead>
                                
                                <tbody>

                                    @forelse ($currencies as $currency)
                                        <tr>
                                            <td>{{$currency->name}}</td>
                                            <td><img src="{{ asset('asset/theme3/images/symbols/' . $currency->symbol) }}" style="height: 25px"></td>
                                           
                                            <td>
                                                <a href="{{route('admin.coin.destroy', $currency->id)}}" class="btn btn-primary btn-sm">{{__('Delete')}}</a>
                                            </td>
                                        </tr>
                                    @empty
                                        
                                    <tr>
                                        <td colspan="100%" class="text-center">{{__('No Coins Found')}}</td>
                                    </tr>
                                    @endforelse

                                </tbody>

                            </table>


                        </div>
                    </div>
                    <div class="pagination">
                        {{ $currencies->links() }}
                    </div>
                </div>
            </div>
        </section>
    </div>




    <!-- Modal -->
<div class="modal fade" id="modelCoinAdd" tabindex="-1" role="dialog" aria-labelledby="modelCoinAddLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
        <form action="{{ route('admin.coin.store') }}" method="post" enctype="multipart/form-data">
            @csrf
      <div class="modal-content">
        <div class="modal-header">
          <h5 class="modal-title" id="modelCoinAddLabel">Add Coin</h5>
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div class="modal-body">
            <div class="row">

                <div class="form-group col-md-12 col-12">

                    <label for="">{{ __('Coin Name') }} <span class="text-danger">*</span>
                    </label>
                    <input type="text" name="name" class="form-control" required>
                </div>
                <div class="form-group col-md-12 col-12">

                    <label for="">{{ __('Coin Symbol Image') }} <span class="text-danger">*</span></label>
                    <input type="file" name="symbol" class="form-control" required>

                </div>

    
            </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
          <button type="submit" class="btn btn-primary">Save</button>
        </div>
      </div>
        </form>
    </div>
  </div>
@endsection
