@extends('layouts.app')
@section('title', __('clinicSite::lang.dashboard'))

@section('content')
<section class="content-header">
    <h1><i class="fas fa-globe"></i> {{ __('clinicSite::lang.website_cms') }}
        <small>Manage your clinic's public website</small></h1>
</section>

<section class="content">
    @include('clinicSite::admin._flash')

    <div class="row">
        <div class="col-md-12">
            @component('components.widget', ['class' => 'box-primary'])
                <div class="row" style="align-items:center;">
                    <div class="col-md-8">
                        <h3 style="margin-top:0;">{{ $site->name ?: 'Your clinic website' }}</h3>
                        <p>
                            Status:
                            @if($site->isPublished())
                                <span class="label label-success">Published &amp; live</span>
                            @elseif($site->enabled)
                                <span class="label label-warning">Enabled (draft)</span>
                            @else
                                <span class="label label-default">Offline</span>
                            @endif
                            &nbsp; Theme: <strong>{{ $site->themeMeta()['name'] }}</strong>
                        </p>
                        @if($site->subdomain_slug && config('clinicsite.base_domain'))
                            <p><i class="fas fa-link"></i>
                                <a href="//{{ $site->subdomain_slug }}.{{ config('clinicsite.base_domain') }}" target="_blank">
                                    {{ $site->subdomain_slug }}.{{ config('clinicsite.base_domain') }}</a></p>
                        @endif
                        @if($site->custom_domain)
                            <p><i class="fas fa-globe"></i>
                                <a href="//{{ $site->custom_domain }}" target="_blank">{{ $site->custom_domain }}</a>
                                @if(!$site->custom_domain_verified)<span class="label label-warning">DNS pending</span>@endif</p>
                        @endif
                    </div>
                    <div class="col-md-4 text-right">
                        <a href="{{ route('cs.preview') }}" target="_blank" class="btn btn-default"><i class="fas fa-eye"></i> Preview</a>
                        <a href="{{ route('cs.pages') }}" class="btn btn-primary"><i class="fas fa-pen"></i> Edit content</a>
                    </div>
                </div>
            @endcomponent
        </div>
    </div>

    <div class="row">
        <div class="col-md-3 col-sm-6">
            <div class="info-box"><span class="info-box-icon bg-aqua"><i class="fas fa-file-lines"></i></span>
                <div class="info-box-content"><span class="info-box-text">Pages</span>
                    <span class="info-box-number">{{ $stats['pages'] }}</span></div></div>
        </div>
        <div class="col-md-3 col-sm-6">
            <div class="info-box"><span class="info-box-icon bg-green"><i class="fas fa-envelope"></i></span>
                <div class="info-box-content"><span class="info-box-text">Messages</span>
                    <span class="info-box-number">{{ $stats['messages'] }}</span></div></div>
        </div>
        <div class="col-md-3 col-sm-6">
            <div class="info-box"><span class="info-box-icon bg-yellow"><i class="fas fa-bell"></i></span>
                <div class="info-box-content"><span class="info-box-text">Unread</span>
                    <span class="info-box-number">{{ $stats['unread'] }}</span></div></div>
        </div>
        <div class="col-md-3 col-sm-6">
            <div class="info-box"><span class="info-box-icon bg-purple"><i class="fas fa-palette"></i></span>
                <div class="info-box-content"><span class="info-box-text">Theme</span>
                    <span class="info-box-number" style="font-size:18px;">{{ $site->themeMeta()['name'] }}</span></div></div>
        </div>
    </div>

    <div class="row">
        <div class="col-md-12">
            @component('components.widget', ['title' => 'Quick actions'])
                <div class="row">
                    @php($links = [
                        ['cs.pages','fas fa-file-lines','Pages','Add & edit pages and sections'],
                        ['cs.theme','fas fa-palette','Theme & Design','Switch theme, colours & fonts'],
                        ['cs.media','fas fa-images','Media','Upload images & logos'],
                        ['cs.navigation','fas fa-bars','Navigation','Order your menu'],
                        ['cs.messages','fas fa-inbox','Messages','Contact-form leads'],
                        ['cs.domain','fas fa-link','Domain & SEO','Subdomain / custom domain'],
                        ['cs.settings','fas fa-gear','Settings','Branding, contact & hours'],
                    ])
                    @foreach($links as $l)
                        <div class="col-md-3 col-sm-6" style="margin-bottom:12px;">
                            <a href="{{ route($l[0]) }}" class="btn btn-block btn-default text-left" style="height:auto;padding:14px;white-space:normal;">
                                <i class="{{ $l[1] }}" style="font-size:18px;color:#3c8dbc;"></i>
                                <strong style="display:block;margin-top:6px;">{{ $l[2] }}</strong>
                                <small class="text-muted">{{ $l[3] }}</small>
                            </a>
                        </div>
                    @endforeach
                </div>
            @endcomponent
        </div>
    </div>
</section>
@endsection
