@extends('layouts.master')
@section('content')
    <div class="az-content-breadcrumb">
        <span>Notification Management</span>
    </div>
    <h2 class="az-content-title" style="display: inline"> Notification Management <span>
            @can('Notifications Management add')
                <a id="addbtn" href="{{ route('notification.create') }}" class="btn btn-az-primary" style="float: right">
                    <i class="fa-solid fa-plus"></i> Add Notification
                    Management</a>
            @endcan
        </span></h2>
    {{-- <h2 style="float: right" class="az-content-title"></h2> --}}


    {{-- <div class="az-content-body pd-lg-l-40 d-flex flex-column"> --}}
    <div class="row">
        <div class="col-md-12 col-lg-12 col-xl-12">
            <div class="card card-body pd-20">

                <div>
                    <table id="example2" class="table table-striped">
                        <thead>
                            <tr>
                                <th class="wd-10p">S.No</th>
                                <th class="wd-10p">Notification Management Name</th>
                                <th class="wd-10p">Product Category(Urdu)</th>
                                <th class="wd-10p">Status</th>
                                <th class="wd-10p">Created By</th>
                                <th class="wd-10p">Created</th>
                                <th class="col-2">Action</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach ($notification as $key => $discount)
                                <tr>

                                    <td>{{ $key + 1 }}</td>
                                    {{-- <td>{{ $discount->discount_name }}</td>
                               <td>{{ $discount->discount_type }}</td> --}}
                                    <td>{{ $discount->discount_for }}</td>
                                    <td>{{ $discount->discount_price }}</td>
                                    <td>{{ $discount->discount_status }}</td>
                                    <td>{{ $discount->name }}</td>
                                    <td><?= date('d-m-Y', strtotime($discount->created_at)) ?></td>
                                    <td>
                                        @can('Notifications Management edit')
                                            <a class="btn rounded shadow-base" title="Edit Product"
                                                href="{{ route('notification.edit', \Crypt::encrypt($discount->id_discounts)) }}">
                                                <i class="text-primary fa-regular fa-pen-to-square"></i> <span
                                                    class="text-primary">Edit</span>
                                            </a>
                                        @endcan
                                        @can('Notifications Management delete')
                                            <a class="btn rounded shadow-base" title="Delete Product"
                                                href="{{ route('notification.destroy', \Crypt::encrypt($discount->id_discounts)) }}">
                                                <i class="text-danger fa-solid fa-trash-can"></i> <span
                                                    class="text-danger">Remove</span>
                                            </a>
                                        @endcan
                                    </td>
                                </tr>
                            @endforeach
                        </tbody>
                        <tfoot>
                            <tr>
                                <th class="wd-10p">S.No</th>
                                <th class="wd-10p">Notification Management Name</th>
                                <th class="wd-10p">Product Category(Urdu)</th>
                                <th class="wd-10p">Status</th>
                                <th class="wd-10p">Created By</th>
                                <th class="wd-10p">Created</th>
                                <th class="col-2">Action</th>
                            </tr>
                        </tfoot>
                    </table>
                </div>
            </div>
            <!-- card -->
        </div>
        <!-- col -->
    </div>






    {{-- </div><!-- az-content-body --> --}}
@endsection

@push('scripts')
    {{-- <script type="text/javascript">
        $(function() {



            oTable = $('#example2').DataTable({

                responsive: !0
            });



        }); --}}
    {{-- </script> --}}
    <script type="text/javascript">
        document.addEventListener('keydown', function(event) {
            if ((event.ctrlKey || event.metaKey) && event.key === 'a') {
                event.preventDefault(); // Prevent default CTRL + A behavior (Select All)

                // Trigger the click on the "Add Customers" button
                document.getElementById('addbtn').click();
            }
        });
        $(function() {
            oTable = $('#example2').DataTable({
                dom: 'Bfrtip',
                buttons: [{
                        extend: 'csv',
                        text: 'CSV',
                        title: 'Customers List',
                        className: 'btn btn-default',
                        exportOptions: {
                            columns: 'th:not(:last-child)'
                        }
                    },
                    {
                        extend: 'excel',
                        text: 'Excel',
                        title: 'Customers List',
                        className: 'btn btn-default',
                        exportOptions: {
                            columns: 'th:not(:last-child)'
                        }
                    },
                    {
                        extend: 'pdf',
                        text: 'PDF',
                        title: 'Customers List',
                        className: 'btn btn-default',
                        exportOptions: {
                            columns: 'th:not(:last-child)'
                        }
                    },
                    {
                        extend: 'print',
                        text: 'Print',
                        title: 'Customers List',
                        className: 'btn btn-default',
                        exportOptions: {
                            columns: 'th:not(:last-child)'
                        }
                    }
                ],
                responsive: !0
            });
        });
    </script>
@endpush
