<?php
/**
 * ITSWEBER CMS – Page Builder Admin Form: Rating Highlight
 * Loaded via AJAX into section cards.
 * Migrated from plugins/rating-highlight-section.
 *
 * @author  Benny Weber
 * @copyright ITSWEBER, www.itsweber.de
 *
 * @var array $data    Decoded JSON content
 * @var array $section DB row (id, section_type, instance_label, ...)
 */
?>

<?php admin_field_grid_open(2) ?>
    <?php admin_field('text', 'title', __('admin.section.heading'), $data['title'] ?? '', [
        'placeholder' => __('admin.section.rating_ph_title'), 'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('text', 'subtitle', __('admin.section.subtitle'), $data['subtitle'] ?? '', [
        'placeholder' => __('admin.section.rating_ph_subtitle'), 'wrap_style' => 'margin:0;',
    ]) ?>
<?php admin_field_grid_close() ?>

<?php admin_field_grid_open(2) ?>
    <?php admin_field('text', 'source_name', __('admin.section.rating_source_label'), $data['source_name'] ?? '', [
        'placeholder' => __('admin.section.rating_ph_source'), 'required' => true, 'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('text', 'score', __('admin.section.rating_score_label'), $data['score'] ?? '', [
        'placeholder' => __('admin.section.rating_ph_score'), 'required' => true, 'hint' => __('admin.section.rating_score_hint'), 'wrap_style' => 'margin:0;',
    ]) ?>
<?php admin_field_grid_close() ?>

<?php admin_field_grid_open(2) ?>
    <?php admin_field('text', 'max_score', __('admin.section.rating_max_label'), $data['max_score'] ?? '5', [
        'placeholder' => '5', 'hint' => __('admin.section.rating_max_hint'), 'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('text', 'review_count', __('admin.section.rating_count_label'), $data['review_count'] ?? '', [
        'placeholder' => __('admin.section.rating_ph_count'), 'wrap_style' => 'margin:0;',
    ]) ?>
<?php admin_field_grid_close() ?>

<?php admin_field('text', 'review_label', __('admin.section.rating_reviews_label'), $data['review_label'] ?? '', [
    'placeholder' => __('admin.section.rating_ph_reviews'),
    'hint'        => __('admin.section.rating_reviews_hint'),
]) ?>

<?php admin_field('textarea', 'summary_text', __('admin.section.rating_summary_label'), $data['summary_text'] ?? '', [
    'placeholder' => __('admin.section.rating_ph_summary1'), 'rows' => 4,
]) ?>

<?php admin_field('textarea', 'summary_text_2', __('admin.section.rating_summary2_label'), $data['summary_text_2'] ?? '', [
    'placeholder' => __('admin.section.rating_ph_summary2'), 'rows' => 4,
]) ?>

<?php admin_field_grid_open(2) ?>
    <?php admin_field('text', 'as_of_date', __('admin.section.rating_date_label'), $data['as_of_date'] ?? '', [
        'placeholder' => __('admin.section.rating_ph_date'), 'wrap_style' => 'margin:0;',
    ]) ?>
    <?php admin_field('text', 'link_url', __('admin.section.link_url'), $data['link_url'] ?? '', [
        'placeholder' => __('admin.section.rating_ph_url'), 'hint' => __('admin.section.rating_url_hint'), 'wrap_style' => 'margin:0;',
    ]) ?>
<?php admin_field_grid_close() ?>

<?php admin_field('text', 'link_label', __('admin.section.rating_link_label'), $data['link_label'] ?? '', [
    'placeholder' => __('admin.section.rating_ph_cta'),
]) ?>

<?php admin_section_separator() ?>

<?php admin_field_grid_open(2) ?>
    <?php admin_color_scheme_field($data['color_scheme'] ?? '') ?>
    <?php render_section_text_color_field($data) ?>
<?php admin_field_grid_close() ?>
