<?php
// admin/dienstleistungen-einstellungen.php
if (!defined('ABSPATH')) {
    exit;
}

simpbook_display_trial_notice_on_admin_pages();
?>
<div class="wrap">
    <h1><?php esc_html_e('Services - Settings', 'simple-appointment-booking'); ?></h1>

    <?php if (isset($_GET['simpbook_nachricht']) && $_GET['simpbook_nachricht'] === 'gespeichert') : // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>
        <div class="notice notice-success is-dismissible">
            <p><?php esc_html_e('Settings saved.', 'simple-appointment-booking'); ?></p>
        </div>
    <?php endif; ?>

    <form method="post" action="">
        <?php wp_nonce_field('simpbook_dienstleistungen_einstellungen'); ?>

        <div class="simpbook-settings-grid">
            <div class="simpbook-setting-card">
                <h3><?php esc_html_e('Show Service Duration', 'simple-appointment-booking'); ?></h3>
                <div>
                    <label for="simpbook_dauer_anzeigen">
                        <input name="simpbook_dauer_anzeigen" type="checkbox" id="simpbook_dauer_anzeigen" value="1" <?php checked(get_option('simpbook_dauer_anzeigen', '1'), '1'); ?>>
                        <?php esc_html_e('Display service duration in frontend booking form', 'simple-appointment-booking'); ?>
                    </label>
                    <p class="description"><?php esc_html_e('When enabled, the duration of each service will be displayed in the booking form.', 'simple-appointment-booking'); ?></p>
                </div>
            </div>
            <div class="simpbook-setting-card">
                <h3>
                    <?php esc_html_e('Booking Options', 'simple-appointment-booking'); ?>
                    <span class="simpbook-tooltip" style="display: inline-block; margin-left: 6px; width: 18px; height: 18px; background: #2271b1; color: #fff; border-radius: 50%; text-align: center; line-height: 18px; font-size: 12px; font-weight: bold; cursor: default; vertical-align: middle;" title="<?php esc_attr_e('Allows setting different bookable time options with individual prices for services – e.g. 1 hour, 2 hours, full day. Options are managed globally under Services → Options. In the service modal, you can then set individual prices per option for each service.', 'simple-appointment-booking'); ?>">?</span>
                </h3>
                <div>
                    <label for="simpbook_buchungsoptionen_aktiv">
                        <input name="simpbook_buchungsoptionen_aktiv" type="checkbox" id="simpbook_buchungsoptionen_aktiv" value="1" <?php checked(get_option('simpbook_buchungsoptionen_aktiv', '0'), '1'); ?>>
                        <?php esc_html_e('Enable booking options', 'simple-appointment-booking'); ?>
                    </label>
                    <p class="description"><?php esc_html_e('When enabled, flexible booking options (e.g. 1 hr. / 2 hrs. / Full Day) replace the fixed duration and price fields in the service modal. Each booking option can have its own price per service.', 'simple-appointment-booking'); ?></p>
                </div>
            </div>
        </div>

        <p class="submit">
            <button type="submit" name="simpbook_dienstleistungen_einstellungen_submit" class="button button-primary">
                <?php esc_html_e('Save Settings', 'simple-appointment-booking'); ?>
            </button>
        </p>
    </form>
</div>
