@extends('layouts.main') 
@section('title', 'Support provided by Accelerate Master View Data')
@section('content')
    <!-- push external head elements to head -->
    @push('head')
        <link rel="stylesheet" href="{{ asset('plugins/DataTables/datatables.min.css') }}">
        <link rel="stylesheet" href="{{ asset('plugins/jquery-ui/jquery-ui.css') }}">
    @endpush

    
    <div class="container-fluid">
        <div class="page-header">
            <div class="row align-items-end">
                <div class="col-lg-8">
                    <div class="page-header-title">
                        <i class="ik ik-pie-chart bg-blue"></i>
                        <div class="d-inline">
                            <h5>{{ __('Support provided by Accelerate Master View Data') }}</h5>
                            <!-- <span>{{ __('EJAF.') }}</span> -->
                        </div>
                    </div>
                </div>
                <div class="col-lg-4">
                    <nav class="breadcrumb-container" aria-label="breadcrumb">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item">
                                <a href="{{route('dashboard')}}"><i class="ik ik-home"></i></a>
                            </li>
                            
                           <li class="breadcrumb-item active" aria-current="page">{{ __('Support provided by Accelerate Master View')}}</li>
                        </ol>
                    </nav>
                </div>
            </div>
        </div>
        
        <?php
        use App\User;
        $id = Auth::user()->id;
        $user  = User::with('roles','permissions')->find($id);
        $permissions = $user->getAllPermissions();
        $add_perm = 0;
        $edit_perm = 0;
        $delete_perm = 0;
        if(count($permissions) > 0)
        {
            foreach($permissions as $data)
            {
                if($data->name == "Add")
                {
                    $add_perm = 1;
                }
                if($data->name == "Modify")
                {
                    $edit_perm = 1;
                }
                if($data->name == "Delete")
                {
                    $delete_perm = 1;
                }
            }
        }
        ?>
        
        <div class="row clearfix">
            <div class="col-md-12">
                <div class="card">
                    <div class="card-header">
                        <div class="col-md-10 pl-0">
                            <h3>{{ __('Support provided by Accelerate Data Table') }}</h3>
                        </div>
                        <div class="col-md-2 text-right">
                            @if($add_perm == 1)
                            <a href="{{'sup-master'}}" class='btn btn-primary'>{{__('Add SUP_ACC')}}</a>
                            @endif
                        </div>
                    </div>
                    <div class="card-body table-responsive">
                        <table id="myAdvancedTable" class="table p-3">
                            <thead>
                                <tr>
                                    <th>{{ __('SUP_ACC Id') }}</th>
                                    <th>{{ __('SUP_ACC Reason') }}</th>
                                    <th>{{ __('Action') }}</th>
                                </tr>
                            </thead>
                            <tbody>
                                 @foreach ($getdata as $getdatas)
                                <tr>
                                    <td>{{ $getdatas->sup_id }}</td>
                                    <td>{{ $getdatas->sup_reason }}</td>
                                    <td>
                                        @if($edit_perm == 1)
                                        <a href="{{'editsup/'.$getdatas->id}}" class='btn btn-success'>Edit</a> 
                                        @endif
                                        @if($delete_perm == 1)
                                        {{__(' | ')}}<a href="{{'deletesup/'.$getdatas->id}}" class='btn btn-danger'>Delete</a>
                                        @endif
                                    </td>
                                </tr>
                                @endforeach
                            </tbody>
                        </table>
                    </div>
                </div> 
            </div>
        </div>
    </div>

    <!-- push external js -->
    @push('script')
    <script src="{{ asset('plugins/jquery-ui/jquery-ui.min.js') }}"></script>
    <script src="{{ asset('plugins/DataTables/datatables.min.js') }}"></script>
    <!--get editable datatable script-->
    <script src="{{ asset('js/editable-datatable.js') }}"></script>
    @endpush
@endsection
