Current File : //home/tradevaly/public_html/resources/views/backend/pages/subscriber/index.blade.php
@extends('backend.ayaan.master')

@push('title') Subscribers | B2B Admin @endpush
@section('css')
    <style>
        .th-white-space th {
            white-space: nowrap;
        }
    </style>
    <link href="{{ asset('/assets/libs/datatables/datatables.min.css') }}" rel="stylesheet" type="text/css"/>
@endsection
@section('content')

    @component('components.breadcrumb')
        @slot('li_1') Dashboard @endslot
        @slot('title') Subscribers @endslot
    @endcomponent
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-body">
                    <div class="table-responsive">
                        <table class="table th-white-space" id="datatable-buttons">
                            <thead>
                            <tr>
                                <th class="text-center">SL</th>
                                <th>{{translate('Name')}}</th>
                                <th>{{translate('Member ID')}}</th>
                                <th>Start</th>
                                <th>End</th>
                                <th>{{translate('Package')}}</th>
                                <th>{{translate('Status')}}</th>
                                <th>{{translate('Action')}}</th>
                            </tr>
                            </thead>
                            <tbody>

                            @foreach ($subscribers as $subscriber)
                                <tr>

                                    <td class="text-center">{{$loop->iteration}}</td>
                                    <td>
                                        {{$subscriber->user? $subscriber->user->name:"User Not Exists"}}
                                    </td>
                                    
                                    <td>
                                        {{$subscriber->id}}
                                    </td>
                                    <td>
                                        {{ \Carbon\Carbon::parse($subscriber->start)->format('d M Y h:i') }}
                                    </td>
                                    <td>
                                        {{ \Carbon\Carbon::parse($subscriber->end)->format('d M Y h:i') }}
                                    </td>

                                    <td>
                                        @if($subscriber->package)
                                            <img style="height: 50px; width:50px; border-radius:50%;"
                                                 src="{{asset('storage/images/admin/package/'.$subscriber->package->image)}}"
                                                 alt="">

                                        @endif
                                    </td>
                                     <td>
                                        <span class="badge bg-{{ $subscriber->status == 'active' ? 'success' : 'secondary' }}">{{ $subscriber->status }}</span>
                                    </td>
                                    <td>
                                        <a class="btn btn-success btn-sm d-block mb-2"
                                           href="{{ route('admin.subscriber.invoice_details',$subscriber->id) }}">
                                            Invoice
                                        </a>

                                        @if($subscriber->payment_status == 'paid')
                                            <a style="white-space: nowrap;" class="btn btn-warning mb-2 btn-sm d-block"
                                               href="{{ route('admin.subscriber.money_receipt',$subscriber->id) }}">
                                                Money Receipt
                                            </a>
                                        @endif
                                        <!--<a  class="btn btn-danger btn-sm d-block mb-2"-->
                                        <!--   href="{{ route('admin.subscriber.delete',$subscriber->id) }}">-->
                                        <!--    Delete-->
                                        <!--</a>-->
                                    </td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    </div>

                </div>
            </div>
        </div>
    </div>
    <!-- end row -->
@endsection
@section('script')
    <!-- Required datatable js -->
    <script src="{{ asset('/assets/libs/datatables/datatables.min.js') }}"></script>
    <script src="{{ asset('/assets/libs/jszip/jszip.min.js') }}"></script>
    <script src="{{ asset('/assets/libs/pdfmake/pdfmake.min.js') }}"></script>
    <!-- Datatable init js -->

    <script type="text/javascript">
        $(function () {


            $(document).ready(function () {

                var table = $('#datatable-buttons').DataTable({
                    lengthChange: false,
                    processing: true,
                    dom: 'Bfrtip',

                    buttons: ['copy', 'excel', 'pdf', 'colvis']
                });
                table.buttons().container().appendTo('#datatable-buttons_wrapper .col-md-6:eq(0)');
                $(".dataTables_length select").addClass('form-select form-select-sm');
            });
        });
    </script>
@endsection