@extends('admin.layouts.main')
@section('content')
    <div class="content-header">
        <div class="d-flex align-items-center">
            <div class="mr-auto">
                <h3 class="page-title"> {{ trans('messages.Sended Forms') }}</h3>
            </div>

        </div>
    </div>
    <section class="content">
        <div class="box">
            <div class="box-header">
                <div class="row">
                    <div class="col-4">
                        <div class="app-menu">
                            <div class="search-bx mx-5">
                                <form action="{{ route('projectForm.index') }}" method="GET">
                                    <div class="input-group">
                                        <input type="search" id="search" class="form-control" name="search"
                                            @isset($sort_search) value="{{ $sort_search }}" @endisset
                                            placeholder="{{ trans('messages.Name') }}" aria-label="Search"
                                            aria-describedby="button-addon2">
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                    {{-- <div class="col" style="text-align: end">
                        <a href="{{ route('projectForm.create') }}"
                            class="waves-effect waves-light btn btn-primary-light btn-circle"><span
                                class="mdi mdi-plus"><span class="path1"></span><span class="path2"></span></span></a>

                    </div> --}}
                </div>

            </div>
            <div class="box-body no-padding">
                <div class="table-responsive">
                    <table class="table table-hover">
                        <thead>
                            <tr class="">
                                <th class="text-center">
                                    #
                                </th>
                                <th class="text-center">{{ trans('messages.Serial') }}</th>
                                <th class="text-center">{{ trans('messages.Branch') }}</th>
                                <th class="text-center">{{ trans('messages.Project') }}</th>
                                <th class="text-center">{{ trans('messages.Form Name') }}</th>
                                <th class="text-center">{{ trans('messages.Status') }}</th>
                                <th class="text-center">{{ trans('messages.Expiration') }}</th>
                                <th class="text-center">{{ trans('messages.Created') }}</th>
                                <th class="text-center">{{ trans('messages.Options') }}</th>
                            </tr>
                        </thead>
                        <tbody>
                            @php
                                $bills = [
                                    'waiting' => 'badge-info-light',
                                    'incomplete' => 'badge-primary-light',
                                    'expired' => 'badge-danger-light',
                                    'done' => 'badge-warning-light',
                                ];
                            @endphp
                            @foreach ($forms as $key => $form)
                                <tr>
                                    <td class="text-center">
                                        {{ $key + 1 + ($forms->currentPage() - 1) * $forms->perPage() }}
                                    </td>
                                    <td class="text-center">{{ $form->serial_number }}</td>
                                    <td class="text-center">{{ $form->project->branch->name }}</td>
                                    <td class="text-center">{{ $form->project->name }}</td>
                                    <td class="text-center">{{ $form->form->name }}</td>
                                    <td class="text-center"><div class="badge badge-pill {{ $bills[$form->status] }}">{{ $form->status }}</div></td>
                                    <td class="text-center">{{ $form->expiration_date }}</td>
                                    <td class="text-center">{{ $form->created_at }}</td>
                                    <td class="text-center">
                                        <a href="{{ route('projectForm.show', $form->id) }}"
                                            class="waves-effect waves-light btn btn-primary-light btn-circle mx-5"><span
                                                class="mdi mdi-magnify"><span class="path1"></span><span
                                                    class="path2"></span></span></a>
                                    </td>
                                </tr>
                            @endforeach

                        </tbody>
                    </table>
                    {!! $forms->withQueryString()->links('pagination::bootstrap-4') !!}

                </div>
            </div>
        </div>
    </section>
@endsection
@section('modal')
    <div class="modal modal-left fade" id="modal-left" tabindex="-1">
        <div class="modal-dialog">
            <div class="modal-content" id="view-company">

            </div>
        </div>
    </div>
@endsection
@section('script')
    <script type="text/javascript"></script>
@endsection
