2022-01-18 13:04:08 +03:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Local variables.
|
2022-10-16 21:54:26 +03:00
|
|
|
*
|
2022-01-18 13:04:08 +03:00
|
|
|
* @var array $available_services
|
2022-10-16 21:54:26 +03:00
|
|
|
* @var array $appointment_status_options
|
2022-01-18 13:04:08 +03:00
|
|
|
* @var array $timezones
|
|
|
|
* @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
|
2023-10-16 12:47:14 +03:00
|
|
|
* @var array $require_notes
|
2022-01-18 13:04:08 +03:00
|
|
|
*/
|
|
|
|
?>
|
2022-01-14 10:39:11 +03:00
|
|
|
<div id="appointments-modal" class="modal fade">
|
2023-02-02 10:25:10 +03:00
|
|
|
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable modal-lg">
|
2021-11-09 10:53:09 +03:00
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
|
|
<h3 class="modal-title"><?= lang('edit_appointment_title') ?></h3>
|
2021-11-23 10:35:39 +03:00
|
|
|
<button class="btn-close" data-bs-dismiss="modal"></button>
|
2021-11-09 10:53:09 +03:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="modal-body">
|
|
|
|
<div class="modal-message alert d-none"></div>
|
|
|
|
|
|
|
|
<form>
|
|
|
|
<fieldset>
|
2022-09-14 13:13:38 +03:00
|
|
|
<h5 class="text-black-50 mb-3 fw-light"><?= lang('appointment_details_title') ?></h5>
|
2021-11-09 10:53:09 +03:00
|
|
|
|
|
|
|
<input id="appointment-id" type="hidden">
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-12 col-sm-6">
|
2021-11-23 11:53:10 +03:00
|
|
|
<div class="mb-3">
|
|
|
|
<label for="select-service" class="form-label">
|
2021-11-09 10:53:09 +03:00
|
|
|
<?= lang('service') ?>
|
|
|
|
<span class="text-danger">*</span>
|
|
|
|
</label>
|
|
|
|
<select id="select-service" class="required form-control">
|
|
|
|
<?php
|
|
|
|
// Group services by category, only if there is at least one service
|
|
|
|
// with a parent category.
|
2023-12-11 11:54:29 +03:00
|
|
|
$has_category = false;
|
2023-10-16 12:47:14 +03:00
|
|
|
|
2023-12-11 11:54:29 +03:00
|
|
|
foreach ($available_services as $service) {
|
|
|
|
if (!empty($service['category_id'])) {
|
|
|
|
$has_category = true;
|
2021-11-09 10:53:09 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-11 11:54:29 +03:00
|
|
|
if ($has_category) {
|
2021-11-09 10:53:09 +03:00
|
|
|
$grouped_services = [];
|
|
|
|
|
2023-12-11 11:54:29 +03:00
|
|
|
foreach ($available_services as $service) {
|
|
|
|
if (!empty($service['category_id'])) {
|
|
|
|
if (!isset($grouped_services[$service['category_name']])) {
|
2021-11-09 10:53:09 +03:00
|
|
|
$grouped_services[$service['category_name']] = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
$grouped_services[$service['category_name']][] = $service;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-14 13:13:38 +03:00
|
|
|
// We need the uncategorized services at the end of the list, so we will use
|
2021-11-09 10:53:09 +03:00
|
|
|
// another iteration only for the uncategorized services.
|
|
|
|
$grouped_services['uncategorized'] = [];
|
2023-10-16 12:47:14 +03:00
|
|
|
|
2023-12-11 11:54:29 +03:00
|
|
|
foreach ($available_services as $service) {
|
|
|
|
if ($service['category_id'] == null) {
|
2021-11-09 10:53:09 +03:00
|
|
|
$grouped_services['uncategorized'][] = $service;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-11 11:54:29 +03:00
|
|
|
foreach ($grouped_services as $key => $group) {
|
|
|
|
$group_label =
|
|
|
|
$key !== 'uncategorized'
|
|
|
|
? e($group[0]['category_name'])
|
|
|
|
: 'Uncategorized';
|
2021-11-09 10:53:09 +03:00
|
|
|
|
2023-12-11 11:54:29 +03:00
|
|
|
if (count($group) > 0) {
|
2021-11-09 10:53:09 +03:00
|
|
|
echo '<optgroup label="' . $group_label . '">';
|
|
|
|
|
2023-12-11 11:54:29 +03:00
|
|
|
foreach ($group as $service) {
|
|
|
|
echo '<option value="' .
|
|
|
|
$service['id'] .
|
|
|
|
'">' .
|
|
|
|
e($service['name']) .
|
|
|
|
'</option>';
|
2021-11-09 10:53:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
echo '</optgroup>';
|
|
|
|
}
|
|
|
|
}
|
2023-12-11 11:54:29 +03:00
|
|
|
} else {
|
|
|
|
foreach ($available_services as $service) {
|
|
|
|
echo '<option value="' .
|
|
|
|
$service['id'] .
|
|
|
|
'">' .
|
|
|
|
e($service['name']) .
|
|
|
|
'</option>';
|
2021-11-09 10:53:09 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
|
2021-11-23 11:53:10 +03:00
|
|
|
<div class="mb-3">
|
|
|
|
<label for="select-provider" class="form-label">
|
2021-11-09 10:53:09 +03:00
|
|
|
<?= lang('provider') ?>
|
|
|
|
<span class="text-danger">*</span>
|
|
|
|
</label>
|
|
|
|
<select id="select-provider" class="required form-control"></select>
|
|
|
|
</div>
|
|
|
|
|
2022-01-18 21:01:26 +03:00
|
|
|
<div class="mb-3">
|
2023-12-11 11:54:29 +03:00
|
|
|
<?php component('color_selection', ['attributes' => 'id="appointment-color"']); ?>
|
2022-01-18 21:01:26 +03:00
|
|
|
</div>
|
|
|
|
|
2021-11-23 11:53:10 +03:00
|
|
|
<div class="mb-3">
|
|
|
|
<label for="appointment-location" class="form-label">
|
2021-11-09 10:53:09 +03:00
|
|
|
<?= lang('location') ?>
|
|
|
|
</label>
|
|
|
|
<input id="appointment-location" class="form-control">
|
|
|
|
</div>
|
|
|
|
|
2021-11-23 11:53:10 +03:00
|
|
|
<div class="mb-3">
|
2022-10-16 21:54:26 +03:00
|
|
|
<label for="appointment-status" class="form-label">
|
|
|
|
<?= lang('status') ?>
|
|
|
|
</label>
|
|
|
|
<select id="appointment-status" class="form-control">
|
|
|
|
<?php foreach ($appointment_status_options as $appointment_status_option): ?>
|
2023-03-13 10:18:39 +03:00
|
|
|
<option value="<?= e($appointment_status_option) ?>">
|
|
|
|
<?= e($appointment_status_option) ?>
|
2022-10-16 21:54:26 +03:00
|
|
|
</option>
|
2023-12-11 11:54:29 +03:00
|
|
|
<?php endforeach; ?>
|
2022-10-16 21:54:26 +03:00
|
|
|
</select>
|
2021-11-09 10:53:09 +03:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-12 col-sm-6">
|
2021-11-23 11:53:10 +03:00
|
|
|
<div class="mb-3">
|
2021-11-09 10:53:09 +03:00
|
|
|
<label for="start-datetime"
|
2021-11-23 11:53:10 +03:00
|
|
|
class="form-label"><?= lang('start_date_time') ?></label>
|
2021-11-09 10:53:09 +03:00
|
|
|
<input id="start-datetime" class="required form-control">
|
|
|
|
</div>
|
|
|
|
|
2021-11-23 11:53:10 +03:00
|
|
|
<div class="mb-3">
|
|
|
|
<label for="end-datetime" class="form-label"><?= lang('end_date_time') ?></label>
|
2021-11-09 10:53:09 +03:00
|
|
|
<input id="end-datetime" class="required form-control">
|
|
|
|
</div>
|
|
|
|
|
2021-11-23 11:53:10 +03:00
|
|
|
<div class="mb-3">
|
2022-06-02 16:50:08 +03:00
|
|
|
<label class="form-label">
|
|
|
|
<?= lang('timezone') ?>
|
|
|
|
</label>
|
2021-11-09 10:53:09 +03:00
|
|
|
|
2022-10-16 21:54:26 +03:00
|
|
|
<div
|
|
|
|
class="border rounded d-flex justify-content-between align-items-center bg-light timezone-info">
|
2022-06-02 16:50:08 +03:00
|
|
|
<div class="border-end w-50 p-1 text-center">
|
2023-05-03 08:51:53 +03:00
|
|
|
<small>
|
|
|
|
<?= lang('provider') ?>:
|
|
|
|
<span class="provider-timezone">
|
|
|
|
-
|
|
|
|
</span>
|
|
|
|
</small>
|
2022-06-02 16:50:08 +03:00
|
|
|
</div>
|
|
|
|
<div class="w-50 p-1 text-center">
|
2023-05-03 08:51:53 +03:00
|
|
|
<small>
|
|
|
|
<?= lang('current_user') ?>:
|
|
|
|
<span>
|
2024-01-01 19:58:56 +03:00
|
|
|
<?= $timezones[session('timezone', 'Istanbul (+3:00)')] ?>
|
2023-05-03 08:51:53 +03:00
|
|
|
</span>
|
|
|
|
</small>
|
2022-06-02 16:50:08 +03:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-11-09 10:53:09 +03:00
|
|
|
</div>
|
2022-10-16 21:54:26 +03:00
|
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="appointment-notes" class="form-label"><?= lang('notes') ?></label>
|
|
|
|
<textarea id="appointment-notes" class="form-control" rows="3"></textarea>
|
|
|
|
</div>
|
2021-11-09 10:53:09 +03:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</fieldset>
|
|
|
|
|
|
|
|
<br>
|
|
|
|
|
|
|
|
<fieldset>
|
2022-09-14 13:13:38 +03:00
|
|
|
<h5 class="text-black-50 mb-3 fw-light">
|
2021-11-09 10:53:09 +03:00
|
|
|
<?= lang('customer_details_title') ?>
|
|
|
|
<button id="new-customer" class="btn btn-outline-secondary btn-sm" type="button"
|
|
|
|
data-tippy-content="<?= lang('clear_fields_add_existing_customer_hint') ?>">
|
2021-11-23 10:41:37 +03:00
|
|
|
<i class="fas fa-plus-square me-2"></i>
|
2021-11-09 10:53:09 +03:00
|
|
|
<?= lang('new') ?>
|
|
|
|
</button>
|
|
|
|
<button id="select-customer" class="btn btn-outline-secondary btn-sm" type="button"
|
|
|
|
data-tippy-content="<?= lang('pick_existing_customer_hint') ?>">
|
2021-11-23 10:41:37 +03:00
|
|
|
<i class="fas fa-hand-pointer me-2"></i>
|
2021-11-09 10:53:09 +03:00
|
|
|
<span>
|
|
|
|
<?= lang('select') ?>
|
|
|
|
</span>
|
|
|
|
</button>
|
2022-09-14 13:13:38 +03:00
|
|
|
|
2021-11-09 10:53:09 +03:00
|
|
|
<input id="filter-existing-customers"
|
|
|
|
placeholder="<?= lang('type_to_filter_customers') ?>"
|
|
|
|
style="display: none;" class="input-sm form-control">
|
2022-09-14 13:13:38 +03:00
|
|
|
</h5>
|
|
|
|
|
|
|
|
<div id="existing-customers-list" style="display: none;"></div>
|
2021-11-09 10:53:09 +03:00
|
|
|
|
|
|
|
<input id="customer-id" type="hidden">
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-12 col-sm-6">
|
2021-11-23 11:53:10 +03:00
|
|
|
<div class="mb-3">
|
|
|
|
<label for="first-name" class="form-label">
|
2021-11-09 10:53:09 +03:00
|
|
|
<?= lang('first_name') ?>
|
2022-01-18 13:04:08 +03:00
|
|
|
<?php if ($require_first_name): ?>
|
2022-01-05 10:31:51 +03:00
|
|
|
<span class="text-danger">*</span>
|
2023-12-11 11:54:29 +03:00
|
|
|
<?php endif; ?>
|
2021-11-09 10:53:09 +03:00
|
|
|
</label>
|
2022-01-05 10:31:51 +03:00
|
|
|
<input type="text" id="first-name"
|
2022-01-18 13:04:08 +03:00
|
|
|
class="<?= $require_first_name ? 'required' : '' ?> form-control"
|
2022-01-05 10:31:51 +03:00
|
|
|
maxlength="100"/>
|
2021-11-09 10:53:09 +03:00
|
|
|
</div>
|
|
|
|
|
2021-11-23 11:53:10 +03:00
|
|
|
<div class="mb-3">
|
|
|
|
<label for="last-name" class="form-label">
|
2021-11-09 10:53:09 +03:00
|
|
|
<?= lang('last_name') ?>
|
2022-01-18 13:04:08 +03:00
|
|
|
<?php if ($require_last_name): ?>
|
2022-01-05 10:31:51 +03:00
|
|
|
<span class="text-danger">*</span>
|
2023-12-11 11:54:29 +03:00
|
|
|
<?php endif; ?>
|
2021-11-09 10:53:09 +03:00
|
|
|
</label>
|
2022-01-05 10:31:51 +03:00
|
|
|
<input type="text" id="last-name"
|
2022-01-18 13:04:08 +03:00
|
|
|
class="<?= $require_last_name ? 'required' : '' ?> form-control"
|
2022-01-05 10:31:51 +03:00
|
|
|
maxlength="120"/>
|
2021-11-09 10:53:09 +03:00
|
|
|
</div>
|
|
|
|
|
2021-11-23 11:53:10 +03:00
|
|
|
<div class="mb-3">
|
|
|
|
<label for="email" class="form-label">
|
2021-11-09 10:53:09 +03:00
|
|
|
<?= lang('email') ?>
|
2022-01-18 13:04:08 +03:00
|
|
|
<?php if ($require_email): ?>
|
2022-01-05 10:31:51 +03:00
|
|
|
<span class="text-danger">*</span>
|
2023-12-11 11:54:29 +03:00
|
|
|
<?php endif; ?>
|
2021-11-09 10:53:09 +03:00
|
|
|
</label>
|
2022-01-05 10:31:51 +03:00
|
|
|
<input type="text" id="email"
|
2022-01-18 13:04:08 +03:00
|
|
|
class="<?= $require_email ? 'required' : '' ?> form-control"
|
2022-01-05 10:31:51 +03:00
|
|
|
maxlength="120"/>
|
2021-11-09 10:53:09 +03:00
|
|
|
</div>
|
|
|
|
|
2021-11-23 11:53:10 +03:00
|
|
|
<div class="mb-3">
|
|
|
|
<label for="phone-number" class="form-label">
|
2021-11-09 10:53:09 +03:00
|
|
|
<?= lang('phone_number') ?>
|
2022-01-18 13:04:08 +03:00
|
|
|
<?php if ($require_phone_number): ?>
|
2021-11-09 10:53:09 +03:00
|
|
|
<span class="text-danger">*</span>
|
2023-12-11 11:54:29 +03:00
|
|
|
<?php endif; ?>
|
2021-11-09 10:53:09 +03:00
|
|
|
</label>
|
2022-01-05 10:31:51 +03:00
|
|
|
<input type="text" id="phone-number" maxlength="60"
|
2022-01-18 13:04:08 +03:00
|
|
|
class="<?= $require_phone_number ? 'required' : '' ?> form-control"/>
|
2021-11-09 10:53:09 +03:00
|
|
|
</div>
|
2022-03-29 11:15:24 +03:00
|
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
<label class="form-label" for="language">
|
|
|
|
<?= lang('language') ?>
|
|
|
|
<span class="text-danger" hidden>*</span>
|
|
|
|
</label>
|
|
|
|
<select id="language" class="form-control required">
|
|
|
|
<?php foreach (vars('available_languages') as $available_language): ?>
|
|
|
|
<option value="<?= $available_language ?>">
|
|
|
|
<?= ucfirst($available_language) ?>
|
|
|
|
</option>
|
2023-12-11 11:54:29 +03:00
|
|
|
<?php endforeach; ?>
|
2022-03-29 11:15:24 +03:00
|
|
|
</select>
|
|
|
|
</div>
|
2021-11-09 10:53:09 +03:00
|
|
|
</div>
|
|
|
|
<div class="col-12 col-sm-6">
|
2021-11-23 11:53:10 +03:00
|
|
|
<div class="mb-3">
|
|
|
|
<label for="address" class="form-label">
|
2021-11-09 10:53:09 +03:00
|
|
|
<?= lang('address') ?>
|
2022-01-18 13:04:08 +03:00
|
|
|
<?php if ($require_address): ?>
|
2022-01-05 10:31:51 +03:00
|
|
|
<span class="text-danger">*</span>
|
2023-12-11 11:54:29 +03:00
|
|
|
<?php endif; ?>
|
2021-11-09 10:53:09 +03:00
|
|
|
</label>
|
2022-01-05 10:31:51 +03:00
|
|
|
<input type="text" id="address"
|
2022-01-18 13:04:08 +03:00
|
|
|
class="<?= $require_address ? 'required' : '' ?> form-control"
|
2022-01-05 10:31:51 +03:00
|
|
|
maxlength="120"/>
|
2021-11-09 10:53:09 +03:00
|
|
|
</div>
|
|
|
|
|
2021-11-23 11:53:10 +03:00
|
|
|
<div class="mb-3">
|
|
|
|
<label for="city" class="form-label">
|
2021-11-09 10:53:09 +03:00
|
|
|
<?= lang('city') ?>
|
2022-01-18 13:04:08 +03:00
|
|
|
<?php if ($require_city): ?>
|
2022-01-05 10:31:51 +03:00
|
|
|
<span class="text-danger">*</span>
|
2023-12-11 11:54:29 +03:00
|
|
|
<?php endif; ?>
|
2021-11-09 10:53:09 +03:00
|
|
|
</label>
|
2022-01-05 10:31:51 +03:00
|
|
|
<input type="text" id="city"
|
2022-01-18 13:04:08 +03:00
|
|
|
class="<?= $require_city ? 'required' : '' ?> form-control"
|
2022-01-05 10:31:51 +03:00
|
|
|
maxlength="120"/>
|
2021-11-09 10:53:09 +03:00
|
|
|
</div>
|
|
|
|
|
2021-11-23 11:53:10 +03:00
|
|
|
<div class="mb-3">
|
|
|
|
<label for="zip-code" class="form-label">
|
2021-11-09 10:53:09 +03:00
|
|
|
<?= lang('zip_code') ?>
|
2022-01-18 13:04:08 +03:00
|
|
|
<?php if ($require_zip_code): ?>
|
2022-01-05 10:31:51 +03:00
|
|
|
<span class="text-danger">*</span>
|
2023-12-11 11:54:29 +03:00
|
|
|
<?php endif; ?>
|
2021-11-09 10:53:09 +03:00
|
|
|
</label>
|
2022-01-05 10:31:51 +03:00
|
|
|
<input type="text" id="zip-code"
|
2022-01-18 13:04:08 +03:00
|
|
|
class="<?= $require_zip_code ? 'required' : '' ?> form-control"
|
2022-01-05 10:31:51 +03:00
|
|
|
maxlength="120"/>
|
2021-11-09 10:53:09 +03:00
|
|
|
</div>
|
|
|
|
|
2022-03-29 11:15:24 +03:00
|
|
|
<div class="mb-3">
|
|
|
|
<label class="form-label" for="timezone">
|
|
|
|
<?= lang('timezone') ?>
|
|
|
|
<span class="text-danger" hidden>*</span>
|
|
|
|
</label>
|
|
|
|
<?php component('timezone_dropdown', [
|
|
|
|
'attributes' => 'id="timezone" class="form-control required"',
|
2023-12-22 13:35:41 +03:00
|
|
|
'grouped_timezones' => vars('grouped_timezones'),
|
2023-12-11 11:54:29 +03:00
|
|
|
]); ?>
|
2022-03-29 11:15:24 +03:00
|
|
|
</div>
|
|
|
|
|
2021-11-23 11:53:10 +03:00
|
|
|
<div class="mb-3">
|
|
|
|
<label for="customer-notes" class="form-label">
|
2021-11-09 10:53:09 +03:00
|
|
|
<?= lang('notes') ?>
|
2023-10-16 12:47:14 +03:00
|
|
|
<?php if ($require_notes): ?>
|
2022-01-05 10:31:51 +03:00
|
|
|
<span class="text-danger">*</span>
|
2023-12-11 11:54:29 +03:00
|
|
|
<?php endif; ?>
|
2021-11-09 10:53:09 +03:00
|
|
|
</label>
|
2022-01-05 10:31:51 +03:00
|
|
|
<textarea id="customer-notes" rows="2"
|
2023-10-16 12:47:14 +03:00
|
|
|
class="<?= $require_notes ? 'required' : '' ?> form-control"></textarea>
|
2021-11-09 10:53:09 +03:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-12-11 11:54:29 +03:00
|
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
<?php component('custom_fields'); ?>
|
|
|
|
</div>
|
2021-11-09 10:53:09 +03:00
|
|
|
</div>
|
|
|
|
</fieldset>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="modal-footer">
|
2022-01-24 14:55:45 +03:00
|
|
|
<button class="btn btn-secondary" data-bs-dismiss="modal">
|
2021-11-09 10:53:09 +03:00
|
|
|
<?= lang('cancel') ?>
|
|
|
|
</button>
|
|
|
|
<button id="save-appointment" class="btn btn-primary">
|
2021-11-23 10:41:37 +03:00
|
|
|
<i class="fas fa-check-square me-2"></i>
|
2021-11-09 10:53:09 +03:00
|
|
|
<?= lang('save') ?>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-01-14 10:39:11 +03:00
|
|
|
|
2023-12-11 11:54:29 +03:00
|
|
|
<?php section('scripts'); ?>
|
2022-01-14 10:39:11 +03:00
|
|
|
|
|
|
|
<script src="<?= asset_url('assets/js/components/appointments_modal.js') ?>"></script>
|
|
|
|
|
2023-12-11 11:54:29 +03:00
|
|
|
<?php end_section('scripts'); ?>
|