@extends('layouts.main') 
@section('title', 'ART Center 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>{{ __('ART Center 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">{{ __('ART Center 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>{{ __('ART Center Data Table') }}</h3>
                        </div>
                        <div class="col-md-2 text-right">
                            @if($add_perm == 1)
                            <a href="{{'artcenter-master'}}" class='btn btn-primary'>{{__('Add ART Center')}}</a>
                            @endif
                        </div>
                    </div>
                    <div class="card-body table-responsive">
                        <table id="myAdvancedTable" class="table p-3">
                            <thead>
                                <tr>
                                    <th>{{ __('ART Center Code') }}</th>
                                    <th>{{ __('Name of ART') }}</th>
                                    <th>{{ __('District Code') }}</th>
                                    <th>{{ __('State Code') }}</th>
                                    <th>{{ __('Status') }}</th>
                                    <th>{{ __('Action') }}</th>
                                </tr>
                            </thead>
                            <tbody>
                                 @foreach ($getdata as $getdatas)
                                <tr>
                                    <td>{{ $getdatas->art_centre_code }}</td>
                                    <td>{{ $getdatas->name_of_artc }}</td>
                                    <td>{{ $getdatas->dist_code }}</td>
                                    <td>{{ $getdatas->state_code }}</td>
                                    <td>{{ $getdatas->status }}</td>
                                    <td>
                                        @if($edit_perm == 1)
                                        <a href='{{'editartcenter/'.$getdatas->id}}' class='btn btn-success'>Edit</a> 
                                        @endif
                                        @if($delete_perm == 1)
                                        {{__(' | ')}}<a href='{{'deleteartcenter/'.$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>
    <!--<script src="{{ asset('plugins/DataTables/Cell-edit/dataTables.cellEdit.js') }}"></script>-->
    <!--get editable datatable script-->
    <script src="{{ asset('js/editable-datatable.js') }}"></script>
    @endpush
@endsection
