@extends('layouts.app')
@section('title', 'Settings - NGBVD')
@section('content')
<div class="ngbvd-page-header mb-3">
    <div>
        <span class="ngbvd-kicker">Administration</span>
        <h2 class="ngbvd-page-title">System Settings</h2>
        <p class="ngbvd-page-subtitle">Manage ministry details and personalize your NGBVD workspace theme.</p>
    </div>
</div>

<div class="row">
    <div class="col-lg-8">
        <div class="card ngbvd-form-card">
            <div class="card-block">
                <h4 class="ngbvd-section-title">Ministry / System Information</h4>
                @foreach($company as $item)
                <form method="POST" action="{{ route('/settings/update') }}">
                    @csrf
                    <div class="row">
                        <div class="col-md-6 form-group"><label>Organization Name</label><input class="form-control" name="name" value="{{ $item->name }}"></div>
                        <div class="col-md-6 form-group"><label>Application Name</label><input class="form-control" name="appname" value="{{ $item->appname }}"></div>
                        <div class="col-md-6 form-group"><label>Contact Person</label><input class="form-control" name="contactperson" value="{{ $item->contactperson }}"></div>
                        <div class="col-md-6 form-group"><label>Contact Phone</label><input class="form-control" name="phone" value="{{ $item->phone }}"></div>
                        <div class="col-md-6 form-group"><label>Contact E-mail</label><input class="form-control" name="email" value="{{ $item->email }}"></div>
                        <div class="col-md-6 form-group"><label>Address</label><input class="form-control" name="address" value="{{ $item->address }}"></div>
                        <div class="col-md-12 form-group"><label>Description</label><textarea class="form-control" rows="6" name="details">{{ $item->details }}</textarea></div>
                    </div>
                    <div class="text-right"><button class="btn ngbvd-btn-primary">Update Settings</button></div>
                </form>
                @endforeach
            </div>
        </div>
    </div>
    <div class="col-lg-4">
        <div class="card ngbvd-form-card ngbvd-theme-panel">
            <div class="card-block">
                <h4 class="ngbvd-section-title">My Theme Customization</h4>
                <p class="text-muted">Choose a standard template or personalize your workspace colors. This applies only to your account.</p>
                <form method="POST" action="{{ route('/settings/theme') }}">
                    @csrf
                    <div class="form-group">
                        <label>Standard Theme Template</label>
                        <select class="form-control" name="theme_template" data-no-selectize="true">
                            @foreach($themeTemplates as $key => $template)
                                <option value="{{ $key }}">{{ $template['name'] }}</option>
                            @endforeach
                        </select>
                    </div>
                    @foreach(['primary'=>'Primary / Action Color','sidebar'=>'Sidebar Color','topbar'=>'Topbar Color','background'=>'Page Background','surface'=>'Card Surface'] as $field => $label)
                        <div class="form-group ngbvd-color-row">
                            <label>{{ $label }}</label>
                            <input type="color" name="{{ $field }}" class="form-control" value="{{ $theme[$field] ?? '#ffffff' }}">
                        </div>
                    @endforeach
                    <button class="btn ngbvd-btn-primary btn-block">Apply My Theme</button>
                </form>
                <form method="POST" action="{{ route('/settings/theme/reset') }}" class="mt-2">
                    @csrf
                    <button class="btn ngbvd-btn-soft btn-block" type="submit">Reset to Default Theme</button>
                </form>
            </div>
        </div>
    </div>
</div>
@endsection
