@php
$platform = \App\Models\ContactUsSetting::select('form_field')->first();
$fields = explode(',',$platform->form_field);
@endphp
<div class="row" id="support_page">

    <div class="col-lg-8 offset-lg-2">
        <div class="box-main">
            <div class="aos-init aos-animate card card-body">
                <form method="POST" action="{{ route('support-ticket.create') }}" enctype="multipart/form-data"
                    id="ticket_form" data-form-type="member">
                    @csrf
                    <h3 class="text-center">{{ ('Create New Ticket') }}</h3>
                    <div class="row">
                        @if (in_array("Category",$fields))
                            <div class="form-group col-12 col-md-12" id="section_category">
                                <div class="relative z-0 w-full group mb-1">
                                    <select id="category" class="rounded-lg p-2.5 w-full text-sm text-gray-900 bg-transparent border-gray-300 appearance-none focus:outline-none border-2 focus:ring-1 peer pl-15 h-11" name="category">
                                        <option value="">{{__('Choose category')}}</option>
                                    </select>
                                    <label for="category" class="col-form-label ml-2 p-2 py-0 peer-focus:font-medium absolute left-0 text-sm text-gray-600 duration-300 transform -translate-y-6 scale-75 top-3 origin-[0] peer-focus:start-0 rtl:peer-focus:translate-x-1/4 peer-focus:text-indigo-400 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6 bg-white peer-focus:z-10">{{__('Category')}} <span class="text-danger">*</span></label>
                                    <div class="text-danger error category_error"></div>
                                </div>
                            </div>
                        @endif
                        @if (in_array("Email",$fields))
                            <div class="form-group col-12 col-md-6" id="section_email">
                                <div class="relative z-0 w-full group mb-1">
                                    <input type="email" id="email" placeholder=""
                                    class="rounded-lg p-2.5 w-full text-sm text-gray-900 bg-transparent border-gray-300 appearance-none focus:outline-none border-2 focus:ring-1 peer pl-15 h-11 contact-form-email" name="email"
                                    value="@auth {{ auth()->user()->details->email }} @endauth" @auth disabled readonly @endauth>
                                    <label for="email" class="col-form-label ml-2 p-2 py-0 peer-focus:font-medium absolute left-0 text-sm text-gray-600 duration-300 transform -translate-y-6 scale-75 top-3 origin-[0] peer-focus:start-0 rtl:peer-focus:translate-x-1/4 peer-focus:text-indigo-400 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6 bg-white peer-focus:z-10">{{__('Email')}} <span class="text-danger">*</span></label>
                                    <div class="text-danger error email_error"></div>
                                </div>
                            </div>
                        @endif
                        @if (in_array("Name",$fields))
                            <div class="form-group col-12 col-md-6" id="section_name">
                                <div class="relative z-0 w-full group mb-1">
                                    <input class="rounded-lg p-2.5 w-full text-sm text-gray-900 bg-transparent border-gray-300 appearance-none focus:outline-none border-2 focus:ring-1 peer pl-15 h-11 check-special col-md-12" type="text" id="name"
                                    placeholder="" name="name" required
                                    value="@auth {{ auth()->user()->details->first_name ?? '' }} {{ auth()->user()->details->last_name ?? '' }} @endauth" @auth disabled readonly @endauth>
                                    <label for="name" class="col-form-label ml-2 p-2 py-0 peer-focus:font-medium absolute left-0 text-sm text-gray-600 duration-300 transform -translate-y-6 scale-75 top-3 origin-[0] peer-focus:start-0 rtl:peer-focus:translate-x-1/4 peer-focus:text-indigo-400 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6 bg-white peer-focus:z-10">{{__('Name')}} <span class="text-danger">*</span></label>
                                    <div class="text-danger error name_error"></div>
                                </div>
                            </div>
                        @endif
                        @if (in_array("Subject",$fields))
                            <div class="form-group col-12 col-md-12" id="section_email">
                                <div class="relative z-0 w-full group mb-1">
                                    <input type="text" id="Subject" placeholder="" class="rounded-lg p-2.5 w-full text-sm text-gray-900 bg-transparent border-gray-300 appearance-none focus:outline-none border-2 focus:ring-1 peer pl-15 h-11 check-special col-md-12"
                                    name="subject">
                                    <label for="Subject" class="col-form-label ml-2 p-2 py-0 peer-focus:font-medium absolute left-0 text-sm text-gray-600 duration-300 transform -translate-y-6 scale-75 top-3 origin-[0] peer-focus:start-0 rtl:peer-focus:translate-x-1/4 peer-focus:text-indigo-400 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6 bg-white peer-focus:z-10">{{__('Subject')}} <span class="text-danger">*</span></label>
                                    <div class="text-danger error subject_error"></div>
                                </div>
                            </div>
                        @endif
                        @if (in_array("File",$fields))
                            <div class="col-md-12 col-sm-12 mt-2">
                                <div class="form-group mt-3" id="section_email">
                                    <input type="file" class="rounded-lg p-2.5 w-full text-sm text-gray-900 bg-transparent border-gray-300 appearance-none focus:outline-none border-2 focus:ring-1 peer pl-15 h-11 check-special col-md-12" id="files" name="file[]" placeholder="{{ __('Choose files') }}*" data-fileuploader-limit="{{getSiteSettings('attachment_limit')}}" data-fileuploader-maxSize="{{getSiteSettings('file_size')}}" data-fileuploader-extensions="{{getSiteSettings('attachment_types')}}">
                                    <div class="text-success mb-4 fileInfo">{{__('The file must be a file of type of : '.Str::replace(","," | ",getSiteSettings('attachment_types')).' and max file size is '.getSiteSettings('file_size').'MB and maximum '.getSiteSettings('attachment_limit')." file is allowed to upload.")}}</div>
                                </div>
                            </div>
                        @endif
                        @if (in_array("Message",$fields))
                        <div class="col-sm-12 mb-3">
                            <div class="form-group mb-3" id="section_description">
                                <label for="description">{{__('Message')}} <span class="text-danger">*</span></label>
                                <textarea id="description" class="form-control" required minlength="5" name="description"></textarea>
                                <div class="text-danger error description_error"></div>
                            </div>
                        </div>
                        @endif
                        @if (in_array("Captcha",$fields))
                        <div class="mb-3 recaptcha">
                            <div class="g-recaptcha" data-sitekey="{{ config('captcha.sitekey') }}"></div>
                            <div class="text-danger error g-recaptcha-response_error"></div>
                        </div>
                        @endif
                        <div class="col-sm-12 text-center">
                            <button class="btn btn-primary min-w-140 button-primary btn-save-record mb-2" type="button" onclick="createSupportTicket()">{!! renderIconHtml('save') !!}{{__('Submit Ticket')}}</button>
                        </div>
                    </div>

                </form>
            </div>
        </div>
    </div>
</div>
