@extends('admin-system.admin')

@section('content')
<div class="container-fluid px-0">
    <div class="row">
        <div class="col-sm-12">
            <div class="card border-0 bg-transparent">
                <div class="card-header border-0 bg-transparent px-0 py-0 mb_16">
                    <div class="d-flex justify-content-between align-items-center">
                        <a class="page-title text-nowrap">
                            <h5 class="text-koulen text-secondary">Currency</h5>
                        </a>

                        <!-- Add New Button -->
                        <a href="{{ url('currency/create') }}" class="btn btn-success">
                            + Add New
                        </a>
                    </div>
                </div>

                <div class="card-body p-3 border-0 bg-white rounded-lg">
                    <div class="table-responsive">
                        <table class="table table-borderless mb-0">
                            <thead>
                                <tr class="border-top border-bottom text-nowrap">
                                    <th>#</th>
                                    <th>Name EN</th>
                                    <th>Name KM</th>
                                    <th>Symbol</th>
                                    <th>Action</th>
                                </tr>
                            </thead>
                            <tbody>
                            @foreach($currency as $index => $item)
                                <tr>
                                    <td>{{ $index + 1 }}</td>
                                    <td>{{ $item->currency_en }}</td>
                                    <td>{{ $item->currency_km }}</td>
                                    <td>{{ $item->symbol }}</td>
                                    <td>
                                        <a href="{{ url('currency/'.$item->id.'/edit') }}" class="btn btn-sm btn-primary">Edit</a>
                                        @if($item->id != 1 && $item->id != 2)
                                            <form action="{{ url('adminbranch/'.$item->id) }}" method="POST" style="display:inline;">
                                                @csrf
                                                @method('DELETE')
                                                <button class="btn btn-sm btn-danger" onclick="return confirm('Are you sure?')">Delete</button>
                                            </form>
                                        @endif
                                    </td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>
@endsection

@section('script')
@endsection
