@extends('layouts.app')

@section('title', __('vetPortal::lang.portal_settings'))

@section('content')
<section class="content-header">
    <h1><i class="fas fa-globe"></i> @lang('vetPortal::lang.portal_settings')
        <small>Public pet-owner portal</small>
    </h1>
</section>

<section class="content">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            @component('components.widget', ['class' => 'box-primary'])
                <div class="callout callout-info" style="font-size:12.5px;">
                    <i class="fa fa-info-circle"></i> Public portal URL:
                    <strong><a href="{{ url('portal') }}" target="_blank">{{ url('portal') }}</a></strong>
                    — pet owners log in there with the accounts you create under
                    <a href="{{ route('vp.accounts.index') }}">Portal Accounts</a>.
                </div>

                <form method="POST" action="{{ route('vp.settings.save') }}" enctype="multipart/form-data">
                    @csrf
                    <div class="form-group" style="padding:8px 0;">
                        <label>
                            <input type="checkbox" name="enabled" value="1" {{ $settings->enabled ? 'checked' : '' }}>
                            @lang('vetPortal::lang.enabled')
                        </label>
                        <small class="text-muted" style="display:block;">When off, pet owners cannot log in.</small>
                    </div>

                    <div class="row">
                        <div class="col-md-6 form-group">
                            <label>@lang('vetPortal::lang.clinic_name')</label>
                            <input type="text" name="clinic_name" class="form-control"
                                   value="{{ $settings->clinic_name }}" placeholder="e.g. Happy Paws Veterinary Clinic">
                        </div>
                        <div class="col-md-3 form-group">
                            <label>@lang('vetPortal::lang.primary_color')</label>
                            <input type="color" name="primary_color" class="form-control"
                                   value="{{ $settings->primary_color ?: '#2563eb' }}" style="height:34px;padding:2px;">
                        </div>
                        <div class="col-md-3 form-group">
                            <label>@lang('vetPortal::lang.logo')</label>
                            <input type="file" name="logo" accept="image/*">
                            @if($settings->logo_path)
                                <small class="text-success">A logo is set.</small>
                            @endif
                        </div>
                    </div>

                    <div class="form-group">
                        <label>@lang('vetPortal::lang.welcome_text')</label>
                        <textarea name="welcome_text" class="form-control" rows="2"
                                  placeholder="Shown on the portal dashboard.">{{ $settings->welcome_text }}</textarea>
                    </div>

                    <div class="row">
                        <div class="col-md-4 form-group">
                            <label>@lang('vetPortal::lang.whatsapp_number')</label>
                            <input type="text" name="whatsapp_number" class="form-control"
                                   value="{{ $settings->whatsapp_number }}" placeholder="+20...">
                            <small class="text-muted">Adds a "Contact on WhatsApp" button.</small>
                        </div>
                        <div class="col-md-4 form-group">
                            <label>@lang('vetPortal::lang.portal_slug')</label>
                            <input type="text" name="portal_slug" class="form-control"
                                   value="{{ $settings->portal_slug }}" placeholder="happy-paws">
                            <small class="text-muted">For a future per-clinic URL.</small>
                        </div>
                        <div class="col-md-4 form-group">
                            <label>@lang('vetPortal::lang.custom_domain')</label>
                            <input type="text" name="custom_domain" class="form-control"
                                   value="{{ $settings->custom_domain }}" placeholder="portal.yourclinic.com">
                            <small class="text-muted">Requires DNS / server setup.</small>
                        </div>
                    </div>

                    <div class="form-group">
                        <button type="submit" class="btn btn-primary"><i class="fa fa-save"></i> @lang('vetPortal::lang.saved')</button>
                    </div>
                </form>
            @endcomponent
        </div>
    </div>
</section>
@endsection
