Install: Admin Add Language selector + set timezone by server

This commit is contained in:
Thomas Ingles 2024-04-30 17:21:20 +02:00 committed by Alex Tselegidis
parent a04c0cafdf
commit 80ada71558
3 changed files with 19 additions and 1 deletions

View file

@ -67,7 +67,7 @@ class Installation extends EA_Controller
$this->instance->migrate(); $this->instance->migrate();
// Insert admin // Insert admin
$admin['timezone'] = 'UTC'; $admin['timezone'] = date_default_timezone_get();
$admin['settings']['username'] = $admin['username']; $admin['settings']['username'] = $admin['username'];
$admin['settings']['password'] = $admin['password']; $admin['settings']['password'] = $admin['password'];
$admin['settings']['notifications'] = true; $admin['settings']['notifications'] = true;
@ -79,6 +79,7 @@ class Installation extends EA_Controller
'user_id' => $admin['id'], 'user_id' => $admin['id'],
'user_email' => $admin['email'], 'user_email' => $admin['email'],
'role_slug' => DB_SLUG_ADMIN, 'role_slug' => DB_SLUG_ADMIN,
'language' => $admin['language'],
'timezone' => $admin['timezone'], 'timezone' => $admin['timezone'],
'username' => $admin['settings']['username'], 'username' => $admin['settings']['username'],
]); ]);

View file

@ -101,6 +101,21 @@
<input type="password" id="password-confirm" class="form-control required" maxlength="512"> <input type="password" id="password-confirm" class="form-control required" maxlength="512">
</div> </div>
<div class="mb-3">
<label class="form-label" for="language">
<?= lang('language') ?>
<span class="text-danger">*</span>
</label>
<select id="language" class="form-control required">
<?php $config_lang = config('language');
foreach (vars('available_languages') as $lang): ?>
<option value="<?= $lang ?>"<?= ($lang == $config_lang ?' selected':'') ?>>
<?= ucfirst($lang) ?>
</option>
<?php endforeach; ?>
</select>
</div>
</div> </div>
<div class="company-settings col-12 col-sm-5"> <div class="company-settings col-12 col-sm-5">

View file

@ -26,6 +26,7 @@ App.Pages.Installation = (function () {
const $username = $('#username'); const $username = $('#username');
const $password = $('#password'); const $password = $('#password');
const $passwordConfirm = $('#password-confirm'); const $passwordConfirm = $('#password-confirm');
const $language = $('#language');
const $companyName = $('#company-name'); const $companyName = $('#company-name');
const $companyEmail = $('#company-email'); const $companyEmail = $('#company-email');
const $companyLink = $('#company-link'); const $companyLink = $('#company-link');
@ -145,6 +146,7 @@ App.Pages.Installation = (function () {
phone_number: $phoneNumber.val(), phone_number: $phoneNumber.val(),
username: $username.val(), username: $username.val(),
password: $password.val(), password: $password.val(),
language: $language.val(),
}; };
} }