@if (!empty(auth()->user()->role->permissions['orders']['filter']))
    <div class="col-md-12">
        <div class="accordion" id="accordionExample">
            <div class="collapse-margin">
                <div class="card-header" id="headingOne" data-toggle="collapse" role="button" data-target="#collapseOne"
                    aria-expanded="false" aria-controls="collapseOne">
                    <span class="lead collapse-title">
                        <i class="fa fa-filter"></i> @lang('admin.orders.Filter')
                    </span>
                </div>

                {{--  id, client_phone, status, payment_status, payment_type, client_type, delivery_type
                with_didox, with_installation  --}}

                <div id="collapseOne" class="collapse" aria-labelledby="headingOne" data-parent="#accordionExample">
                    <div class="card-body">
                        <form method="get" action="{{ route('dashboard.orders.filter') }}">
                            <div class="form-body">
                                <div class="row">
                                    <div class="col-md-6 col-12">
                                        <div class="form-group">
                                            <label for="id">@lang('admin.orders.Order ID')</label>
                                            <input type="number" id="id" class="form-control"
                                                value="{{ request()->get('id') }}" placeholder="@lang('admin.orders.Order ID')"
                                                name="id">
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-12">
                                        <div class="form-group">
                                            <label for="client_phone">@lang('admin.orders.client_phone')</label>
                                            <input type="text" id="client_phone" class="form-control"
                                                value="{{ request()->get('client_phone') }}"
                                                placeholder="@lang('admin.orders.client_phone')" name="client_phone">
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-12">
                                        <div class="form-group">
                                            <label for="order_status">@lang('admin.orders.Order status')</label>
                                            <select class="form-control" id="status" name="order_status">
                                                <option value="0" selected>@lang('admin.categories.Not selected')</option>
                                                @foreach (App\Models\Order::statuses() as $status)
                                                    <option value="{{ $status }}"
                                                        @if (request('order_status') == $status) selected @endif>
                                                        @lang('admin.orders.statuses.' . $status)
                                                    </option>
                                                @endforeach
                                            </select>
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-12">
                                        <div class="form-group">
                                            <label for="payment_status">@lang('admin.orders.payment_status')</label>
                                            <select class="form-control" id="payment_status" name="payment_status">
                                                <option value="0" selected>@lang('admin.categories.Not selected')</option>
                                                @foreach (App\Models\Order::paymentStatuses() as $paymentStatus)
                                                    <option value="{{ $paymentStatus }}"
                                                        @if (request('payment_status') == $paymentStatus) selected @endif>
                                                        @lang('admin.orders.statuses.' . $paymentStatus)
                                                    </option>
                                                @endforeach
                                            </select>
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-12">
                                        <div class="form-group">
                                            <label for="payment_type">@lang('admin.orders.Payment type')</label>
                                            <select class="form-control" id="payment_type" name="payment_type">
                                                <option value="0" selected>@lang('admin.categories.Not selected')</option>
                                                @foreach (App\Models\Order::paymentTypes() as $paymentType)
                                                    <option value="{{ $paymentType }}"
                                                        @if (request('payment_type') == $paymentType) selected @endif>
                                                        @lang('admin.orders.payment_type.' . $paymentType)
                                                    </option>
                                                @endforeach
                                            </select>
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-12">
                                        <div class="form-group">
                                            <label for="client_type">@lang('admin.client.client_type')</label>
                                            <select class="form-control" id="client_type" name="client_type">
                                                <option value="0" selected>@lang('admin.categories.Not selected')</option>
                                                @foreach (App\Models\Order::clientTypes() as $clientType)
                                                    <option value="{{ $clientType }}"
                                                        @if (request('client_type') == $clientType) selected @endif>
                                                        @lang('admin.client.types.' . $clientType)
                                                    </option>
                                                @endforeach
                                            </select>
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-12">
                                        <div class="form-group">
                                            <label for="delivery_type">@lang('admin.orders.delivery_type')</label>
                                            <select class="form-control" id="delivery_type" name="delivery_type">
                                                <option value="0" selected>@lang('admin.categories.Not selected')</option>
                                                @foreach (App\Models\Order::deliveryTypes() as $deliveryType)
                                                    <option value="{{ $deliveryType }}"
                                                        @if (request('delivery_type') == $deliveryType) selected @endif>
                                                        @lang('admin.orders.type_delivery.' . $deliveryType)
                                                    </option>
                                                @endforeach
                                            </select>
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-12">
                                        <div class="form-group">
                                            <label for="delivery_type">@lang('admin.orders.date')</label>
                                            <input type="text" class="form-control" name="datefilter"
                                                value="{{ request('datefilter') }}" />
                                            <input type="hidden" name="from" id="from"
                                                value="{{ request('from') }}">
                                            <input type="hidden" name="to" id="to"
                                                value="{{ request('to') }}">
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-12">
                                        <div class="form-group">
                                            <label for="delivery_type">@lang('admin.orders.with_didox')</label>
                                            <div class="demo-inline-spacing">
                                                <div class="form-check form-check-inline">
                                                    <input name="with_didox[]" class="form-check-input"
                                                        type="checkbox" id="with_didox1" value="checked"
                                                        @if (request('with_didox') && in_array('checked', request('with_didox'))) checked @endif
                                                        @if (!request('with_didox')) checked @endif />
                                                    <label class="form-check-label"
                                                        for="with_didox1">@lang('admin.orders.with_installations.1')</label>
                                                </div>
                                                <div class="form-check form-check-inline">
                                                    <input name="with_didox[]" class="form-check-input"
                                                        type="checkbox" id="with_didox0" value="unchecked"
                                                        @if (request('with_didox') && in_array('unchecked', request('with_didox'))) checked @endif
                                                        @if (!request('with_didox')) checked @endif />
                                                    <label class="form-check-label"
                                                        for="with_didox0">@lang('admin.orders.with_installations.0')</label>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-12">
                                        <div class="form-group">
                                            <label for="delivery_type">@lang('admin.orders.with_installation')</label>
                                            <div class="demo-inline-spacing">
                                                <div class="form-check form-check-inline">
                                                    <input name="with_installation[]" class="form-check-input"
                                                        type="checkbox" id="with_installation1" value="checked"
                                                        @if (request('with_installation') && in_array('checked', request('with_installation'))) checked @endif
                                                        @if (!request('with_installation')) checked @endif />
                                                    <label class="form-check-label"
                                                        for="with_installation1">@lang('admin.orders.with_installations.1')</label>
                                                </div>
                                                <div class="form-check form-check-inline">
                                                    <input name="with_installation[]" class="form-check-input"
                                                        type="checkbox" id="with_installation0" value="unchecked"
                                                        @if (request('with_installation') && in_array('unchecked', request('with_installation'))) checked @endif
                                                        @if (!request('with_installation')) checked @endif />
                                                    <label class="form-check-label"
                                                        for="with_installation0">@lang('admin.orders.with_installations.0')</label>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-12">
                                        <button type="submit"
                                            class="btn btn-primary mr-1 mb-1 waves-effect waves-light"><i
                                                class="fa fa-filter"></i> @lang('admin.products.Apply')</button>
                                        <a href="{{ route('dashboard.orders') }}"
                                            class="btn btn-outline-warning mr-1 mb-1 waves-effect waves-light">@lang('admin.products.Reset')</a>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>

    </div>
@endif
