@extends ('layouts/template')
@section('content')

<div class="mcp-theme-1 p-3">
    <div class="d-flex align-items-end mb-3">
        <h5 class="m-0 font-size-16">Stat Tree Line Reports</h5>
        <div moe wide class="ml-4">
            <a href="#" start show class="btn btn-sm btn-primary text-white">Create Report</a>
            <form url="{{ route("practice-management.api.statTreeLineReport.create") }}">
                @csrf
                <div class="mb-2">
                    <label class="mb-1 text-secondary text-sm">Report Title *</label>
                    <input type="text" name="title" class="form-control form-control-sm" required>
                </div>
                <div class="d-flex align-items-center">
                    <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
                </div>
            </form>
        </div>
    </div>
    <div class="table-responsive">
        <table class="table table-sm table-bordered border-bottom">
            <thead>
            <tr class="bg-light">
                <th class="border-bottom-0 text-secondary width-200px">Created</th>
                <th class="border-bottom-0 text-secondary width-500px">Title</th>
                <th class="border-bottom-0 text-secondary width-100px">Count</th>
                <th class="border-bottom-0 text-secondary"></th>
            </tr>
            </thead>
            @if(!count($statTreeLines))
                <tr>
                    <td colspan="4" class="p-3 text-secondary">No stat tree line reports yet!</td>
                </tr>
            @endif
            @foreach($statTreeLines as $line)
                <tr>
                    <td>{{ friendly_date_time($line->created_at) }}</a></td>
                    <td><a href="{{ route("practice-management.statTreeLineReports.edit", ['statTreeLine' => $line]) }}">{{ $line->title }}</a></td>
                    <td> - </td>
                    <td>
                        <div class="d-flex align-items-center flex-nowrap">
                            <a href="{{ route("practice-management.statTreeLineReports.edit", ['statTreeLine' => $line]) }}">Edit</a>
                            <span class="mx-2 text-secondary text-sm">|</span>
                            <div moe>
                                <a href="#" start show>Delete</a>
                                <form url="{{ route("practice-management.api.statTreeLineReport.remove") }}">
                                    @csrf
                                    <input type="hidden" name="uid" value="{{$line->uid}}">
                                    <p class="mb-2">Remove this report?</p>
                                    <div class="d-flex align-items-center">
                                        <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
                                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </td>
                </tr>
            @endforeach
        </table>
    </div>
</div>
@endsection