<?php

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



?>
<div class="app-details-container">

  <section>
    <?php
    $breadcrumbs = [
      ['label' => t('Home'), 'path' => 'admin'],
      ['label' => t('Users'), 'path' => 'admin/users'],
      ['label' => t('Create user')],
    ];
    require templatePath('partials/app-breadcrumb.phtml');
    $titlebar = [
      'title' => t('Create user'),
      'backHref' => 'admin/users',
      'backTitle' => t('Cancel'),
      'actions' => [
        [
          'form' => 'user-form',
          'name' => 'action',
          'value' => 'create',
          'class' => 'secondary outline',
          'label' => t('Create'),
        ],
        [
          'form' => 'user-form',
          'name' => 'action',
          'value' => 'create_close',
          'class' => 'primary',
          'label' => t('Create & close'),
        ],
      ],
    ];
    require templatePath('partials/app-details-titlebar.phtml');
    ?>
    <?php
    $validationSummaryErrors = $validationSummaryErrors ?? ($errors ?? []);
    require templatePath('partials/app-details-validation-summary.phtml');
    ?>
    <?php
    $values = $form ?? [];
    $passwordRequired = true;
    $detailsOpenAll = true;
    $passwordLabel = t('Password');
    $passwordLegend = t('Password');
    $passwordConfirmLabel = t('Password (again)');
    $pageAuth = is_array($viewAuth['page'] ?? null) ? $viewAuth['page'] : [];
    $showTenants = (bool) ($pageAuth['can_manage_assignments'] ?? false);
    $showRoles = $showTenants;
    $showDepartments = $showTenants;
    $tenants = $tenants ?? [];
    $roles = $roles ?? [];
    $selectedTenantIds = $selectedTenantIds ?? [];
    $selectedRoleIds = $selectedRoleIds ?? [];
    $selectedDepartmentIds = $selectedDepartmentIds ?? [];
    $departmentOptionsByTenant = $departmentOptionsByTenant ?? [];
    $showCustomFieldsTab = true;
    $canEditCustomFieldValues = (bool) ($pageAuth['can_edit_custom_field_values'] ?? false);
    $customFieldDefinitionsByTenant = $customFieldDefinitionsByTenant ?? [];
    $customFieldValueMap = $customFieldValueMap ?? [];
    $customFieldPostedValues = $customFieldPostedValues ?? [];
    $passwordMinLength = $passwordMinLength ?? 12;
    $passwordHints = $passwordHints ?? [];
    require __DIR__ . '/_form.phtml';
    ?>
  </section>
</div>
