@extends('adminlte::page')

@section('title', 'Site Settings')

@section('content_header')
    <h1>Site Settings</h1>
@stop

@section('content')
    <div class="card">
        <div class="card-body">
            <form action="{{ route('admin.settings.update') }}" method="POST">
                @csrf
                @method('PATCH')

                <div class="row">
                    <div class="col-md-6 form-group mb-3">
                        <label>Site Name</label>
                        <input type="text" name="site_name" class="form-control" value="{{ old('site_name', $settings['site_name'] ?? 'Home Heaven Decors PK') }}">
                    </div>
                    <div class="col-md-6 form-group mb-3">
                        <label>Tagline</label>
                        <input type="text" name="site_tagline" class="form-control" value="{{ old('site_tagline', $settings['site_tagline'] ?? '') }}">
                    </div>
                    <div class="col-md-6 form-group mb-3">
                        <label>Contact Email</label>
                        <input type="email" name="contact_email" class="form-control" value="{{ old('contact_email', $settings['contact_email'] ?? '') }}">
                    </div>
                    <div class="col-md-6 form-group mb-3">
                        <label>Contact Phone</label>
                        <input type="text" name="contact_phone" class="form-control" value="{{ old('contact_phone', $settings['contact_phone'] ?? '') }}">
                    </div>
                    <div class="col-12 form-group mb-3">
                        <label>Address</label>
                        <textarea name="address" rows="2" class="form-control">{{ old('address', $settings['address'] ?? '') }}</textarea>
                    </div>
                    <div class="col-md-6 form-group mb-3">
                        <label>Facebook URL</label>
                        <input type="url" name="facebook_url" class="form-control" value="{{ old('facebook_url', $settings['facebook_url'] ?? '') }}">
                    </div>
                    <div class="col-md-6 form-group mb-3">
                        <label>Instagram URL</label>
                        <input type="url" name="instagram_url" class="form-control" value="{{ old('instagram_url', $settings['instagram_url'] ?? '') }}">
                    </div>
                    <div class="col-md-6 form-group mb-3">
                        <label>Default Shipping Fee (Rs.)</label>
                        <input type="number" step="0.01" name="shipping_fee" class="form-control" value="{{ old('shipping_fee', $settings['shipping_fee'] ?? 0) }}">
                    </div>
                    <div class="col-md-6 form-group mb-3">
                        <label>Free Shipping Threshold (Rs.)</label>
                        <input type="number" step="0.01" name="free_shipping_threshold" class="form-control" value="{{ old('free_shipping_threshold', $settings['free_shipping_threshold'] ?? 5000) }}">
                        <small class="text-muted">Orders with a subtotal at or above this amount ship free. Set to 0 to disable.</small>
                    </div>
                </div>

                <button type="submit" class="btn btn-primary btn-sm">Save Settings</button>
            </form>
        </div>
    </div>
@stop
