[1081] Frontend hiding of fields

This commit is contained in:
Thomas S 2021-05-28 15:39:14 +02:00
parent 094b780fd8
commit 872640c46d
2 changed files with 17 additions and 0 deletions

View file

@ -168,6 +168,7 @@ class Appointments extends EA_Controller {
'time_format' => $time_format,
'first_weekday' => $first_weekday,
'require_phone_number' => $require_phone_number,
'show_field' => $show_field,
'appointment_data' => $appointment,
'provider_data' => $provider,
'customer_data' => $customer,
@ -438,6 +439,12 @@ class Appointments extends EA_Controller {
$appointment = $post_data['appointment'];
$customer = $post_data['customer'];
if (!array_key_exists('address', $customer)){ $customer['address'] = ""; }
if (!array_key_exists('city', $customer)){ $customer['city'] = ""; }
if (!array_key_exists('zip_code', $customer)){ $customer['zip_code'] = ""; }
if (!array_key_exists('notes', $customer)){ $customer['notes'] = ""; }
if (!array_key_exists('phone_number', $customer)){ $customer['address'] = ""; }
// Check appointment availability before registering it to the database.
$appointment['id_users_provider'] = $this->check_datetime_availability();

View file

@ -268,6 +268,7 @@
</label>
<input type="text" id="email" class="required form-control" maxlength="120"/>
</div>
<?php if ($show_field['phone-number']) : ?>
<div class="form-group">
<label for="phone-number" class="control-label">
<?= lang('phone_number') ?>
@ -276,33 +277,42 @@
<input type="text" id="phone-number" maxlength="60"
class="<?= $require_phone_number === '1' ? 'required' : '' ?> form-control"/>
</div>
<?php endif; ?>
</div>
<div class="col-12 col-md-6">
<?php if ($show_field['address']) : ?>
<div class="form-group">
<label for="address" class="control-label">
<?= lang('address') ?>
</label>
<input type="text" id="address" class="form-control" maxlength="120"/>
</div>
<?php endif; ?>
<?php if ($show_field['city']):?>
<div class="form-group">
<label for="city" class="control-label">
<?= lang('city') ?>
</label>
<input type="text" id="city" class="form-control" maxlength="120"/>
</div>
<?php endif; ?>
<?php if ($show_field['zip-code']) : ?>
<div class="form-group">
<label for="zip-code" class="control-label">
<?= lang('zip_code') ?>
</label>
<input type="text" id="zip-code" class="form-control" maxlength="120"/>
</div>
<?php endif; ?>
<?php if ($show_field['notes']) : ?>
<div class="form-group">
<label for="notes" class="control-label">
<?= lang('notes') ?>
</label>
<textarea id="notes" maxlength="500" class="form-control" rows="1"></textarea>
</div>
<?php endif; ?>
</div>
</div>
</div>