@extends('web.layouts.layout')
@section('content')

    <main>
        <!-- Start section -->
    @include('web.layouts.header')

    <!-- Start section -->

        <section class="profile_pg section">
            <div class="container">
                <div class="row">
                    <div class="col-lg-3">
                        <div class="prof-side">
                            <div class="prof-data wrapper">
                                <div class="img-box">
                                    <img src="{{asset($user->photo)}}" alt="" class="sec-img">
                                </div>
                                <h5 class="name text-center mt-4 mb-0"><b>   {{$user->name}}  </b></h5>
                            </div>
                            <div class="links-data wrapper">
                                <div class="nav flex-column nav-pills me-3" id="v-pills-tab" role="tablist" aria-orientation="vertical">
                                    @if($user->role == 'company')
                                        @if($user->active_account != 'active')
                                            <button class="nav-link active" id="v-pills-tab-1-tab" data-bs-toggle="pill" data-bs-target="#v-pills-tab-1" type="button" role="tab" aria-controls="v-pills-tab-1" aria-selected="true">   {{ __('web.contract') }}     </button>
                                        @else
                                            <button class="nav-link active" id="v-pills-tab1-tab" data-bs-toggle="pill" data-bs-target="#v-pills-tab1" type="button" role="tab" aria-controls="v-pills-tab1" aria-selected="false">{{ __('web.company_details') }}</button>
                                        @endif
                                    @endif
                                    @if($user->role != 'company')
                                        <button class="nav-link @if($user->role != 'company') active @endif" id="v-pills-tab1-tab" data-bs-toggle="pill" data-bs-target="#v-pills-tab1" type="button" role="tab" aria-controls="v-pills-tab1" aria-selected="true"> {{ __('web.user_details') }}    </button>
                                    @endif
                                    @if($user->role != 'company' || ($user->role == 'company' && $user->active_account == 'active'))
                                        <button class="nav-link" id="v-pills-tab3-tab" data-bs-toggle="pill" data-bs-target="#v-pills-tab3" type="button" role="tab" onclick="orders()" aria-controls="v-pills-tab3" aria-selected="false">    {{ __('web.my_orders') }} </button>
                                    @endif
                                    @if($user->role != 'company') 
                                        <button class="nav-link" id="v-pills-tab2-tab" data-bs-toggle="pill" data-bs-target="#v-pills-tab2" type="button" role="tab" onclick="locations()" aria-controls="v-pills-tab2" aria-selected="false">{{ __('web.my_locations') }}</button>
                                    @endif
                                    @if($user->role != 'company' || ($user->role == 'company' && $user->active_account == 'active'))
                                        <button class="nav-link" id="v-pills-tab4-tab" data-bs-toggle="pill" data-bs-target="#v-pills-tab4" type="button" role="tab" onclick="notifications()" aria-controls="v-pills-tab4" aria-selected="false">   {{ __('web.notifications') }}  </button>
                                    @endif
                                    <button class="nav-link" type="button" data-bs-toggle="modal" data-bs-target="#logoutModal"> {{ __('web.logout') }}  </button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-9">
                        <div class="tab-content" id="v-pills-tabContent">
                            @if($user->role == 'company')
                                @if($user->active_account != 'active')
                                <div class="tab-pane fade show active" id="v-pills-tab-1" role="tabpanel" aria-labelledby="v-pills-tab-1-tab">
                                    <div class="tab_wrapper contract_tab">
                                        <h2 class="sec_title text-uppercase color-primary fw-bold text-center mb-5">
                                            {{__('web.contract')}}
                                            <img src="{{url('')}}/assets/web/images/title_line.svg" class="d-block m-auto" alt=""/>
                                        </h2>

                                        <div class="data-group">
                                            <span class="label color-gray2"> {{ __('web.download_file') }}  </span>
                                            <a href="{{asset(settings('verification_pdf'))}}" target="_blank" class="data mb-0 d-block"> {{ __('web.click_here') }}  </a>
                                        </div>


                                        <form method="POST" action="{{$verification_action}}" onsubmit="formAction(this)">
                                            @CSRF
                                            <div class="cv_uploading_box justify-content-center d-flex align-items-center">
                                                <img src="{{url('')}}/assets/web/images/icons/pdf_file.png" alt="" class="icon"/>
                                                <div class="upload_txt">
                                                    <h5 class="label fs-6 fw-bold mb-3"> {{ __('web.attach_contract') }}  </h5>
                                                    <div class="upload-main-wrapper me-3">
                                                        <div class="upload-wrapper">
                                                            <input type="file" name="verification_file" id="upload-file">
                                                            <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid meet" viewBox="224.3881704980842 176.8527621722847 221.13266283524905 178.8472378277154" width="221.13" height="178.85"><defs><path d="M357.38 176.85C386.18 176.85 409.53 204.24 409.53 238.02C409.53 239.29 409.5 240.56 409.42 241.81C430.23 246.95 445.52 264.16 445.52 284.59C445.52 284.59 445.52 284.59 445.52 284.59C445.52 309.08 423.56 328.94 396.47 328.94C384.17 328.94 285.74 328.94 273.44 328.94C246.35 328.94 224.39 309.08 224.39 284.59C224.39 284.59 224.39 284.59 224.39 284.59C224.39 263.24 241.08 245.41 263.31 241.2C265.3 218.05 281.96 199.98 302.22 199.98C306.67 199.98 310.94 200.85 314.93 202.46C324.4 186.96 339.88 176.85 357.38 176.85Z" id="b1aO7LLtdW"></path><path d="M306.46 297.6L339.79 297.6L373.13 297.6L339.79 255.94L306.46 297.6Z" id="c4SXvvMdYD"></path><path d="M350.79 293.05L328.79 293.05L328.79 355.7L350.79 355.7L350.79 293.05Z" id="b11si2zUk"></path></defs><g><g><g><use xlink:href="#b1aO7LLtdW" opacity="1" fill="#ffffff" fill-opacity="1"></use></g><g><g><use xlink:href="#c4SXvvMdYD" opacity="1" fill="#363535" fill-opacity="1"></use></g><g><use xlink:href="#b11si2zUk" opacity="1" fill="#363535" fill-opacity="1"></use></g></g></g></g></svg>
                                                            <span class="file-upload-text">{{__('web.explore')}}</span>
                                                            <div class="file-success-text">
                                                                <svg version="1.1" id="check" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
                                                                    viewBox="0 0 100 100"  xml:space="preserve">
                                                                <circle style="fill:rgba(0,0,0,0);stroke:#CA1214;stroke-width:10;stroke-miterlimit:10;" cx="49.799" cy="49.746" r="44.757"/>
                                                                <polyline style="fill:rgba(0,0,0,0);stroke:#CA1214;stroke-width:10;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;" points="
                                                                    27.114,51 41.402,65.288 72.485,34.205 "/>
                                                            </svg> 
                                                            <span>{{__('web.success')}}</span></div>
                                                        </div>
                                                        <p id="file-upload-name"></p>
                                                    </div>
                                                </div>
                                                @if($user->verification_pdf)
                                                    <a target="_blank" href="{{asset($user->verification_pdf)}}" class="view_butn"><i class="fal fa-eye"></i></a>
                                                @endif
                                                <div class="edit_butn">
                                                      <input name="verification_file_2" type="file" id="upload-file2">
                                                     <i class="fal fa-edit"></i> 
                                                 </div>
                                            </div>
                                    
                                            <!--<div class="form-group mb-4">-->
                                            <!--    <label class="label fw-bold mb-2 small"> {{ __('web.attach_contract') }} </label>-->
                                            <!--    <div class="drop_box">-->
                                            <!--        <input id="demo1" class="demo1" type="file" placeholder="{{ __('web.support_files') }}: PNG, JPG, JPEG " name="verification_file" />-->
                                            <!--    </div>-->
                                            <!--</div>-->
                                            <button type="submit" class="butn primary_butn m-auto mt-5"> {{ __('web.save') }}  </button>

                                        </form>


                                    </div>
                                </div>
                                @endif
                            @endif
                            <div class="tab-pane fade @if($user->role != 'company') show active @else @if($user->active_account == 'active') show active @endif @endif" id="v-pills-tab1" role="tabpanel" aria-labelledby="v-pills-tab1-tab">
                                
                                    <div class="tab_wrapper profile_tab">
                                        @if($user->role == 'company')
                                        <div class="data_box">
                                            <h2 class="sec_title text-uppercase color-primary fw-bold text-center mb-5">
                                                {{ __('web.company_details') }}
                                                <img src="{{url('')}}/assets/web/images/title_line.svg" class="d-block m-auto" alt=""/>
                                            </h2>

                                            <div class="col-md-10 m-auto ">
                                                <div class="row">
                                                    <div class="col-lg-6">
                                                        <div class="data-group">
                                                            <span class="label color-gray2">   {{ __('web.company_name') }}   </span>
                                                            <p class="data mb-0">  {{$user->name}}   </p>
                                                        </div>
                                                    </div>
                                                    <div class="col-lg-6">
                                                        <div class="data-group">
                                                            <span class="label color-gray2">   {{ __('web.company_purchasing') }}    </span>
                                                            <p class="data mb-0">{{$user->purchasing}}   </p>
                                                        </div>
                                                    </div>
                                                    <div class="col-lg-6">
                                                        <div class="data-group">
                                                            <span class="label color-gray2"> {{ __('web.email') }}     </span>
                                                            <p class="data mb-0">{{$user->email}}</p>
                                                        </div>
                                                    </div>
                                                    @if($user->website_url)
                                                        <div class="col-lg-6">
                                                            <div class="data-group">
                                                                <span class="label color-gray2"> {{ __('web.website_url') }}     </span>
                                                                <p class="data mb-0">{{$user->website_url}}/</p>
                                                            </div>
                                                        </div>
                                                    @else
                                                        
                                                        <div class="col-lg-6"></div>
                                                    @endif
                                                    <div class="col-lg-6">
                                                        <div class="data-group">
                                                            <span class="label color-gray2"> {{ __('web.company_exhibition') }}     </span>
                                                            <p class="data mb-0">
                                                                <a href="{{asset($user->company_exhibition)}}" data-fancybox="images">
                                                                    <img src="{{asset($user->company_exhibition)}}" class="comp_img" alt="">
                                                                </a>
                                                            </p>
                                                        </div>
                                                        </div>
                                                    <div class="col-lg-6">
                                                        <div class="data-group">
                                                            <span class="label color-gray2"> {{ __('web.company_showroom') }}    </span>
                                                            <p class="data mb-0">
                                                                <a href="{{asset($user->company_showroom)}}" data-fancybox="images">
                                                                    <img src="{{asset($user->company_showroom)}}" class="comp_img" alt="">
                                                                </a>
                                                            </p>
                                                        </div>
                                                    </div>
                                                    @if(count($photos) > 0)
                                                        <div class="col-lg-12">
                                                            <div class="data-group">
                                                                <span class="label color-gray2"> {{ __('web.other_photos') }}    </span>
                                                                <p class="data mb-0">
                                                                    @foreach($photos as $row)
                                                                        <a href="{{asset($row->photo)}}" data-fancybox="images">
                                                                            <img src="{{asset($row->photo)}}" class="comp_img_small" alt="">
                                                                        </a>
                                                                    @endforeach
    
                                                                </p>
                                                            </div>
                                                        </div>
                                                    @endif
                                                    @if($user->amazon_url)
                                                        <div class="col-lg-6">
                                                            <div class="data-group">
                                                                <span class="label color-gray2"> {{ __('web.amazon_url') }}     </span>
                                                                <p class="data mb-0">{{$user->amazon_url}}</p>
                                                            </div>
                                                        </div>
                                                    @endif
                                                    @if($user->noon_url)
                                                        <div class="col-lg-6">
                                                            <div class="data-group">
                                                                <span class="label color-gray2"> {{ __('web.noon_url') }}     </span>
                                                                <p class="data mb-0">{{$user->noon_url}}/</p>
                                                            </div>
                                                        </div>
                                                    @endif
                                                </div>

                                            </div>


                                                <button class="butn primary_butn m-auto mt-5" id="editButton"> {{ __('web.edit_profile') }}  </button>
                                            </div>
                                        @else
                                        
                                    <div class="data_box">
                                        <h2 class="sec_title text-uppercase color-primary fw-bold text-center mb-5">
                                           {{ __('web.user_details') }}
                                            <img src="{{url('')}}/assets/web/images/title_line.svg" class="d-block m-auto" alt=""/>
                                        </h2>

                                        <div class="col-md-10 m-auto ">
                                            <div class="row">
                                                <div class="col-lg-12">
                                                    <div class="data-group">
                                                        <span class="label color-gray2"> {{ __('web.name') }}   </span>
                                                        <p class="data mb-0">{{$user->name}}   </p>
                                                    </div>
                                                </div>
                                                <div class="col-lg-6">
                                                    <div class="data-group">
                                                        <span class="label color-gray2"> {{ __('web.email') }}     </span>
                                                        <p class="data mb-0">{{$user->email}} </p>
                                                    </div>
                                                </div>
                                                <div class="col-lg-6">
                                                    <div class="data-group">
                                                        <span class="label color-gray2"> {{ __('web.phone') }}     </span>
                                                        <p class="data mb-0"> {{$user->phone}}   </p>
                                                    </div>
                                                </div>
                                                <div class="col-lg-6">
                                                    <div class="data-group">
                                                        <span class="label color-gray2">   {{ __('web.date_of_birth') }}     </span>
                                                        <p class="data mb-0"> {{$user->birth}}   </p>
                                                    </div>
                                                </div>
                                                <div class="col-lg-6">
                                                    <div class="data-group">
                                                        <span class="label color-gray2">  {{ __('web.gender') }}     </span>
                                                        <p class="data mb-0"> {{__('web.'.$user->gender)}}  </p>
                                                    </div>
                                                </div>
                                                <div class="col-lg-6">
                                                    <div class="data-group">
                                                        <span class="label color-gray2">   {{ __('web.country') }}    </span>
                                                        <p class="data mb-0"> {{$user->country ? $user->country->descriptions()->name : ''}}  </p>
                                                    </div>
                                                </div>
                                                <div class="col-lg-6">
                                                    <div class="data-group">
                                                        <span class="label color-gray2">  {{ __('web.city') }}     </span>
                                                        <p class="data mb-0"> {{$user->city ? $user->city->descriptions()->name : ''}}  </p>
                                                    </div>
                                                </div>
                                            </div>



                                            <button class="butn primary_butn m-auto mt-5" id="editButton"> {{ __('web.edit_profile') }}  </button>
                                        </div>
                                    </div>
                                        @endif
                                        @if($user->role == 'company')
                                        <div class="editData_box">
                                            <h2 class="sec_title text-uppercase color-primary fw-bold text-center mb-5">
                                                {{ __('web.edit_profile') }}
                                                <img src="{{url('')}}/assets/web/images/title_line.svg" class="d-block m-auto" alt=""/>
                                            </h2>

                                            <form method="post" action="{{$action}}" onsubmit="formAction(this)">
                                                @CSRF
                                                <div class="col-lg-10 m-auto">
                                                    {{--
                                                        <div class="profile-avatar mt-3 mb-4" id="imagePreview" style="background-image: url('{{asset($user->photo)}}');">
                                                            <input type="file" name="photo" class="custom-file-input" id="imageUpload" >
                                                            <button><i class="far fa-edit"></i></button>
                                                        </div>
                                                    --}}
                                                    <div class="row">
                                                        @foreach(languages() as $lang)
                                                            <div class="col-md-6">
                                                                <div class="form-group mb-4">
                                                                    <label class="label fw-bold"> {{ __('web.company_name') }} {{$lang->name}} </label>
                                                                    <input type="text" name="name_{{$lang->local}}" value="{{$user->descriptions($lang->id)->name}}" class="form-control" placeholder="{{ __('web.company_name') }} {{$lang->name}}" />
                                                                </div>
                                                            </div>
                                                            <div class="col-md-6">
                                                                <div class="form-group mb-4">
                                                                    <label class="label fw-bold"> {{ __('web.purchasing') }} {{$lang->name}} </label>
                                                                    <input type="text" name="purchasing_{{$lang->local}}" value="{{$user->descriptions($lang->id)->purchasing}}" class="form-control" placeholder="{{ __('web.purchasing') }} {{$lang->name}}" />
                                                                </div>
                                                            </div>
                                                        @endforeach
                                                        <div class="col-md-6">
                                                            <div class="form-group mb-4">
                                                                <label class="label fw-bold"> {{ __('web.email') }} </label>
                                                                <input type="email" name="email" value="{{$user->email}}" class="form-control" placeholder="test@mail.com" />
                                                            </div>
                                                        </div>
                                                        <div class="col-md-6">
                                                            <div class="form-group mb-4">
                                                                <label class="label fw-bold"> {{ __('web.website_url') }} </label>
                                                                <input type="url" name="website_url" value="{{$user->website_url}}" class="form-control" placeholder="https://www.website.com/" />
                                                            </div>
                                                        </div>
                                                        {{--
                                                            <div class="col-md-6">
                                                                <div class="form-group mb-4">
                                                                    <label class="label fw-bold"> {{ __('web.certificate_commercial') }} </label>
                                                                    <div class="drop_box">
                                                                        <input id="demo1"  class="demo1" type="file" placeholder="{{ __('web.support_files') }}: PNG, JPG, " name="certificate_commercial" />
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="col-md-6">
                                                                <div class="form-group mb-4">
                                                                    <label class="label fw-bold"> {{ __('web.tax_certificate') }} </label>
                                                                    <div class="drop_box">
                                                                        <input id="demo1" class="demo1" type="file" placeholder="{{ __('web.support_files') }}: PNG, JPG, " name="tax_certificate" />
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        --}}
                                                        <div class="col-md-6">
                                                            <div class="form-group mb-4">
                                                                <label class="label fw-bold"> {{ __('web.company_exhibition') }} </label>
                                                                <div class="drop_box">
                                                                    <input id="demo1" class="demo1" type="file" placeholder="{{ __('web.support_files') }}: PNG, JPG, " name="company_exhibition" />
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-6">
                                                            <div class="form-group mb-4">
                                                                <label class="label fw-bold"> {{ __('web.company_showroom') }} </label>
                                                                <div class="drop_box">
                                                                    <input id="demo1" class="demo1" type="file" placeholder="{{ __('web.support_files') }}: PNG, JPG " name="company_showroom" />
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-12">
                                                            <div class="form-group mb-4">
                                                                <label class="label fw-bold"> {{ __('web.other_photos') }} </label>
                                                                <div class="upload__box">
                                                                    <div class="upload__btn-box">
                                                                        <label class="upload__btn">
                                                                            <p>{{ __('web.support_files') }}: PNG, JPG</p>
                                                                            <input type="file" name="photos[]" multiple="" data-max_length="20" class="upload__inputfile">
                                                                        </label>
                                                                    </div>
                                                                    <div class="upload__img-wrap"></div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="links_box ">
                                                            <label class="label fw-bold text-center d-block fs-6 links_label"> {{ __('web.company_links') }}  </label>
                                                            <div class="row">
                                                                <div class="col-md-6">
                                                                    <div class="form-group mb-4">
                                                                        <label class="label fw-bold"> {{ __('web.amazon_url') }}  </label>
                                                                        <input type="url" name="amazon_url" value="{{$user->amazon_url}}" class="form-control" placeholder="https://www.website.com/" />
                                                                    </div>
                                                                </div>
                                                                <div class="col-md-6">
                                                                    <div class="form-group mb-4">
                                                                        <label class="label fw-bold"> {{ __('web.noon_url') }}  </label>
                                                                        <input type="url" name="noon_url" value="{{$user->noon_url}}" class="form-control" placeholder="https://www.website.com/" />
                                                                    </div>
                                                                </div>
                                                                @foreach($links as $row)
                                                                <div class="col-md-6 dynamic-field" id="dynamic-field-1">

                                                                        <div class="form-group mb-4">
                                                                            <label class="label fw-bold"> {{ __('web.another_link') }} </label>
                                                                            <input type="url" name="links[]" value="{{$row->link}}" class="form-control" placeholder="https://www.website.com/" />
                                                                        </div>

                                                                </div>
                                                                @endforeach
                                                                <div class="col-md-6 dynamic-field" id="dynamic-field-1">

                                                                        <div class="form-group mb-4">
                                                                            <label class="label fw-bold"> {{ __('web.another_link') }} </label>
                                                                            <input type="url" name="links[]" class="form-control" placeholder="https://www.website.com/" />
                                                                        </div>

                                                                </div>

                                                                <div class="butns d-flex justify-content-center">
                                                                    <button type="button" id="add-button" class="sm_butn add_butn"><i class="fa fa-plus fa-fw"></i> {{ __('web.add_another_link') }} </button>
                                                                    <button type="button" id="remove-button" class="sm_butn remove_butn" ><i class="far fa-trash-alt"></i></button>
                                                                </div>
                                                            </div>
                                                        </div>


                                                        <div class="col-md-6">
                                                            <div class="form-group show_hide_password mb-4">
                                                                <label class="label fw-bold"> {{ __('web.password') }} </label>
                                                                <input type="password" name="password" class="form-control shadow_input" placeholder="****** ">
                                                                <i class="show_pass far fa-eye-slash"></i>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-6">
                                                            <div class="form-group show_hide_password mb-4">
                                                                <label class="label fw-bold"> {{ __('web.password_confirmation') }} </label>
                                                                <input type="password" name="password_confirmation" class="form-control shadow_input" placeholder="****** ">
                                                                <i class="show_pass far fa-eye-slash"></i>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <button type="submit" class="butn primary_butn m-auto mt-5"> {{__('web.save')}}  </button>
                                                </div>
                                            </form>
                                        </div>
                                        @else
                                        
                                    <div class="editData_box">
                                        <h2 class="sec_title text-uppercase color-primary fw-bold text-center mb-5">
                                            {{ __('web.edit_profile') }}
                                            <img src="{{url('')}}/assets/web/images/title_line.svg" class="d-block m-auto" alt=""/>
                                        </h2>

                                        <form method="post" action="{{$action}}" onsubmit="formAction(this)" enctype="multipart/form-data">
                                            @CSRF
                                            <div class="col-lg-10 m-auto">
                                                <div class="profile-avatar mt-3 mb-4" id="imagePreview" style="background-image: url('{{asset($user->photo)}}');">
                                                    <input type="file" class="custom-file-input" id="imageUpload" name="photo">
                                                    <button><i class="far fa-edit"></i></button>
                                                </div>
                                                <div class="row">
                                                    <div class="col-md-12">
                                                        <div class="form-group mb-4">
                                                            <label class="label fw-bold"> {{ __('web.name') }} </label>
                                                            <input type="text" name="name" value="{{$user->name}}" class="form-control" placeholder="{{ __('web.name') }}" />
                                                        </div>
                                                    </div>
                                                    <div class="col-md-6">
                                                        <div class="form-group mb-4">
                                                            <label class="label fw-bold"> {{ __('web.email') }} </label>
                                                            <input type="email" name="email" value="{{$user->email}}" class="form-control" placeholder="test@mail.com" />
                                                        </div>
                                                    </div>
                                                    <div class="col-md-6">
                                                        <div class="form-group mb-4">
                                                            <label class="label fw-bold"> {{ __('web.phone') }} </label>
                                                            <input type="number" name="phone" value="{{$user->phone}}" class="form-control" placeholder="+966-000-000-000" />
                                                        </div>
                                                    </div>
                                                    <!--<div class="col-md-6">-->
                                                    <!--    <div class="form-group mb-4">-->
                                                    <!--        <label class="label fw-bold">{{ __('web.date_of_birth') }}</label>-->
                                                    <!--        <input type="text" disabled value="{{$user->date_of_birth}}" class="form-control" placeholder="" />-->
                                                    <!--    </div>-->
                                                    <!--</div>-->
                                                    <div class="col-md-6">
                                                        <div class="form-group mb-4">
                                                            <label class="label fw-bold">{{ __('web.gender') }}</label>
                                                            <select name="gender" class="form-control form-select">
                                                                <option {{$user->gender == 'male' ? 'selected' : ''}} value="male">{{ __('web.male') }}</option>
                                                                <option {{$user->gender == 'female' ? 'selected' : ''}} value="female">{{ __('web.female') }}</option>
                                                            </select>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-6">
                                                        <div class="form-group mb-4">
                                                            <label class="label fw-bold">{{ __('web.country') }}</label>
                                                            <select onchange="fetchCities(this)" target-id="city_id" name="country_id" class="form-control form-select">
                                                                <option value="">{{__('web.select')}}</option>
                                                                @foreach($countries as $row)
                                                                    <option {{$user->country_id == $row->id ? 'selected' : ''}} value="{{$row->id}}">{{$row->name}}</option>
                                                                @endforeach
                                                            </select>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-6">
                                                        <div class="form-group mb-4">
                                                            <label class="label fw-bold">{{ __('web.city') }}</label>
                                                            <select name="city_id" id="city_id" class="form-control city_id form-select">
                                                                <option value="">{{__('web.select')}}</option>
                                                                @foreach($cities as $row)
                                                                    <option {{$user->city_id == $row->id ? 'selected' : ''}} value="{{$row->id}}">{{$row->name}}</option>
                                                                @endforeach
                                                            </select>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-6">
                                                        <div class="form-group show_hide_password mb-4">
                                                            <label class="label fw-bold"> {{ __('web.password') }} </label>
                                                            <input type="password" name="password" class="form-control shadow_input" placeholder="****** ">
                                                            <i class="show_pass far fa-eye-slash"></i>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-6">
                                                        <div class="form-group show_hide_password mb-4">
                                                            <label class="label fw-bold"> {{ __('web.password_confirmation') }} </label>
                                                            <input type="password" name="password_confirmation" class="form-control shadow_input" placeholder="****** ">
                                                            <i class="show_pass far fa-eye-slash"></i>
                                                        </div>
                                                    </div>

                                                </div>
                                                <button type="submit" class="butn primary_butn m-auto mt-5"> {{ __('web.save') }}  </button>
                                            </div>
                                        </form>
                                    </div>
                                        @endif
                                    </div>
                               

                            </div>
                                <div class="tab-pane fade" id="v-pills-tab3"  role="tabpanel" aria-labelledby="v-pills-tab3-tab">

                                </div>
                                <div class="tab-pane fade" id="v-pills-tab2" role="tabpanel" aria-labelledby="v-pills-tab2-tab">

                                </div>
                                <div class="tab-pane fade" id="v-pills-tab4" role="tabpanel" aria-labelledby="v-pills-tab4-tab">

                                </div>

                        </div>
                    </div>
                </div>
            </div>
        </section>
        <!-- Start section -->
        @include('web.layouts.newsletter')

    </main>
    @include('web.pages.components.modals.logout')
    <div class="modal locModal fade" id="editLocModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered modal-lg">
            <div class="modal-content">
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                <div class="modal-body mt-3" id="formAddress">

                </div>

            </div>
        </div>
    </div>
    
    @section('inject_js')
    
    <script src="{{url('')}}/assets/web/js/lib/uploadFile.js"></script>
    
        @isset($request->locations)
            <script>
                setTimeout(function(){
                    $('#v-pills-tab2-tab').click()
                }, 700);

            </script>
        @endisset
        @isset($request->notification)
            <script>
                setTimeout(function(){
                    $('#v-pills-tab4-tab').click()
                }, 700);

            </script>
        @endisset
        <script>
            let url_fetch_orders = "{{route('profile.orders')}}";
            let url_fetch_notifications = "{{route('profile.notifications')}}";
            let url_fetch_locations = "{{route('profile.locations')}}";
            let url_fetch_show_order = "{{url(getCurrentLocale().'/order/status')}}";
        </script>
        <script>
            function showOrder(elem)
            {
                let status = $(elem).attr('data-id')
                let target = $(elem).attr('data-bs-target')
                $.ajax
                ({
                    url : url_fetch_show_order,
                    type: 'GET',
                    data: 'status='+status,
                    success:function(data)
                    {
                        $(target).html(data)
                    }
                })
            }
            function orders()
            {
                $.ajax
                ({
                    url : url_fetch_orders,
                    type: 'GET',
                    data: '',
                    success:function(data)
                    {
                        $('#v-pills-tab3').html(data)

                        setTimeout(function(){
                            $('#pills-tab1-tab').click();
                        }, 200);
                    }
                })
            }
            function notifications()
            {
                $.ajax
                ({
                    url : url_fetch_notifications,
                    type: 'GET',
                    data: '',
                    success:function(data)
                    {
                        $('#v-pills-tab4').html(data)
                    }
                })
            }
            function locations()
            {
                $.ajax
                ({
                    url : url_fetch_locations,
                    type: 'GET',
                    data: '',
                    success:function(data)
                    {
                        $('#v-pills-tab2').html(data)
                    }
                })
            }
            function locationForm(elem)
            {
                let url = $(elem).attr('target-id');
                $.ajax
                ({
                    url : url,
                    type: 'GET',
                    data: '',
                    success:function(data)
                    {
                        $('#formAddress').html(data)
                    }
                })
            }
            function deleteLocation(elem)
            {
                let url = $(elem).attr('target-id');
                $.ajax
                ({
                    url : url,
                    type: 'GET',
                    data: '',
                    success:function(data)
                    {
                        $(elem).closest('.loc_card').fadeOut(1000)
                        locations()
                    }
                })
            }

        </script>
        <script>
            jQuery(document).ready(function () {
                ImgUpload();
            });

            function ImgUpload() {
                var imgWrap = "";
                var imgArray = [];

                $('.upload__inputfile').each(function () {
                    $(this).on('change', function (e) {
                        imgWrap = $(this).closest('.upload__box').find('.upload__img-wrap');
                        var maxLength = $(this).attr('data-max_length');

                        var files = e.target.files;
                        var filesArr = Array.prototype.slice.call(files);
                        var iterator = 0;
                        filesArr.forEach(function (f, index) {

                            if (!f.type.match('image.*')) {
                                return;
                            }

                            if (imgArray.length > maxLength) {
                                return false
                            } else {
                                var len = 0;
                                for (var i = 0; i < imgArray.length; i++) {
                                    if (imgArray[i] !== undefined) {
                                        len++;
                                    }
                                }
                                if (len > maxLength) {
                                    return false;
                                } else {
                                    imgArray.push(f);

                                    var reader = new FileReader();
                                    reader.onload = function (e) {
                                        var html = "<div class='upload__img-box'><div style='background-image: url(" + e.target.result + ")' data-number='" + $(".upload__img-close").length + "' data-file='" + f.name + "' class='img-bg'><div class='upload__img-close'></div></div></div>";
                                        imgWrap.append(html);
                                        iterator++;
                                    }
                                    reader.readAsDataURL(f);
                                }
                            }
                        });
                    });
                });

                $('body').on('click', ".upload__img-close", function (e) {
                    var file = $(this).parent().data("file");
                    for (var i = 0; i < imgArray.length; i++) {
                        if (imgArray[i].name === file) {
                            imgArray.splice(i, 1);
                            break;
                        }
                    }
                    $(this).parent().parent().remove();
                });
            }
        </script>
        <script>


            $(document).ready(function() {
                var buttonAdd = $("#add-button");
                var buttonRemove = $("#remove-button");
                var className = ".dynamic-field";
                var count = 0;
                var field = "";
                var maxFields = 10;

                function totalFields() {
                    return $(className).length;
                }

                function addNewField() {
                    count = totalFields() + 1;
                    field = $("#dynamic-field-1").clone();
                    field.attr("id", "dynamic-field-" + count);
                    field.children("label").text("Field " + count);
                    field.find("input").val("");
                    $(className + ":last").after($(field));
                }

                function removeLastField() {
                    if (totalFields() > 1) {
                        $(className + ":last").remove();
                    }
                }

                function enableButtonRemove() {
                    if (totalFields() === 2) {
                        buttonRemove.removeAttr("disabled");
                        buttonRemove.addClass("shadow-sm");
                    }
                }

                function disableButtonRemove() {
                    if (totalFields() === 1) {
                        buttonRemove.attr("disabled", "disabled");
                        buttonRemove.removeClass("shadow-sm");
                    }
                }

                function disableButtonAdd() {
                    if (totalFields() === maxFields) {
                        buttonAdd.attr("disabled", "disabled");
                        buttonAdd.removeClass("shadow-sm");
                    }
                }

                function enableButtonAdd() {
                    if (totalFields() === (maxFields - 1)) {
                        buttonAdd.removeAttr("disabled");
                        buttonAdd.addClass("shadow-sm");
                    }
                }


                buttonAdd.click(function() {
                    addNewField();
                    enableButtonRemove();
                    disableButtonAdd();
                });

                buttonRemove.click(function() {
                    removeLastField();
                    disableButtonRemove();
                    enableButtonAdd();
                });
            });

        </script>
        
        <script>
            function readURL(input) {
                if (input.files && input.files[0]) {
                    var reader = new FileReader();
                    reader.onload = function(e) {
                        $('#imagePreview').css('background-image', 'url('+e.target.result +')');
                        $('#imagePreview').hide();
                        $('#imagePreview').fadeIn(650);
                    }
                    reader.readAsDataURL(input.files[0]);
                }
            }
            $("#imageUpload").change(function() {
                readURL(this);
            });
        </script>
        
        <script>
            $(document).ready(function(){
                $('#upload-file').change(function() {
                    var filename = $(this).val();
                    $('#file-upload-name').html(filename);
                    if(filename!=""){
                        setTimeout(function(){
                            $('.upload-wrapper').addClass("uploaded");
                        }, 400);
                        setTimeout(function(){
                            $('.upload-wrapper').removeClass("uploaded");
                            $('.upload-wrapper').addClass("success");
                        }, 800);
                    }
                     $('#upload-file').hide()
                });
            });
            $(document) .ready(function(){
                $('#upload-file2').change(function() {
                    var filename = $(this).val();
                    $('#file-upload-name').html(filename);
                });
            });
        </script>
    @endsection
@stop
