<?php

/**
 * @var array<int, string> $errors
 * @var array $form
 */

?>
<div class="app-details-container">
  <section>
    <?php
    $breadcrumbs = [
      ['label' => t('Home'), 'path' => 'admin'],
      ['label' => t('Tenants'), 'path' => 'admin/tenants'],
      ['label' => t('Create tenant')],
    ];
    require templatePath('partials/app-breadcrumb.phtml');
    $titlebar = [
      'title' => t('Create tenant'),
      'backHref' => 'admin/tenants',
      'backTitle' => t('Cancel'),
      'actions' => [
        [
          'form' => 'tenant-form',
          'name' => 'action',
          'value' => 'create',
          'class' => 'secondary outline',
          'label' => t('Create'),
        ],
        [
          'form' => 'tenant-form',
          'name' => 'action',
          'value' => 'create_close',
          'class' => 'primary',
          'label' => t('Create & close'),
        ],
      ],
    ];
    require templatePath('partials/app-details-titlebar.phtml');
    ?>
    <?php if (!empty($errors)): ?>
      <div class="notice" data-variant="error">
        <ul>
          <?php foreach ($errors as $error): ?>
            <li><?php e($error); ?></li>
          <?php endforeach; ?>
        </ul>
      </div>
    <?php endif; ?>
    <?php
    $values = $form ?? [];
    $detailsOpenAll = true;
    $showCustomFieldsTab = can('custom_fields.manage');
    $showSsoTab = can('tenants.sso_manage');
    $customFieldTenantUuid = '';
    $customFieldDefinitions = [];
    require __DIR__ . '/_form.phtml';
    ?>
  </section>
</div>
