@extends('layouts.masterHome2')

@section('content')
<div class="container">
    
    <div class="card shadow">
        <div class="card-header  text-white" style="background-color:#2C4E71">
            <div class="row">
                <div class="col-md-6">
                    <h4 class="mb-0"> اشعارات الخصم</h4>
                </div>
                <div class="col-md-6 text-right">
                    <a  href='{{url("discount/index")}}'  class="btn btn-light">
                        <i class="fas fa-plus"></i> إضافة خصم
                    </a>
                </div>
            </div>
        </div>
        
        <div class="card-body">
            <div class="table-responsive">
                <table id="example1"  class="table table-hover table-bordered">
                    <thead class="thead-light">
                        <tr>
                            
                            <th> #</th>
                            <th>تاريخ الخصم</th>
                            <th>حالة الخصم</th>
                            <th>المبلغ الخصم</th>
                            <th>العميل</th>
                            <th>سبب الخصم</th>
                            <th>الإجراءات</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach($discounts as $dis)
                        <tr>
                             <td>{{ $dis->id }} </td>
                            <td>{{ $dis->created_at }}</td>
                            <td>
                                <span class="badge 
                                    @if($dis->status == 'Approved') badge-success
                                    @elseif($dis->status == 'Rejected') badge-danger
                                    @else badge-warning
                                    @endif">
                                    {{ $dis->status }}
                                </span>
                            </td>
                            <td>{{ number_format($dis->value, 2) }} جنيه</td>
                            <td>{{  $dis->client->name  }} </td>


                            <td>{{ $dis->reason }}</td>
                            <td>
                                 
                                <a  class="btn btn-sm btn-info viewid"   href='{{url("discount/details/{$dis->id}")}}'> <i class="fas fa-list"></i>  تفاصيل</a>
                                
                                @if($dis->status == 'Waiting')
                                <a  
                                   class="btn btn-sm btn-success">
                                    <i class="fas fa-check"></i> اعتماد
                                </a>
                                @endif
                            </td>
                        </tr>
                        @endforeach
                    </tbody>
                </table>
            </div>
            
            
        </div>
    </div>
</div>
 


@endsection