forked from alextselegidis/easyappointments
/
book.php
executable file
·405 lines (353 loc) · 21.3 KB
/
book.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#35A768">
<title><?= lang('page_title') . ' ' . $company_name ?></title>
<link rel="stylesheet" type="text/css" href="<?= asset_url('assets/ext/bootstrap/css/bootstrap.min.css') ?>">
<link rel="stylesheet" type="text/css" href="<?= asset_url('assets/ext/jquery-ui/jquery-ui.min.css') ?>">
<link rel="stylesheet" type="text/css" href="<?= asset_url('assets/ext/jquery-qtip/jquery.qtip.min.css') ?>">
<link rel="stylesheet" type="text/css" href="<?= asset_url('assets/ext/cookieconsent/cookieconsent.min.css') ?>">
<link rel="stylesheet" type="text/css" href="<?= asset_url('assets/css/frontend.css') ?>">
<link rel="stylesheet" type="text/css" href="<?= asset_url('assets/css/general.css') ?>">
<link rel="icon" type="image/x-icon" href="<?= asset_url('assets/img/favicon.ico') ?>">
<link rel="icon" sizes="192x192" href="<?= asset_url('assets/img/logo.png') ?>">
</head>
<body>
<div id="main" class="container">
<div class="wrapper row">
<div id="book-appointment-wizard" class="col-xs-12 col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
<!-- FRAME TOP BAR -->
<div id="header">
<span id="company-name"><?= $company_name ?></span>
<div id="steps">
<div id="step-1" class="book-step active-step" title="<?= lang('step_one_title') ?>">
<strong>1</strong>
</div>
<div id="step-2" class="book-step" title="<?= lang('step_two_title') ?>">
<strong>2</strong>
</div>
<div id="step-3" class="book-step" title="<?= lang('step_three_title') ?>">
<strong>3</strong>
</div>
<div id="step-4" class="book-step" title="<?= lang('step_four_title') ?>">
<strong>4</strong>
</div>
</div>
</div>
<?php if ($manage_mode): ?>
<div id="cancel-appointment-frame" class="booking-header-bar row">
<div class="col-xs-12 col-sm-10">
<p><?= lang('cancel_appointment_hint') ?></p>
</div>
<div class="col-xs-12 col-sm-2">
<form id="cancel-appointment-form" method="post"
action="<?= site_url('appointments/cancel/' . $appointment_data['hash']) ?>">
<input type="hidden" name="csrfToken" value="<?= $this->security->get_csrf_hash() ?>" />
<textarea name="cancel_reason" style="display:none"></textarea>
<button id="cancel-appointment" class="btn btn-default btn-sm"><?= lang('cancel') ?></button>
</form>
</div>
</div>
<div class="booking-header-bar row">
<div class="col-xs-12 col-sm-10">
<p><?= lang('delete_personal_information_hint') ?></p>
</div>
<div class="col-xs-12 col-sm-2">
<button id="delete-personal-information" class="btn btn-danger btn-sm"><?= lang('delete') ?></button>
</div>
</div>
<?php endif; ?>
<?php
if (isset($exceptions)) {
echo '<div style="margin: 10px">';
echo '<h4>' . lang('unexpected_issues') . '</h4>';
foreach($exceptions as $exception) {
echo exceptionToHtml($exception);
}
echo '</div>';
}
?>
<!-- SELECT SERVICE AND PROVIDER -->
<div id="wizard-frame-1" class="wizard-frame">
<div class="frame-container">
<h3 class="frame-title"><?= lang('step_one_title') ?></h3>
<div class="frame-content">
<div class="form-group">
<label for="select-service">
<strong><?= lang('select_service') ?></strong>
</label>
<select id="select-service" class="col-xs-12 col-sm-4 form-control">
<?php
// Group services by category, only if there is at least one service with a parent category.
$has_category = FALSE;
foreach($available_services as $service) {
if ($service['category_id'] != NULL) {
$has_category = TRUE;
break;
}
}
if ($has_category) {
$grouped_services = array();
foreach($available_services as $service) {
if ($service['category_id'] != NULL) {
if (!isset($grouped_services[$service['category_name']])) {
$grouped_services[$service['category_name']] = array();
}
$grouped_services[$service['category_name']][] = $service;
}
}
// We need the uncategorized services at the end of the list so
// we will use another iteration only for the uncategorized services.
$grouped_services['uncategorized'] = array();
foreach($available_services as $service) {
if ($service['category_id'] == NULL) {
$grouped_services['uncategorized'][] = $service;
}
}
foreach($grouped_services as $key => $group) {
$group_label = ($key != 'uncategorized')
? $group[0]['category_name'] : 'Uncategorized';
if (count($group) > 0) {
echo '<optgroup label="' . $group_label . '">';
foreach($group as $service) {
echo '<option value="' . $service['id'] . '">'
. $service['name'] . '</option>';
}
echo '</optgroup>';
}
}
} else {
foreach($available_services as $service) {
echo '<option value="' . $service['id'] . '">' . $service['name'] . '</option>';
}
}
?>
</select>
</div>
<div class="form-group">
<label for="select-provider">
<strong><?= lang('select_provider') ?></strong>
</label>
<select id="select-provider" class="col-xs-12 col-sm-4 form-control"></select>
</div>
<div id="service-description" style="display:none;"></div>
</div>
</div>
<div class="command-buttons">
<button type="button" id="button-next-1" class="btn button-next btn-primary"
data-step_index="1">
<?= lang('next') ?>
<span class="glyphicon glyphicon-forward"></span>
</button>
</div>
</div>
<!-- SELECT APPOINTMENT DATE -->
<div id="wizard-frame-2" class="wizard-frame" style="display:none;">
<div class="frame-container">
<h3 class="frame-title"><?= lang('step_two_title') ?></h3>
<div class="frame-content row">
<div class="col-xs-12 col-sm-6">
<div id="select-date"></div>
</div>
<div class="col-xs-12 col-sm-6">
<div id="available-hours"></div>
</div>
</div>
</div>
<div class="command-buttons">
<button type="button" id="button-back-2" class="btn button-back btn-default"
data-step_index="2">
<span class="glyphicon glyphicon-backward"></span>
<?= lang('back') ?>
</button>
<button type="button" id="button-next-2" class="btn button-next btn-primary"
data-step_index="2">
<?= lang('next') ?>
<span class="glyphicon glyphicon-forward"></span>
</button>
</div>
</div>
<!-- ENTER CUSTOMER DATA -->
<div id="wizard-frame-3" class="wizard-frame" style="display:none;">
<div class="frame-container">
<h3 class="frame-title"><?= lang('step_three_title') ?></h3>
<div class="frame-content row">
<div class="col-xs-12 col-sm-6">
<div class="form-group">
<label for="first-name" class="control-label"><?= lang('first_name') ?> *</label>
<input type="text" id="first-name" class="required form-control" maxlength="100" />
</div>
<div class="form-group">
<label for="last-name" class="control-label"><?= lang('last_name') ?> *</label>
<input type="text" id="last-name" class="required form-control" maxlength="120" />
</div>
<div class="form-group">
<label for="email" class="control-label"><?= lang('email') ?> *</label>
<input type="text" id="email" class="required form-control" maxlength="120" />
</div>
<div class="form-group">
<label for="phone-number" class="control-label"><?= lang('phone_number') ?>
<?php echo ('1' === $require_phone_number) ? '*' : ''; ?></label>
<input type="text" id="phone-number" class="<?php echo ('1' === $require_phone_number) ? 'required' : ''; ?>
form-control" maxlength="60" />
</div>
</div>
<div class="col-xs-12 col-sm-6">
<div class="form-group">
<label for="address" class="control-label"><?= lang('address') ?></label>
<input type="text" id="address" class="form-control" maxlength="120" />
</div>
<div class="form-group">
<label for="city" class="control-label"><?= lang('city') ?></label>
<input type="text" id="city" class="form-control" maxlength="120" />
</div>
<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>
<div class="form-group">
<label for="notes" class="control-label"><?= lang('notes') ?></label>
<textarea id="notes" maxlength="500" class="form-control" rows="3"></textarea>
</div>
</div>
<?php if ($display_terms_and_conditions): ?>
<label>
<input type="checkbox" class="required" id="accept-to-terms-and-conditions">
<?= strtr(lang('read_and_agree_to_terms_and_conditions'),
[
'{$link}' => '<a href="#" data-toggle="modal" data-target="#terms-and-conditions-modal">',
'{/$link}' => '</a>'
])
?>
</label>
<br>
<?php endif ?>
<?php if ($display_privacy_policy): ?>
<label>
<input type="checkbox" class="required" id="accept-to-privacy-policy">
<?= strtr(lang('read_and_agree_to_privacy_policy'),
[
'{$link}' => '<a href="#" data-toggle="modal" data-target="#privacy-policy-modal">',
'{/$link}' => '</a>'
])
?>
</label>
<br>
<?php endif ?>
<span id="form-message" class="text-danger"><?= lang('fields_are_required') ?></span>
</div>
</div>
<div class="command-buttons">
<button type="button" id="button-back-3" class="btn button-back btn-default"
data-step_index="3"><span class="glyphicon glyphicon-backward"></span>
<?= lang('back') ?>
</button>
<button type="button" id="button-next-3" class="btn button-next btn-primary"
data-step_index="3">
<?= lang('next') ?>
<span class="glyphicon glyphicon-forward"></span>
</button>
</div>
</div>
<!-- APPOINTMENT DATA CONFIRMATION -->
<div id="wizard-frame-4" class="wizard-frame" style="display:none;">
<div class="frame-container">
<h3 class="frame-title"><?= lang('step_four_title') ?></h3>
<div class="frame-content row">
<div id="appointment-details" class="col-xs-12 col-sm-6"></div>
<div id="customer-details" class="col-xs-12 col-sm-6"></div>
</div>
<?php if ($this->settings_model->get_setting('require_captcha') === '1'): ?>
<div class="frame-content row">
<div class="col-xs-12 col-sm-6">
<h4 class="captcha-title">
CAPTCHA
<small class="glyphicon glyphicon-refresh"></small>
</h4>
<img class="captcha-image" src="<?= site_url('captcha') ?>">
<input class="captcha-text" type="text" value="" />
<span id="captcha-hint" class="help-block" style="opacity:0"> </span>
</div>
</div>
<?php endif; ?>
</div>
<div class="command-buttons">
<button type="button" id="button-back-4" class="btn button-back btn-default"
data-step_index="4">
<span class="glyphicon glyphicon-backward"></span>
<?= lang('back') ?>
</button>
<form id="book-appointment-form" style="display:inline-block" method="post">
<button id="book-appointment-submit" type="button" class="btn btn-success">
<span class="glyphicon glyphicon-ok"></span>
<?= !$manage_mode ? lang('confirm') : lang('update') ?>
</button>
<input type="hidden" name="csrfToken" />
<input type="hidden" name="post_data" />
</form>
</div>
</div>
<!-- FRAME FOOTER -->
<div id="frame-footer">
Powered By
<a href="http://easyappointments.org" target="_blank">Easy!Appointments</a>
|
<span id="select-language" class="label label-success">
<?= ucfirst($this->config->item('language')) ?>
</span>
|
<a href="<?= site_url('backend'); ?>">
<?= $this->session->user_id ? lang('backend_section') : lang('login') ?>
</a>
</div>
</div>
</div>
</div>
<?php if ($display_cookie_notice === '1'): ?>
<?php require 'cookie_notice_modal.php' ?>
<?php endif ?>
<?php if ($display_terms_and_conditions === '1'): ?>
<?php require 'terms_and_conditions_modal.php' ?>
<?php endif ?>
<?php if ($display_privacy_policy === '1'): ?>
<?php require 'privacy_policy_modal.php' ?>
<?php endif ?>
<script>
var GlobalVariables = {
availableServices : <?= json_encode($available_services) ?>,
availableProviders : <?= json_encode($available_providers) ?>,
baseUrl : <?= json_encode(config('base_url')) ?>,
manageMode : <?= $manage_mode ? 'true' : 'false' ?>,
customerToken : <?= json_encode($customer_token) ?>,
dateFormat : <?= json_encode($date_format) ?>,
timeFormat : <?= json_encode($time_format) ?>,
displayCookieNotice : <?= json_encode($display_cookie_notice === '1') ?>,
appointmentData : <?= json_encode($appointment_data) ?>,
providerData : <?= json_encode($provider_data) ?>,
customerData : <?= json_encode($customer_data) ?>,
csrfToken : <?= json_encode($this->security->get_csrf_hash()) ?>
};
var EALang = <?= json_encode($this->lang->language) ?>;
var availableLanguages = <?= json_encode($this->config->item('available_languages')) ?>;
</script>
<script src="<?= asset_url('assets/js/general_functions.js') ?>"></script>
<script src="<?= asset_url('assets/ext/jquery/jquery.min.js') ?>"></script>
<script src="<?= asset_url('assets/ext/jquery-ui/jquery-ui.min.js') ?>"></script>
<script src="<?= asset_url('assets/ext/jquery-qtip/jquery.qtip.min.js') ?>"></script>
<script src="<?= asset_url('assets/ext/cookieconsent/cookieconsent.min.js') ?>"></script>
<script src="<?= asset_url('assets/ext/bootstrap/js/bootstrap.min.js') ?>"></script>
<script src="<?= asset_url('assets/ext/datejs/date.js') ?>"></script>
<script src="<?= asset_url('assets/js/frontend_book_api.js') ?>"></script>
<script src="<?= asset_url('assets/js/frontend_book.js') ?>"></script>
<script>
$(document).ready(function() {
FrontendBook.initialize(true, GlobalVariables.manageMode);
GeneralFunctions.enableLanguageSelection($('#select-language'));
});
</script>
<?php google_analytics_script(); ?>
</body>
</html>