<?php

namespace GriffinForms\Admin\Html\Modals;

class ColumnManager
{
    public function html(): void
    {
        ?>
        <div class="modal fade" id="gf-column-manager-modal" tabindex="-1"
             aria-labelledby="gf-column-manager-label" aria-hidden="true">
          <div class="modal-dialog modal-dialog-scrollable modal-md">
            <div class="modal-content">

              <div class="modal-header border-0">
                <h6 class="modal-title" id="gf-column-manager-label">
                  <?php echo esc_html__('Manage Columns', 'griffinforms-form-builder'); ?>
                </h6>
                <button type="button" class="btn-close" data-bs-dismiss="modal"
                        aria-label="<?php esc_attr_e('Close', 'griffinforms-form-builder'); ?>"></button>
              </div>

              <div class="modal-body">

                <div id="gf-col-crowding-warning" class="gf-notice gf-notice-warning d-none mb-3" role="alert">
                  <?php echo esc_html__('Showing many columns can make the table difficult to read. Consider hiding columns you use less often.', 'griffinforms-form-builder'); ?>
                </div>

                <ul id="gf-col-list" class="list-group list-group-flush gf-col-sortable">
                  <!-- JS inserts rows here -->
                </ul>

                <hr class="my-3">

                <div class="d-flex align-items-center gap-2">
                  <label for="gf-list-size" class="form-label mb-0 text-nowrap fw-semibold small">
                    <?php echo esc_html__('Items per page', 'griffinforms-form-builder'); ?>
                  </label>
                  <select id="gf-list-size" class="form-select form-select-sm w-auto">
                    <!-- JS populates -->
                  </select>
                </div>

              </div>

              <div class="modal-footer justify-content-between border-0 mt-3">
                <button type="button" class="button-link gf-col-reset-btn">
                  <?php echo esc_html__('Reset to defaults', 'griffinforms-form-builder'); ?>
                </button>
                <div class="d-flex gap-2">
                  <button type="button" class="button" data-bs-dismiss="modal">
                    <?php echo esc_html__('Cancel', 'griffinforms-form-builder'); ?>
                  </button>
                  <button type="button" class="button button-primary gf-col-save-btn">
                    <?php echo esc_html__('Save', 'griffinforms-form-builder'); ?>
                  </button>
                </div>
              </div>

            </div>
          </div>
        </div>
        <?php
    }
}
