@extends('adminlte::page')

@section('title', 'IPRS | Onboarding')

@section('content_header')
    <div class="col-10 offset-1 d-flex justify-content-between align-items-center">
        <div class="row">
            <div class="col-sm-8">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="{{ route('dashboard') }}">Dashboard</a></li>
                    <li class="breadcrumb-item active">On-boarding</li>
                </ol>
            </div>
            <div class="col-sm-12">
                <h1 class="m-0">On-boarding</h1>
            </div>
        </div>
        <div>
            <div class="d-flex justify-content-end align-content-end">
                <a href="{{ route('onboarding.create') }}" class="btn btn-primary">On-board Client</a>
            </div>
        </div>
    </div>
@stop

@section('plugins.Datatables', true)

@section('content')
    <div class="col-10 offset-1">
       {{-- Setup data for datatables --}}
        @php
            $headings = [
                'ID',
                'Client',
                'Status',
                ['label' => 'Actions', 'no-export' => true, 'width' => 5],
            ];
        @endphp

        <x-adminlte-card>
            {{-- Minimal example / fill data using the component slot --}}
            <x-adminlte-datatable id="clients-table" :heads="$headings" striped hoverable bordered>
                @foreach($onboarded as $row)
                    <tr>
                        <td>{{ $row->id }}</td>
                        <td>{{ $row->client->name_fl ?? '-'}}</td>
                        <td>
                            @if($row->client_rid != null && $row->contract_rid != null && $row->user_id)
                                <div class="badge badge-success">Complete</div>
                            @else
                                <div class="badge badge-secondary">Draft</div>
                            @endif
                        </td>
                        <td>
                            <nobr>
                                @if($row->client_rid != null)
                                    <a href="{{ route('onboarding.show', $row->id) }}"
                                       class="btn btn-xs btn-default text-teal mx-1 shadow" title="Details">
                                        <i class="fa fa-lg fa-fw fa-eye"></i>
                                    </a>
                                @endif
                                <a href="{{ route('onboarding.edit', $row->id) }}"
                                   class="btn btn-xs btn-default text-primary mx-1 shadow" title="Edit">
                                    <i class="fa fa-lg fa-fw fa-pen"></i>
                                </a>
                                {{--<a href="#" class="btn btn-xs btn-default text-danger mx-1 shadow" title="Delete"
                                   onclick="function submit() {
                                    if (confirm('Are you sure you want to delete?')) {
                                    document.getElementById('form{{$row->id}}').submit();
                                    }
                                    }
                                    submit()"><i class="fa fa-lg fa-fw fa-trash"></i></a>
                                <form
                                    id="form{{$row->id}}"
                                    action="{{route("onboarding.destroy",$row->id)}}"
                                    method="post">
                                    @csrf
                                    {{method_field('DELETE')}}
                                </form>--}}
                            </nobr>

                        </td>
                    </tr>
                @endforeach
            </x-adminlte-datatable>
        </x-adminlte-card>
    </div>

@stop

@section('css')
    {{-- Add here extra stylesheets --}}
    {{-- <link rel="stylesheet" href="/css/admin_custom.css"> --}}
@stop

@section('js')

@stop
