Adjusted required customer fields based on booking to the customers page

This commit is contained in:
Alex Tselegidis 2022-01-05 08:27:16 +01:00
parent 6ed5c8793e
commit d4005bd378
2 changed files with 67 additions and 23 deletions

View file

@ -49,16 +49,30 @@ class Customers extends EA_Controller {
abort(403, 'Forbidden');
}
$user_id = session('user_id');
$user_id = session('user_id');#
$role_slug = session('role_slug');
$require_first_name = setting('require_first_name');
$require_last_name = setting('require_last_name');
$require_email = setting('require_email');
$require_phone_number = setting('require_phone_number');
$require_address = setting('require_address');
$require_city = setting('require_city');
$require_zip_code = setting('require_zip_code');
html_vars([
'page_title' => lang('customers'),
'active_menu' => PRIV_CUSTOMERS,
'user_display_name' => $this->accounts->get_user_display_name($user_id),
'timezones' => $this->timezones->to_array(),
'timezones' => $this->timezones->to_grouped_array(),
'privileges' => $this->roles_model->get_permissions_by_slug($role_slug),
'require_first_name' => $require_first_name,
'require_last_name' => $require_last_name,
'require_email' => $require_email,
'require_phone_number' => $require_phone_number,
'require_address' => $require_address,
'require_city' => $require_city,
'require_zip_code' => $require_zip_code,
]);
$this->load->view('pages/customers', html_vars());

View file

@ -2,6 +2,13 @@
/**
* @var string $timezones
* @var array $privileges
* @var array $require_first_name
* @var array $require_last_name
* @var array $require_email
* @var array $require_phone_number
* @var array $require_address
* @var array $require_city
* @var array $require_zip_code
*/
?>
@ -81,57 +88,80 @@
<div id="form-message" class="alert" style="display:none;"></div>
<div class="mb-3">
<label class="form-label" for="first-name">
<label for="first-name" class="form-label">
<?= lang('first_name') ?>
<?php if ($require_first_name): ?>
<span class="text-danger">*</span>
<?php endif ?>
</label>
<input id="first-name" class="form-control required">
<input type="text" id="first-name"
class="<?= $require_first_name ? 'required' : '' ?> form-control" maxlength="100"/>
</div>
<div class="mb-3">
<label class="form-label" for="last-name">
<label for="last-name" class="form-label">
<?= lang('last_name') ?>
<?php if ($require_last_name): ?>
<span class="text-danger">*</span>
<?php endif ?>
</label>
<input id="last-name" class="form-control required">
<input type="text" id="last-name"
class="<?= $require_last_name ? 'required' : '' ?> form-control" maxlength="120"/>
</div>
<div class="mb-3">
<label class="form-label" for="email">
<label for="email" class="form-label">
<?= lang('email') ?>
<?php if ($require_email): ?>
<span class="text-danger">*</span>
<?php endif ?>
</label>
<input id="email" class="form-control required">
<input type="text" id="email"
class="<?= $require_email ? 'required' : '' ?> form-control" maxlength="120"/>
</div>
<div class="mb-3">
<label class="form-label" for="phone-number">
<label for="phone-number" class="form-label">
<?= lang('phone_number') ?>
<?= setting('require_phone_number') === '1' ? '<span class="text-danger">*</span>' : '' ?></label>
<input id="phone-number" class="form-control
<?= setting('require_phone_number') === '1' ? 'required' : '' ?>">
<?php if ($require_phone_number): ?>
<span class="text-danger">*</span>
<?php endif ?>
</label>
<input type="text" id="phone-number" maxlength="60"
class="<?= $require_phone_number ? 'required' : '' ?> form-control"/>
</div>
<div class="mb-3">
<label class="form-label" for="address">
<label for="address" class="form-label">
<?= lang('address') ?>
<?php if ($require_address): ?>
<span class="text-danger">*</span>
<?php endif ?>
</label>
<input id="address" class="form-control">
<input type="text" id="address" class="<?= $require_address ? 'required' : '' ?> form-control"
maxlength="120"/>
</div>
<div class="mb-3">
<label class="form-label" for="city">
<label for="city" class="form-label">
<?= lang('city') ?>
<?php if ($require_city): ?>
<span class="text-danger">*</span>
<?php endif ?>
</label>
<input id="city" class="form-control">
<input type="text" id="city" class="<?= $require_city ? 'required' : '' ?> form-control"
maxlength="120"/>
</div>
<div class="mb-3">
<label class="form-label" for="zip-code">
<label for="zip-code" class="form-label">
<?= lang('zip_code') ?>
<?php if ($require_zip_code): ?>
<span class="text-danger">*</span>
<?php endif ?>
</label>
<input id="zip-code" class="form-control">
<input type="text" id="zip-code" class="<?= $require_zip_code ? 'required' : '' ?> form-control"
maxlength="120"/>
</div>
<div class="mb-3">