@extends('admin.layout.page-app')
@section('page_title', __('label.app_settings'))
@section('tab_title', __('label.app_settings'))

@section('content')
    @include('admin.layout.sidebar')

    <div class="right-content">
        @include('admin.layout.header')

        <div class="body-content">
            <!-- mobile title -->
            <h1 class="page-title-sm">{{__('label.app_settings')}}</h1>

            <div class="border-bottom row">
                <div class="col-sm-12">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="{{ route('admin.dashboard') }}">{{__('label.dashboard')}}</a></li>
                        <li class="breadcrumb-item active" aria-current="page">{{__('label.app_settings')}}</li>
                    </ol>
                </div>
            </div>

            <ul class="nav nav-pills custom-tabs inline-tabs" id="pills-tab" role="tablist">
                <li class="nav-item">
                    <a class="nav-link active" id="app-tab" data-toggle="tab" href="#app" role="tab" aria-controls="app" aria-selected="true">{{__('label.app_settings')}}</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" id="smtp-tab" data-toggle="tab" href="#smtp" role="tab" aria-controls="smtp" aria-selected="false">{{__('label.smtp')}}</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" id="onboarding-tab" data-toggle="tab" href="#onboarding" role="tab" aria-controls="onboarding" aria-selected="false">{{__('label.onboarding_screen')}}</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" id="social-tab" data-toggle="tab" href="#social" role="tab" aria-controls="social" aria-selected="false">{{__('label.social_settings')}}</a>
                </li>
            </ul>

            <div class="tab-content" id="pills-tabContent">
                <div class="tab-pane fade show active" id="app" role="tabpanel" aria-labelledby="app-tab">
                    <div class="card custom-border-card">
                        <h5 class="card-header">{{__('label.app_settings')}}</h5>
                        <div class="card-body">
                            <form id="app_setting" enctype="multipart/form-data">
                                <div class="form-row">
                                    <div class="col-md-9">
                                        <div class="form-row">
                                            <div class="form-group col-md-4">
                                                <label>{{__('label.app_name')}}<span class="text-danger">*</span></label>
                                                <input type="text" name="app_name" value="{{$setting_data['app_name']}}" class="form-control" placeholder="{{__('label.app_name_here')}}" autofocus>
                                            </div>
                                            <div class="form-group col-md-4">
                                                <label>{{__('label.app_version')}}<span class="text-danger">*</span></label>
                                                <input type="text" name="app_version" value="{{$setting_data['app_version']}}" class="form-control" placeholder="{{__('label.app_version_here')}}">
                                            </div>
                                            <div class="form-group col-md-4">
                                                <label>{{__('label.author')}}<span class="text-danger">*</span></label>
                                                <input type="text" name="author" value="{{$setting_data['author']}}" class="form-control" placeholder="{{__('label.author_here')}}">
                                            </div>
                                        </div>
                                        <div class="form-row">
                                            <div class="form-group col-md-4">
                                                <label>{{__('label.email')}}<span class="text-danger">*</span></label>
                                                <input type="email" name="email"  value="{{$setting_data['email']}}" class="form-control" placeholder="{{__('label.email_here')}}">
                                            </div>
                                            <div class="form-group  col-md-4">
                                                <label>{{__('label.contact')}}<span class="text-danger">*</span></label>
                                                <input type="text" name="contact" value="{{$setting_data['contact']}}" class="form-control" placeholder="{{__('label.contact_here')}}">
                                            </div>
                                            <div class="form-group col-md-4">
                                                <label>{{__('label.website')}}<span class="text-danger">*</span></label>
                                                <input type="text" name="website" value="{{$setting_data['website']}}" class="form-control" placeholder="{{__('label.website_here')}}">
                                            </div>
                                        </div>
                                        <div class="form-row">
                                            <div class="form-group col-md-12">
                                                <label>{{__('label.app_description')}}<span class="text-danger">*</span></label>
                                                <textarea name="app_description" rows="1" class="form-control" placeholder="{{__('label.app_description_here')}}">{{$setting_data['app_description']}}</textarea>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-3">
                                        <div class="form-group ml-5">
                                            <label>{{__('label.app_logo')}}<span class="text-danger">*</span></label>
                                            <div class="avatar-upload">
                                                <div class="avatar-edit">
                                                    <input type='file' name="app_logo" id="imageUpload" accept=".png, .jpg, .jpeg" />
                                                    <label for="imageUpload" title="{{__('label.upload_file')}}"></label>
                                                </div>
                                                <div class="avatar-preview">
                                                    <img src="{{$setting_data['app_logo']}}" id="imagePreview">
                                                </div>
                                            </div>
                                            <input type="hidden" name="old_app_logo" value="{{$setting_data['app_logo']}}">
                                        </div>
                                    </div>
                                </div>
                                <div class="border-top pt-3 text-right">
                                    <button type="button" class="btn btn-default mw-120" onclick="app_setting()">{{__('label.save')}}</button>
                                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                </div>
                            </form>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-6 mb-0">
                            <div class="card custom-border-card">
                                <h5 class="card-header">{{__('label.app_configrations_base_url')}}</h5>
                                <div class="card-body">
                                    <div class="input-group">
                                        <div class="col-2">
                                            <label class="pt-3" style="font-size:16px; font-weight:500; color:#1b1b1b">{{__('label.api_path')}}</label>
                                        </div>
                                        <input type="text" readonly value="{{url('/')}}/api/" name="api_path" class="form-control" id="api_path">
                                        <div class="input-group-text ml-2" onclick="copy_api_path()">
                                            <i class="fa-solid fa-copy fa-2xl"></i>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="card custom-border-card">
                                <h5 class="card-header">{{ __('label.google_map_key') }}</h5>
                                <div class="card-body">
                                    <form id="save_google_map">
                                        <div class="form-row">
                                            <div class="form-group col-md-12">
                                                <input type="text" name="google_map_api_key" class="form-control" value="{{ $setting_data['google_map_api_key'] }}" placeholder="{{ __('label.enter_api_key') }}">
                                                <label class="mt-1 ml-1 text-gray">{{ __('label.search_for_better_result') }} <a href="https://console.cloud.google.com/projectselector2/google/maps-apis/overview" target="_blank" class="btn-link">{{ __('label.click_here') }}</a></label>
                                            </div>
                                        </div>
                                        <div class="border-top pt-3 text-right">
                                            <button type="button" class="btn btn-default mw-120"
                                                onclick="save_google_map_key()">{{ __('label.save') }}</button>
                                            <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                        <div class="col-6">
                            <div class="card custom-border-card">
                                <h5 class="card-header">{{__('label.vap_id_key')}}</h5>
                                <div class="card-body">
                                    <form id="save_vap_id_key">
                                        <div class="form-row">
                                            <div class="form-group col-md-12">
                                                <input type="text" name="vap_id_key" class="form-control" value="{{$setting_data['vap_id_key']}}" placeholder="{{__('label.vap_id_key_here')}}">
                                            </div>
                                        </div>
                                        <div class="border-top pt-3 text-right">
                                            <button type="button" class="btn btn-default mw-120" onclick="save_vap_id_key()">{{__('label.save')}}</button>
                                            <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>  
                    </div>
                </div>
                <div class="tab-pane fade" id="smtp" role="tabpanel" aria-labelledby="smtp-tab">
                    <div class="card custom-border-card">
                        <h5 class="card-header">{{__('label.email_setting_smtp')}}</h5>
                        <div class="card-body">
                            <form id="smtp_setting" enctype="multipart/form-data">
                                <input type="hidden" name="id" value="{{$smtp_data['id']}}">
                                <div class="form-row">
                                    <div class="form-group col-md-3">
                                        <label>{{__('label.is_smtp_active')}}<span class="text-danger">*</span></label>
                                        <select name="status" class="form-control">
                                            <option value="">{{__('label.select_status')}}</option>
                                            <option value="0" {{ $smtp_data['status'] == 0  ? 'selected' : ''}}>{{__('label.no')}}</option>
                                            <option value="1" {{ $smtp_data['status'] == 1  ? 'selected' : ''}}>{{__('label.yes')}}</option>
                                        </select>
                                    </div>
                                    <div class="form-group col-md-3">
                                        <label>{{__('label.host')}}<span class="text-danger">*</span></label>
                                        <input type="text" name="host" class="form-control" value="{{$smtp_data['host']}}" placeholder="{{__('label.host_here')}}">
                                    </div>
                                    <div class="form-group col-md-3">
                                        <label>{{__('label.port')}}<span class="text-danger">*</span></label>
                                        <input type="text" name="port" class="form-control" value="{{$smtp_data['port']}}" placeholder="{{__('label.port_here')}}">
                                    </div>
                                    <div class="form-group col-md-3">
                                        <label>{{__('label.protocol')}}<span class="text-danger">*</span></label>
                                        <input type="text" name="protocol" class="form-control" value="{{$smtp_data['protocol']}}" placeholder="{{__('label.protocol_here')}}">
                                    </div>
                                </div>
                                <div class="form-row">
                                    <div class="form-group col-md-3">
                                        <label>{{__('label.user_name')}}<span class="text-danger">*</span></label>
                                        <input type="text" name="user" class="form-control" value="{{$smtp_data['user']}}" placeholder="{{__('label.user_name_here')}}">
                                    </div>
                                    <div class="form-group col-md-3">
                                        <label>{{__('label.password')}}<span class="text-danger">*</span></label>
                                        <input type="password" name="pass" class="form-control" value="{{$smtp_data['pass']}}" placeholder="{{__('label.password_here')}}">
                                        <label class="mt-1 text-gray">{{__('label.search_for_better_result')}}<a href="https://support.google.com/mail/answer/185833?hl=en" target="_blank" class="btn-link">{{__('label.click_here')}}</a></label>
                                    </div>
                                    <div class="form-group col-md-3">
                                        <label>{{__('label.from_name')}}<span class="text-danger">*</span></label>
                                        <input type="text" name="from_name" class="form-control" value="{{$smtp_data['from_name']}}" placeholder="{{__('label.from_name_here')}}">
                                    </div>
                                    <div class="form-group col-md-3">
                                        <label>{{__('label.from_email')}}<span class="text-danger">*</span></label>
                                        <input type="text" name="from_email" class="form-control" value="{{$smtp_data['from_email']}}" placeholder="{{__('label.from_email_here')}}">
                                    </div>
                                </div>
                                <div class="border-top pt-3 text-right">
                                    <button type="button" class="btn btn-default mw-120" onclick="smtp_setting()">{{__('label.save')}}</button>
                                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
                <div class="tab-pane fade" id="onboarding" role="tabpanel" aria-labelledby="onboarding-tab">
                    <div class="card custom-border-card">
                        <h5 class="card-header">{{__('label.onboarding_screen')}}</h5>
                        <div class="card-body">
                            <form id="onboarding_screen_setting" enctype="multipart/form-data">
                                <div class="row col-12">
                                    <div class="form-group col-xl-4">
                                        <label>{{__('label.title')}}<span class="text-danger">*</span></label>
                                        <input type="text" name="title[]" class="form-control" placeholder="{{__('label.title_here')}}">
                                    </div>
                                    <div class="form-group col-xl-3">
                                        <label>{{__('label.description')}}</label>
                                        <input type="text" name="description[]" class="form-control" placeholder="{{__('label.description_here')}}">
                                    </div>
                                    <div class="form-group col-xl-3 col-md-6">
                                        <label>{{__('label.image')}}<span class="text-danger">*</span></label>
                                        <input type="file" name="image[]" class="form-control import-file on_boarding_img" id="on_boarding_img" accept=".png, .jpg, .jpeg">
                                        <input type="hidden" name="old_image[]" value="">
                                    </div>
                                    <div class="form-group col-xl-1 col-md-4">
                                        <div class="custom-file">
                                            <img src="{{asset('assets/imgs/upload_img.png')}}" style="height: 90px; width: 90px;" class="img-thumbnail" id="link_img_on_boarding_img">
                                        </div>
                                    </div>
                                    <div class="col-md-1 mt-2">
                                        <div class="flex-grow-1 px-5 d-inline-flex">
                                            <div class="change mr-3 mt-4" id="add_btn">
                                                <a class="btn btn-success add-more text-white" onclick="add_more_screen()">+</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                @for ($i=0; $i < count($onboarding_screen_data); $i++)
                                    <div class="onboarding_part">
                                        <div class="row col-12">
                                            <div class="form-group col-xl-4">
                                                <label>{{__('label.title')}}<span class="text-danger">*</span></label>
                                                <input type="text" name="title[]" value="{{ $onboarding_screen_data[$i]['title'] }}" class="form-control" placeholder="{{__('label.title_here')}}">
                                            </div>
                                            <div class="form-group col-xl-3">
                                                <label>{{__('label.description')}}</label>
                                                <input type="text" name="description[]" value="{{ $onboarding_screen_data[$i]['description'] }}" class="form-control" placeholder="{{__('label.description_here')}}">
                                            </div>
                                            <div class="form-group col-xl-3 col-md-6">
                                                <label>{{__('label.image')}}<span class="text-danger">*</span></label>
                                                <input type="file" name="image[]" class="form-control import-file on_boarding_img" id="on_boarding_img{{$i}}" accept=".png, .jpg, .jpeg">
                                                <input type="hidden" name="old_image[]" value="{{ basename($onboarding_screen_data[$i]['image']) }}">
                                            </div>
                                            <div class="form-group col-xl-1 col-md-4">
                                                <div class="custom-file">
                                                    <img src="{{$onboarding_screen_data[$i]['image']}}" style="height: 90px; width: 90px;" class="img-thumbnail" id="link_img_on_boarding_img{{$i}}">
                                                </div>
                                            </div>
                                            <div class="col-md-1 mt-2">
                                                <div class="flex-grow-1 px-5 d-inline-flex">
                                                    <div class="change mr-3 mt-4" id="add_btn">
                                                        <a class="btn btn-danger text-white remove_on_boarding">-</a>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                @endfor

                                <div class="after-add-more-on-boarding"></div>

                                <div class="border-top pt-3 text-right">
                                    <button type="button" class="btn btn-default mw-120" onclick="onboarding_screen_setting()">{{__('label.save')}}</button>
                                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
                <div class="tab-pane fade" id="social" role="tabpanel" aria-labelledby="social-tab">
                    <div class="card custom-border-card">
                        <h5 class="card-header">{{__('label.social_links')}}</h5>
                        <div class="card-body">
                            <form id="social_link_setting" enctype="multipart/form-data">
                                <div class="row col-12">
                                    <div class="form-group col-xl-3 col-md-6">
                                        <label>{{__('label.name')}}<span class="text-danger">*</span></label>
                                        <input type="text" name="name[]" class="form-control" placeholder="{{__('label.name_here')}}">
                                    </div>
                                    <div class="form-group col-xl-3 col-md-6">
                                        <label>{{__('label.url')}}<span class="text-danger">*</span></label>
                                        <input type="url" name="url[]" class="form-control" placeholder="{{__('label.url_here')}}">
                                    </div>
                                    <div class="form-group col-xl-3 col-md-6">
                                        <label>{{__('label.icon')}}<span class="text-danger">*</span></label>
                                        <input type="file" name="image[]" class="form-control import-file social_img" id="social_img" accept=".png, .jpg, .jpeg">
                                        <input type="hidden" name="old_image[]" value="">
                                    </div>
                                    <div class="form-group col-xl-1 col-md-3">
                                        <div class="custom-file">
                                            <img src="{{asset('assets/imgs/upload_img.png')}}" style="height: 90px; width: 90px;" class="img-thumbnail" id="link_img_social_img">
                                        </div>
                                    </div>
                                    <div class="col-xl-1 col-md-3 mt-2">
                                        <div class="flex-grow-1 px-5 d-inline-flex">
                                            <div class="change mr-3 mt-4" id="add_btn">
                                                <a class="btn btn-success add-more text-white" onclick="add_more_link()">+</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                @for ($i=0; $i < count($social_link_data); $i++)
                                    <div class="social_part">
                                        <div class="row col-lg-12">
                                            <div class="form-group col-xl-3 col-md-6">
                                                <label>{{__('label.name')}}<span class="text-danger">*</span></label>
                                                <input type="text" name="name[]" value="{{ $social_link_data[$i]['name'] }}" class="form-control" placeholder="{{__('label.name_here')}}">
                                            </div>
                                            <div class="form-group col-xl-3 col-md-6">
                                                <label>{{__('label.url')}}<span class="text-danger">*</span></label>
                                                <input type="url" name="url[]" value="{{ $social_link_data[$i]['url'] }}" class="form-control" placeholder="{{__('label.url_here')}}">
                                            </div>
                                            <div class="form-group col-xl-3 col-md-6">
                                                <label>{{__('label.icon')}}<span class="text-danger">*</span></label>
                                                <input type="file" name="image[]" class="form-control import-file social_img" id="social_img_{{$i}}" accept=".png, .jpg, .jpeg">
                                                <input type="hidden" name="old_image[]" value="{{ basename($social_link_data[$i]['image']) }}">
                                            </div>
                                            <div class="form-group col-xl-1 col-md-3">
                                                <div class="custom-file">
                                                    <img src="{{$social_link_data[$i]['image']}}" style="height: 90px; width: 90px;" class="img-thumbnail" id="link_img_social_img_{{$i}}">
                                                </div>
                                            </div>
                                            <div class="col-xl-1 col-md-3 mt-2">
                                                <div class="flex-grow-1 px-5 d-inline-flex">
                                                    <div class="change mr-3 mt-4" id="add_btn">
                                                        <a class="btn btn-danger text-white remove_link">-</a>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                @endfor               

                                <div class="after-add-more"></div>

                                <div class="border-top pt-3 text-right">
                                    <button type="button" class="btn btn-default mw-120" onclick="social_link_setting()">{{__('label.save')}}</button>
                                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

@section('pagescript')
    <script>
        // Sidebar Scroll Down
		sidebar_down($(document).height());

        function app_setting() {

            var Demo_Mode = '<?php echo Demo_Mode(); ?>';
            if(Demo_Mode == 1){

                var formData = new FormData($("#app_setting")[0]);
                $("#dvloader").show();
                $.ajax({
                    type: 'POST',
                    url: '{{ route("app.setting.save") }}',
                    data: formData,
                    cache: false,
                    contentType: false,
                    processData: false,
                    success: function(resp) {
                        $("#dvloader").hide();
                        get_responce_message(resp, 'app_setting', '{{ route("app.setting") }}');
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                        $("#dvloader").hide();
                        toastr.error(errorThrown, textStatus);
                    }
                });
            } else {
                showError();
            }
        }
        function save_google_map_key() {
            var Check_Admin = '<?php echo Demo_Mode(); ?>';
            if (Check_Admin == 1) {

                var formData = new FormData($("#save_google_map")[0]);
                $("#dvloader").show();
                $.ajax({
                    type: 'POST',
                    url: "{{ route('setting.google_map_key') }}",
                    data: formData,
                    cache: false,
                    contentType: false,
                    processData: false,
                    success: function(resp) {
                        $("#dvloader").hide();
                        $("html, body").animate({
                            scrollTop: 0
                        }, "swing");
                        get_responce_message(resp);
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                        $("#dvloader").hide();
                        toastr.error(errorThrown, textStatus);
                    }
                });
            } else {
                showError();
            }
        }
        function save_vap_id_key() {
            var Check_Admin = '<?php echo Demo_Mode(); ?>';
            if(Check_Admin == 1){

                var formData = new FormData($("#save_vap_id_key")[0]);
                $("#dvloader").show();
                $.ajax({
                    type: 'POST',
                    url: '{{ route("setting.vapidkey") }}',
                    data: formData,
                    cache: false,
                    contentType: false,
                    processData: false,
                    success: function(resp) {
                        $("#dvloader").hide();
                        $("html, body").animate({scrollTop: 0}, "swing");
                        get_responce_message(resp);
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                        $("#dvloader").hide();
                        toastr.error(errorThrown, textStatus);
                    }
                });
            } else {
                showError();
            }
        }
        function copy_api_path() {
            
            var copyText = document.getElementById("api_path");
            copyText.select();
            copyText.setSelectionRange(0, 99999);

            document.execCommand('copy');

            alert("Copied the API Path: " + copyText.value);
        }
        function smtp_setting() {

            var Demo_Mode = '<?php echo Demo_Mode(); ?>';
            if(Demo_Mode == 1){

                var formData = new FormData($("#smtp_setting")[0]);
                $("#dvloader").show();
                $.ajax({
                    type: 'POST',
                    url: '{{ route("app.setting.smtp") }}',
                    data: formData,
                    cache: false,
                    contentType: false,
                    processData: false,
                    success: function(resp) {
                        $("#dvloader").hide();
                        get_responce_message(resp, 'smtp_setting', '{{ route("app.setting") }}');
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                        $("#dvloader").hide();
                        toastr.error(errorThrown, textStatus);
                    }
                });
            } else {
                showError();
            }
        }

        // Multipal Img Show 
        $(document).on('change', '.on_boarding_img', function(){
            readURL(this, this.id);
        });
        $(document).on('change', '.social_img', function(){
            readURL(this, this.id);
        });
        function readURL(input, id) {
            if (input.files && input.files[0]) {
                var reader = new FileReader();
                 
                reader.onload = function (e) {
                    $('#link_img_'+id).attr('src', e.target.result);
                }
                reader.readAsDataURL(input.files[0]);
            }
        }

        // OnBoarding Screen
        var i = -1;
        function add_more_screen(){

            var data = `
                <div class="onboarding_part">
                    <div class="row col-12">
                        <div class="form-group col-xl-4">
                            <label>{{__("label.title")}}<span class="text-danger">*</span></label>
                            <input type="text" name="title[]" class="form-control" placeholder="{{__("label.title_here")}}">
                        </div>
                        <div class="form-group col-xl-3">
                            <label>{{__("label.description")}}</label>
                            <input type="text" name="description[]" class="form-control" placeholder="{{__("label.description_here")}}">
                        </div>
                        <div class="form-group col-xl-3 col-md-6">
                            <label>{{__("label.image")}}<span class="text-danger">*</span></label>
                            <input type="file" name="image[]" class="form-control import-file on_boarding_img" id="on_boarding_img_${i}" accept=".png, .jpg, .jpeg">
                            <input type="hidden" name="old_image[]" value="">
                        </div>
                        <div class="form-group col-xl-1 col-md-4">
                            <div class="custom-file">
                                <img src="{{asset("assets/imgs/upload_img.png")}}" style="height: 90px; width: 90px;" class="img-thumbnail" id="link_img_on_boarding_img_${i}">
                            </div>
                        </div>
                        <div class="col-md-1 mt-2">
                            <div class="flex-grow-1 px-5 d-inline-flex">
                                <div class="change mr-3 mt-4" id="add_btn">
                                    <a class="btn btn-danger add-more text-white remove_on_boarding">-</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>`;

            $('.after-add-more-on-boarding').append(data);
            i--;
            $("html, body").animate({ scrollTop: $(document).height() }, "slow");
        }
        $("body").on("click", ".remove_on_boarding", function(e) {
            $(this).parents('.onboarding_part').remove();
        });
        function onboarding_screen_setting() {

            var Demo_Mode = '<?php echo Demo_Mode(); ?>';
            if(Demo_Mode == 1){

                $("#dvloader").show();
                var formData = new FormData($("#onboarding_screen_setting")[0]);
                $.ajax({
                    type: 'POST',
                    url: '{{ route("app.setting.onboarding_screen") }}',
                    data: formData,
                    cache: false,
                    contentType: false,
                    processData: false,
                    success: function(resp) {
                        $("#dvloader").hide();
                        get_responce_message(resp, 'onboarding_screen_setting', '{{ route("app.setting") }}');
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                        $("#dvloader").hide();
                        toastr.error(errorThrown, textStatus);
                    }
                });
            } else {
                showError();
            }
        }

        // Social Link
        var i = -1;
        function add_more_link(){

            var data = `
                <div class="social_part">
                    <div class="row col-12">
                        <div class="form-group col-xl-3 col-md-6">
                            <label>{{__("label.name")}}<span class="text-danger">*</span></label>
                            <input type="text" name="name[]" class="form-control" placeholder="{{__("label.name_here")}}">
                        </div>
                        <div class="form-group col-xl-3 col-md-6">
                            <label>{{__("label.url")}}<span class="text-danger">*</span></label>
                            <input type="url" name="url[]" class="form-control" placeholder="{{__("label.url_here")}}">
                        </div>
                        <div class="form-group col-xl-3 col-md-6">
                            <label>{{__("label.icon")}}<span class="text-danger">*</span></label>
                            <input type="file" name="image[]" class="form-control import-file social_img" id="social_img_${i}" accept=".png, .jpg, .jpeg">
                            <input type="hidden" name="old_image[]" value="">
                        </div>
                        <div class="form-group col-xl-1 col-md-3">
                            <div class="custom-file">
                                <img src="{{asset("assets/imgs/upload_img.png")}}" style="height: 90px; width: 90px;" class="img-thumbnail" id="link_img_social_img_${i}">
                            </div>
                        </div>
                        <div class="col-xl-1 col-md-3 mt-2">
                            <div class="flex-grow-1 px-5 d-inline-flex">
                                <div class="change mr-3 mt-4" id="add_btn">
                                    <a class="btn btn-danger add-more text-white remove_link">-</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>`;

            $('.after-add-more').append(data);
            i--;
            $("html, body").animate({ scrollTop: $(document).height() }, "slow");
        }
        $("body").on("click", ".remove_link", function(e) {
            $(this).parents('.social_part').remove();
        });
        function social_link_setting() {

            var Demo_Mode = '<?php echo Demo_Mode(); ?>';
            if(Demo_Mode == 1){

                var formData = new FormData($("#social_link_setting")[0]);
                $("#dvloader").show();
                $.ajax({
                    type: 'POST',
                    url: '{{ route("app.setting.social_link") }}',
                    data: formData,
                    cache: false,
                    contentType: false,
                    processData: false,
                    success: function(resp) {
                        $("#dvloader").hide();
                        get_responce_message(resp, 'social_link_setting', '{{ route("app.setting") }}');
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                        $("#dvloader").hide();
                        toastr.error(errorThrown, textStatus);
                    }
                });
            } else {
                showError();
            }
        }
    </script>
@endsection