@extends('admin.layouts.app')
@section('panel')
    <div class="row mb-none-30">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-header">
                    <h6>@lang('Insert Sitemap XML')</h6>
                </div>
                <form method="post" action="{{ route('admin.setting.sitemap.submit') }}">
                    @csrf
                    <div class="card-body">
                        <div class="form-group custom-css">
                            <textarea class="form-control sitemapEditor" rows="10" name="sitemap">{{ $fileContent }}</textarea>
                        </div>
                    </div>
                    @can('admin.setting.sitemap.submit')
                        <div class="card-footer">
                            <button type="submit" class="btn btn--primary w-100 h-45">@lang('Submit')</button>
                        </div>
                    @endcan
                </form>
            </div>
        </div>
    </div>
@endsection
@push('style')
    <style>
        .CodeMirror {
            border-top: 1px solid #eee;
            border-bottom: 1px solid #eee;
            line-height: 1.3;
            height: 500px;
        }

        .CodeMirror-linenumbers {
            padding: 0 8px;
        }

        .custom-css p,
        .custom-css li,
        .custom-css span {
            color: white;
        }
    </style>
@endpush
@push('style-lib')
    <link rel="stylesheet" href="{{ asset('assets/admin/css/codemirror.min.css') }}">
    <link rel="stylesheet" href="{{ asset('assets/admin/css/monokai.min.css') }}">
@endpush
@push('script-lib')
    <script src="{{ asset('assets/admin/js/codemirror.min.js') }}"></script>
    <script src="{{ asset('assets/admin/js/xml.js') }}"></script>
    <script src="{{ asset('assets/admin/js/sublime.min.js') }}"></script>
@endpush
@push('script')
    <script>
        "use strict";
        var editor = CodeMirror.fromTextArea(document.getElementsByClassName("sitemapEditor")[0], {
            lineNumbers: true,
            mode: "text/xml",
            theme: "monokai",
            keyMap: "sublime",
            showCursorWhenSelecting: true,
        });
    </script>
@endpush
