* Fixed bugs in backend and front end (booking process)

* Made css changes to backend. 
* Applied qtip into backend control tootips.
This commit is contained in:
alextselegidis@gmail.com 2013-10-18 14:56:12 +00:00
parent 8f90da86be
commit 8da6304f26
18 changed files with 312 additions and 129 deletions

View file

@ -20,6 +20,7 @@ include dirname(dirname(dirname(__FILE__))) . '/configuration.php';
require_once dirname(dirname(dirname(__FILE__))) . '/configuration.php'; require_once dirname(dirname(dirname(__FILE__))) . '/configuration.php';
$config['base_url'] = SystemConfiguration::$base_url; $config['base_url'] = SystemConfiguration::$base_url;
$config['ea_version'] = '0.6'; // This must be changed manually. $config['ea_version'] = '0.6'; // This must be changed manually.
$config['ea_release_title'] = 'Alpha'; // Leave empty for no title or add BETA, TEST etc ...
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View file

@ -303,6 +303,8 @@ class Appointments extends CI_Controller {
* available hours we want to see. * available hours we want to see.
* @param numeric $_POST['service_duration'] The selected service duration in * @param numeric $_POST['service_duration'] The selected service duration in
* minutes. * minutes.
* @param string $$_POST['manage_mode'] Contains either 'true' or 'false' and determines
* the if current user is managing an already booked appointment or not.
* @return Returns a json object with the available hours. * @return Returns a json object with the available hours.
*/ */
public function ajax_get_available_hours() { public function ajax_get_available_hours() {
@ -320,10 +322,9 @@ class Appointments extends CI_Controller {
$empty_periods = $this->get_provider_available_time_periods($_POST['provider_id'], $empty_periods = $this->get_provider_available_time_periods($_POST['provider_id'],
$_POST['selected_date'], $exclude_appointments); $_POST['selected_date'], $exclude_appointments);
// Calculate the available appointment hours for the given date. // Calculate the available appointment hours for the given date. The empty spaces
// The empty spaces are broken down to 15 min and if the service // are broken down to 15 min and if the service fit in each quarter then a new
// fit in each quarter then a new available hour is added to the // available hour is added to the "$available_hours" array.
// $available hours array.
$available_hours = array(); $available_hours = array();
@ -347,13 +348,13 @@ class Appointments extends CI_Controller {
} }
} }
$curr_hour = $start_hour; $current_hour = $start_hour;
$diff = $curr_hour->diff($end_hour); $diff = $current_hour->diff($end_hour);
while (($diff->h * 60 + $diff->i) > intval($_POST['service_duration'])) { while (($diff->h * 60 + $diff->i) > intval($_POST['service_duration'])) {
$available_hours[] = $curr_hour->format('H:i'); $available_hours[] = $current_hour->format('H:i');
$curr_hour->add(new DateInterval("PT15M")); $current_hour->add(new DateInterval("PT15M"));
$diff = $curr_hour->diff($end_hour); $diff = $current_hour->diff($end_hour);
} }
} }
@ -366,15 +367,12 @@ class Appointments extends CI_Controller {
if ($_POST['manage_mode'] === 'true') { if ($_POST['manage_mode'] === 'true') {
$book_advance_timeout = 0; $book_advance_timeout = 0;
} else { } else {
$book_advance_timeout = $this->settings_model->get_setting( $book_advance_timeout = $this->settings_model->get_setting('book_advance_timeout');
'book_advance_timeout');
} }
foreach($available_hours as $index => $value) { foreach($available_hours as $index => $value) {
$available_hour = strtotime($value); $available_hour = strtotime($value);
$current_hour = strtotime('+' . $book_advance_timeout . ' minutes', $current_hour = strtotime('+' . $book_advance_timeout . ' minutes', strtotime('now'));
strtotime('now'));
if ($available_hour <= $current_hour) { if ($available_hour <= $current_hour) {
unset($available_hours[$index]); unset($available_hours[$index]);
} }
@ -382,7 +380,6 @@ class Appointments extends CI_Controller {
} }
$available_hours = array_values($available_hours); $available_hours = array_values($available_hours);
echo json_encode($available_hours); echo json_encode($available_hours);
} catch(Exception $exc) { } catch(Exception $exc) {
@ -463,8 +460,7 @@ class Appointments extends CI_Controller {
$this->load->model('providers_model'); $this->load->model('providers_model');
// Get the provider's working plan and reserved appointments. // Get the provider's working plan and reserved appointments.
$working_plan = json_decode($this->providers_model->get_setting('working_plan', $working_plan = json_decode($this->providers_model->get_setting('working_plan', $provider_id), true);
$provider_id), true);
$where_clause = array( $where_clause = array(
'DATE(start_datetime)' => date('Y-m-d', strtotime($selected_date)), 'DATE(start_datetime)' => date('Y-m-d', strtotime($selected_date)),
@ -474,10 +470,10 @@ class Appointments extends CI_Controller {
$reserved_appointments = $this->appointments_model->get_batch($where_clause); $reserved_appointments = $this->appointments_model->get_batch($where_clause);
// Sometimes it might be necessary to not take into account some appointment records // Sometimes it might be necessary to not take into account some appointment records
// in order to display what the providers available time periods would be without them. // in order to display what the providers' available time periods would be without them.
foreach($exclude_appointments as $excluded_appointment) { foreach ($exclude_appointments as $excluded_id) {
foreach($reserved_appointments as $index=>$appointment) { foreach ($reserved_appointments as $index => $reserved) {
if ($appointment['id'] == $excluded_appointment['id']) { if ($reserved['id'] == $excluded_id) {
unset($reserved_appointments[$index]); unset($reserved_appointments[$index]);
} }
} }
@ -523,9 +519,9 @@ class Appointments extends CI_Controller {
foreach($available_periods_with_breaks as $period) { foreach($available_periods_with_breaks as $period) {
foreach($reserved_appointments as $index=>$appointment) { foreach($reserved_appointments as $index=>$reserved) {
$appointment_start = date('H:i', strtotime($appointment['start_datetime'])); $appointment_start = date('H:i', strtotime($reserved['start_datetime']));
$appointment_end = date('H:i', strtotime($appointment['end_datetime'])); $appointment_end = date('H:i', strtotime($reserved['end_datetime']));
$period_start = date('H:i', strtotime($period['start'])); $period_start = date('H:i', strtotime($period['start']));
$period_end = date('H:i', strtotime($period['end'])); $period_end = date('H:i', strtotime($period['end']));

View file

@ -187,7 +187,7 @@ class Backend_api extends CI_Controller {
$provider_title = 'A new appointment has been added to your plan.'; $provider_title = 'A new appointment has been added to your plan.';
$provider_message = 'You can make changes by clicking the appointment ' $provider_message = 'You can make changes by clicking the appointment '
. 'link below'; . 'link below';
$provider_link = $this->config->item('base_url') . 'backend/' $provider_link = $this->config->item('base_url') . 'backend/index/'
. $appointment['hash']; . $appointment['hash'];
} else { } else {
$customer_title = 'Appointment changes have been successfully saved!'; $customer_title = 'Appointment changes have been successfully saved!';

View file

@ -28,6 +28,10 @@
rel="stylesheet" rel="stylesheet"
type="text/css" type="text/css"
href="<?php echo $this->config->base_url(); ?>assets/css/frontend.css"> href="<?php echo $this->config->base_url(); ?>assets/css/frontend.css">
<link
rel="stylesheet"
type="text/css"
href="<?php echo $this->config->base_url(); ?>assets/css/general.css">
<?php <?php
// ------------------------------------------------------------ // ------------------------------------------------------------

View file

@ -3,7 +3,14 @@
Powered by Powered by
<a href="http://easyappointments.org"> <a href="http://easyappointments.org">
Easy!Appointments Easy!Appointments
v<?php echo $this->config->item('ea_version'); ?> <?php
echo 'v' . $this->config->item('ea_version');
$release_title = $this->config->item('ea_release_title');
if ($release_title != '') {
echo ' - ' . $release_title;
}
?>
</a> | </a> |
Licensed Under GPLv3 Licensed Under GPLv3
</div> </div>

View file

@ -129,8 +129,9 @@
<?php // LOGOUT MENU ITEM <?php // LOGOUT MENU ITEM
// ------------------------------------------------------ ?> // ------------------------------------------------------ ?>
<a href="<?php echo $base_url; ?>user/logout" class="menu-item"> <a href="<?php echo $base_url; ?>user/logout" class="menu-item"
Logout title="Log out of the system.">
Log Out
</a> </a>
</div> </div>

View file

@ -81,22 +81,22 @@
<input type="hidden" id="service-id" /> <input type="hidden" id="service-id" />
<label for="service-name">Name *</label> <label for="service-name">Name *</label>
<input type="text" id="service-name" class="span6 required" /> <input type="text" id="service-name" class="span12 required" />
<label for="service-duration">Duration (Minutes) *</label> <label for="service-duration">Duration (Minutes) *</label>
<input type="text" id="service-duration" class="required" /> <input type="text" id="service-duration" class="required" />
<label for="service-price">Price *</label> <label for="service-price">Price *</label>
<input type="text" id="service-price" class="required" /> <input type="text" id="service-price" class="span12 required" />
<label for="service-currency">Currency</label> <label for="service-currency">Currency</label>
<input type="text" id="service-currency" class="" /> <input type="text" id="service-currency" class="span12" />
<label for="service-category">Category</label> <label for="service-category">Category</label>
<select id="service-category"></select> <select id="service-category" class="span12"></select>
<label for="service-description">Description</label> <label for="service-description">Description</label>
<textarea id="service-description" rows="4" class="span6"></textarea> <textarea id="service-description" rows="4" class="span12"></textarea>
<br/><br/> <br/><br/>
<em id="form-message" class="text-error">Fields with * are required!</em> <em id="form-message" class="text-error">Fields with * are required!</em>
@ -158,10 +158,10 @@
<input type="hidden" id="category-id" /> <input type="hidden" id="category-id" />
<label for="category-name">Name *</label> <label for="category-name">Name *</label>
<input type="text" id="category-name" class="span7 required" /> <input type="text" id="category-name" class="span12 required" />
<label for="category-description">Description</label> <label for="category-description">Description</label>
<textarea id="category-description" rows="4" class="span7"></textarea> <textarea id="category-description" rows="4" class="span12"></textarea>
</div> </div>
</div> </div>
</div> </div>

View file

@ -39,7 +39,7 @@
<?php } ?> <?php } ?>
<?php if ($privileges[PRIV_USER_SETTINGS]['view'] == TRUE) { ?> <?php if ($privileges[PRIV_USER_SETTINGS]['view'] == TRUE) { ?>
<li class="user-tab tab"><a>User</a></li> <li class="user-tab tab"><a>Current User</a></li>
<?php } ?> <?php } ?>
</ul> </ul>
@ -61,22 +61,23 @@
<?php } ?> <?php } ?>
</legend> </legend>
<div class="wrapper">
<label for="company-name">Company Name *</label> <label for="company-name">Company Name *</label>
<input type="text" id="company-name" data-field="company_name" class="required span4"> <input type="text" id="company-name" data-field="company_name" class="required span12">
<span class="help-block">Company name will be displayed everywhere on the system <span class="help-block">Company name will be displayed everywhere on the system
(required).</span> (required).</span>
<br> <br>
<label for="company-email">Company Email *</label> <label for="company-email">Company Email *</label>
<input type="text" id="company-email" data-field="company_email" class="required span4"> <input type="text" id="company-email" data-field="company_email" class="required span12">
<span class="help-block">This will be the company email address. It will be used <span class="help-block">This will be the company email address. It will be used
as the sender and the reply address of the system emails (required).</span> as the sender and the reply address of the system emails (required).</span>
<br> <br>
<label for="company-link">Company Link *</label> <label for="company-link">Company Link *</label>
<input type="text" id="company-link" data-field="company_link" class="required span4"> <input type="text" id="company-link" data-field="company_link" class="required span12">
<span class="help-block">Company link should point to the official website of <span class="help-block">Company link should point to the official website of
the company (optional).</span> the company (optional).</span>
@ -86,6 +87,7 @@
<i class="icon-calendar icon-white"></i> <i class="icon-calendar icon-white"></i>
Go To Booking Page Go To Booking Page
</a> </a>
</div>
</fieldset> </fieldset>
</form> </form>
</div> </div>
@ -109,7 +111,7 @@
</legend> </legend>
<div class="row-fluid"> <div class="row-fluid">
<div class="span7"> <div class="span7 working-plan-wrapper">
<h4>Working Plan</h4> <h4>Working Plan</h4>
<span class="help-block"> <span class="help-block">
Mark below the days and hours that your company will accept appointments. Mark below the days and hours that your company will accept appointments.
@ -179,7 +181,7 @@
<input type="text" id="book-advance-timeout" data-field="book_advance_timeout" /> <input type="text" id="book-advance-timeout" data-field="book_advance_timeout" />
</div> </div>
<div class="span5"> <div class="span5 breaks-wrapper">
<h4>Breaks</h4> <h4>Breaks</h4>
<span class="help-block"> <span class="help-block">
@ -224,7 +226,7 @@
<?php $hidden = ($privileges[PRIV_USER_SETTINGS]['view'] == TRUE) ? '' : 'hidden'; ?> <?php $hidden = ($privileges[PRIV_USER_SETTINGS]['view'] == TRUE) ? '' : 'hidden'; ?>
<div id="user" class="tab-content <?php echo $hidden; ?>"> <div id="user" class="tab-content <?php echo $hidden; ?>">
<form class="row-fluid"> <form class="row-fluid">
<fieldset class="span5"> <fieldset class="span5 personal-info-wrapper">
<legend> <legend>
Personal Info Personal Info
<?php if ($privileges[PRIV_USER_SETTINGS]['edit'] == TRUE) { ?> <?php if ($privileges[PRIV_USER_SETTINGS]['edit'] == TRUE) { ?>
@ -265,7 +267,7 @@
<textarea id="notes" class="span9" rows="3"></textarea> <textarea id="notes" class="span9" rows="3"></textarea>
</fieldset> </fieldset>
<fieldset class="span5"> <fieldset class="span5 miscellaneous-wrapper">
<legend>Miscellaneous</legend> <legend>Miscellaneous</legend>
<label for="username">Username *</label> <label for="username">Username *</label>

View file

@ -32,6 +32,8 @@ root {
font-size: 20px; font-size: 20px;
color: white; color: white;
margin-top: 16px; margin-top: 16px;
font-weight: bold;
text-shadow: 1px 1px 0px rgb(32, 99, 48);
} }
#header #header-menu { #header #header-menu {
@ -43,23 +45,26 @@ root {
#header #header-menu .menu-item { #header #header-menu .menu-item {
float: left; float: left;
margin-right: 8px; margin-right: 8px;
margin-top: 10px; margin-top: 11px;
padding: 15px 12px; padding: 13px 12px;
min-width: 68px; min-width: 68px;
text-align: center; text-align: center;
font-weight: bold; font-weight: bold;
color: #FFF; color: #FFF;
text-decoration: none; text-decoration: none;
font-size: 16px; font-size: 16px;
border-radius: 3px;
} }
#header #header-menu .menu-item:hover:not(.active) { #header #header-menu .menu-item:hover:not(.active) {
background-color: #247A4B; background-color: #2A8F57;
border-bottom: 2px solid #2E7244;
} }
#header #header-menu .active { #header #header-menu .active {
color: #E7FFB3; color: #C5FFD6;
text-shadow: 1px 1px 0px #57814D; background: #29A067;
border-bottom: 2px solid #2A7751;
} }
#footer { #footer {
@ -154,6 +159,13 @@ body .ui-dialog .ui-dialog-buttonpane {
background: #FFFFC2 !important; background: #FFFFC2 !important;
} }
.working-plan td {
vertical-align: middle;
}
.breaks td {
vertical-align: middle;
}
/* BACKEND CALENDAR PAGE /* BACKEND CALENDAR PAGE
-------------------------------------------------------------------- */ -------------------------------------------------------------------- */
@ -278,8 +290,13 @@ body .ui-dialog .ui-dialog-buttonpane {
/* BACKEND CUSTOMERS PAGE /* BACKEND CUSTOMERS PAGE
-------------------------------------------------------------------- */ -------------------------------------------------------------------- */
#customers-page h2 {
color: #525252;
}
#customers-page #filter-customers { #customers-page #filter-customers {
margin: 15px 0px 15px 15px; margin: 15px 0px 15px 15px;
width: 350px;
} }
#customers-page .filter-records .results { #customers-page .filter-records .results {
@ -289,11 +306,11 @@ body .ui-dialog .ui-dialog-buttonpane {
} }
#customers-page #filter-customers .results .customer-row { #customers-page #filter-customers .results .customer-row {
padding: 10px 7px; border-radius: 3px; padding: 10px 7px;
} }
#customers-page #filter-customers .results .customer-row:hover { #customers-page #filter-customers .results .customer-row:hover:not(.selected-row) {
background-color: #C6E7D5; background-color: #F3F3F3;
cursor: pointer; cursor: pointer;
} }
@ -303,6 +320,7 @@ body .ui-dialog .ui-dialog-buttonpane {
#customers-page .details { #customers-page .details {
margin: 15px 0 15px 15px; margin: 15px 0 15px 15px;
max-width: 710px;
} }
#customers-page .details .btn-toolbar { #customers-page .details .btn-toolbar {
@ -315,22 +333,32 @@ body .ui-dialog .ui-dialog-buttonpane {
#customers-page #customer-appointments { #customers-page #customer-appointments {
height: 250px; height: 250px;
border: 1px solid #CCC; width: 330px;
border-radius: 3px; border: 4px solid #E2E2E2;
margin-bottom: 20px; margin-bottom: 20px;
overflow-y: auto; overflow-y: auto;
} }
#customers-page #customer-appointments .appointment-row { #customers-page #customer-appointments .appointment-row {
padding: 7px; padding: 7px;
border-bottom: 1px solid #CCC; border-bottom: 4px solid #E2E2E2;;
} }
#customers-page #customer-appointments .appointment-row:hover { #customers-page #customer-appointments .appointment-row:hover:not(.selected-row) {
background-color: #C6E7D5; background-color: #F3F3F3;
cursor: pointer; cursor: pointer;
} }
#customers-page #appointment-details {
width: 338px;
}
#customers-page #appointment-details div {
padding: 10px;
background: #F8F8F8;
border-bottom: 4px solid #EEE;
}
#customers-page .details input, #customers-page .details input,
#customers-page .details textarea { #customers-page .details textarea {
background-color: white; background-color: white;
@ -338,12 +366,16 @@ body .ui-dialog .ui-dialog-buttonpane {
} }
#customers-page .selected-row { #customers-page .selected-row {
background-color: #EFFDF7; background-color: #CBFFD8;
} }
/* BACKEND SERVICES PAGE /* BACKEND SERVICES PAGE
-------------------------------------------------------------------- */ -------------------------------------------------------------------- */
#services-page h2 {
color: #525252;
}
#services-page .tab-content { #services-page .tab-content {
margin: 15px; margin: 15px;
} }
@ -356,6 +388,10 @@ body .ui-dialog .ui-dialog-buttonpane {
cursor: pointer; cursor: pointer;
} }
#services-page .filter-records {
width: 350px;
}
#services-page .filter-records .results { #services-page .filter-records .results {
overflow-y: auto; overflow-y: auto;
max-height: 650px; max-height: 650px;
@ -364,16 +400,15 @@ body .ui-dialog .ui-dialog-buttonpane {
#services-page .service-row { #services-page .service-row {
padding: 10px 7px; padding: 10px 7px;
border-radius: 3px;
} }
#services-page .service-row:hover { #services-page .service-row:hover:not(.selected-row) {
cursor: pointer; cursor: pointer;
background-color: #C6E7D5; background-color: #F3F3F3;
} }
#services-page .selected-row { #services-page .selected-row {
background-color: #EFFDF7; background-color: #CBFFD8;
} }
#services-page .filter-records .results hr { #services-page .filter-records .results hr {
@ -406,11 +441,10 @@ body .ui-dialog .ui-dialog-buttonpane {
#services-page #categories .category-row { #services-page #categories .category-row {
padding: 10px 7px; padding: 10px 7px;
border-radius: 3px;
} }
#services-page #categories .category-row:hover { #services-page #categories .category-row:hover:not(.selected-row) {
background-color: #C6E7D5; background-color: #F3F3F3;
cursor: pointer; cursor: pointer;
} }
@ -421,8 +455,16 @@ body .ui-dialog .ui-dialog-buttonpane {
box-shadow: none; box-shadow: none;
} }
#services-page .details {
max-width: 370px;
}
/* BACKEND USERS PAGE /* BACKEND USERS PAGE
-------------------------------------------------------------------- */ -------------------------------------------------------------------- */
#users-page h2 {
color: #525252;
}
#users-page .tab-content { #users-page .tab-content {
margin: 15px; margin: 15px;
} }
@ -435,6 +477,10 @@ body .ui-dialog .ui-dialog-buttonpane {
cursor: pointer; cursor: pointer;
} }
#users-page .filter-records {
width: 380px;
}
#users-page .filter-records .results { #users-page .filter-records .results {
overflow-y: auto; overflow-y: auto;
max-height: 650px; max-height: 650px;
@ -445,18 +491,17 @@ body .ui-dialog .ui-dialog-buttonpane {
#users-page .provider-row, #users-page .provider-row,
#users-page .admin-row { #users-page .admin-row {
padding: 10px 7px; padding: 10px 7px;
border-radius: 3px;
} }
#users-page .secretary-row:hover, #users-page .secretary-row:hover:not(.selected-row),
#users-page .provider-row:hover, #users-page .provider-row:hover:not(.selected-row),
#users-page .admin-row:hover { #users-page .admin-row:hover:not(.selected-row) {
cursor: pointer; cursor: pointer;
background-color: #C6E7D5; background-color: #F3F3F3;
} }
#users-page .selected-row { #users-page .selected-row {
background-color: #EFFDF7; background-color: #CBFFD8;
} }
#users-page .details input, #users-page .details input,
@ -475,8 +520,8 @@ body .ui-dialog .ui-dialog-buttonpane {
#users-page #secretary-providers, #users-page #secretary-providers,
#users-page #provider-services { #users-page #provider-services {
border: 2px solid #ccc; border: 4px solid #ccc;
width: 320px; width: 340px;
height: 140px; height: 140px;
overflow-y: scroll; overflow-y: scroll;
padding: 7px; padding: 7px;
@ -536,8 +581,22 @@ padding: 4px 7px;
#users-page .filter-records .results hr { #users-page .filter-records .results hr {
margin: 5px 0; margin: 5px 0;
} }
#users-page .details {
max-width: 700px;
}
#users-page .working-plan td input[type="text"] {
width: 85px;
margin-bottom: 0px;
}
/* BACKEND SETTINGS PAGE /* BACKEND SETTINGS PAGE
-------------------------------------------------------------------- */ -------------------------------------------------------------------- */
#settings-page h2 {
color: #525252;
}
#settings-page .tab-content { #settings-page .tab-content {
margin: 15px; margin: 15px;
} }
@ -553,6 +612,7 @@ padding: 4px 7px;
#business-logic .working-plan td input[type="text"] { #business-logic .working-plan td input[type="text"] {
margin-bottom: 0; margin-bottom: 0;
cursor: pointer; cursor: pointer;
width: 85px;
} }
#business-logic .working-plan label.checkbox { #business-logic .working-plan label.checkbox {
@ -581,13 +641,35 @@ padding: 4px 7px;
#business-logic #book-advance-timeout { #business-logic #book-advance-timeout {
margin: 0; margin: 0;
width: 131px;
} }
#business-logic .ui-spinner { #business-logic .ui-spinner {
border: none; border: none;
width: 145px;
} }
#settings-page #user-notifications.active { #settings-page #user-notifications.active {
background: #B6DCFF; background: #B6DCFF;
box-shadow: none; box-shadow: none;
} }
#settings-page #general fieldset .wrapper {
max-width: 400px;
}
#settings-page .working-plan-wrapper {
max-width: 600px;
}
#settings-page .breaks-wrapper {
max-width: 500px;
}
#settings-page .personal-info-wrapper {
max-width: 400px;
}
#settings-page .miscellaneous-wrapper {
max-width: 400px;
}

View file

@ -1,3 +1,12 @@
body .custom-qtip {
border: 2px solid #AFD8C1;
background: #EFFDF6;
font-size: 12px;
line-height: 20px;
color: #258D53;
border-radius: 6px;
}
/* JQUERY UI DATETIME PICKER ADDON /* JQUERY UI DATETIME PICKER ADDON
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; } .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }

View file

@ -13,6 +13,16 @@ $(document).ready(function() {
$(document).ajaxStop(function() { $(document).ajaxStop(function() {
$('#loading').hide(); $('#loading').hide();
}); });
$('.menu-item').qtip({
position: {
my: 'top center',
at: 'bottom center'
},
style: {
classes: 'qtip-green qtip-shadow custom-qtip'
}
});
}); });
/** /**

View file

@ -101,6 +101,10 @@ var BackendCalendar = {
$('#select-filter-item').prop('disabled', true); $('#select-filter-item').prop('disabled', true);
} }
if (GlobalVariables.user.role_slug == Backend.DB_SLUG_SECRETARY) {
$('#select-filter-item optgroup:eq(1)').remove();
}
if (GlobalVariables.user.role_slug == Backend.DB_SLUG_SECRETARY) { if (GlobalVariables.user.role_slug == Backend.DB_SLUG_SECRETARY) {
// Remove the providers that are not connected to the secretary. // Remove the providers that are not connected to the secretary.
$('#select-filter-item option[type="provider"]').each(function(index, option) { $('#select-filter-item option[type="provider"]').each(function(index, option) {
@ -160,6 +164,27 @@ var BackendCalendar = {
$dialog.modal('show'); $dialog.modal('show');
} }
// Apply qtip to control tooltips.
$('#calendar-toolbar button').qtip({
position: {
my: 'top center',
at: 'bottom center'
},
style: {
classes: 'qtip-green qtip-shadow custom-qtip'
}
});
$('#select-filter-item').qtip({
position: {
my: 'middle left',
at: 'middle right'
},
style: {
classes: 'qtip-green qtip-shadow custom-qtip'
}
});
}, },
/** /**
@ -380,8 +405,8 @@ var BackendCalendar = {
GeneralFunctions.displayMessageBox('Delete Appointment', 'Please take a minute ' GeneralFunctions.displayMessageBox('Delete Appointment', 'Please take a minute '
+ 'to write the reason you are deleting the appointment:', messageButtons); + 'to write the reason you are deleting the appointment:', messageButtons);
$('#message_box').append('<textarea id="delete-reason"></textarea>'); $('#message_box').append('<textarea id="delete-reason" rows="3"></textarea>');
$('#delete-reason').css('width', '320px'); $('#delete-reason').css('width', '353px');
} else { } else {
// Do not display confirmation promt. // Do not display confirmation promt.
var postUrl = GlobalVariables.baseUrl + 'backend_api/ajax_delete_unavailable'; var postUrl = GlobalVariables.baseUrl + 'backend_api/ajax_delete_unavailable';

View file

@ -343,6 +343,8 @@ CustomersHelper.prototype.display = function(customer) {
$('#customer-appointments').append(html); $('#customer-appointments').append(html);
}); });
$('#customer-appointments').jScrollPane({ mouseWheelSpeed: 70 }); $('#customer-appointments').jScrollPane({ mouseWheelSpeed: 70 });
$('#appointment-details').empty();
}; };
/** /**

View file

@ -96,7 +96,6 @@ var BackendSettings = {
$('#user').find('button').prop('disabled', true); $('#user').find('button').prop('disabled', true);
} }
Backend.placeFooterToBottom(); Backend.placeFooterToBottom();
}, },
@ -152,9 +151,40 @@ var BackendSettings = {
var settings = BackendSettings.settings.get(); var settings = BackendSettings.settings.get();
BackendSettings.settings.save(settings); BackendSettings.settings.save(settings);
////////////////////////////////////////////// //////////////////////////////////////////////
console.log('Settings To Save: ', settings); //console.log('Settings To Save: ', settings);
////////////////////////////////////////////// //////////////////////////////////////////////
}); });
/**
* Event: Username "Focusout"
*
* When the user leaves the username input field we will need to check if the username
* is not taken by another record in the system. Usernames must be unique.
*/
$('#username').focusout(function() {
var $input = $(this);
if ($input.prop('readonly') == true || $input.val() == '') return;
var postUrl = GlobalVariables.baseUrl + 'backend_api/ajax_validate_username';
var postData = {
'username': $input.val(),
'record_exists': ($input.parents().eq(2).find('#user-id').val() != '') ? true : false
};
$.post(postUrl, postData, function(response) {
///////////////////////////////////////////////////////
//console.log('Validate Username Response:', response);
///////////////////////////////////////////////////////
if (!GeneralFunctions.handleAjaxExceptions(response)) return;
if (response == false) {
$input.css('border', '2px solid red');
Backend.displayNotification('Username already exists.');
} else {
$input.css('border', '');
}
}, 'json');
});
} }
}; };
@ -185,6 +215,16 @@ SystemSettings.prototype.save = function(settings) {
if (!GeneralFunctions.handleAjaxExceptions(response)) return; if (!GeneralFunctions.handleAjaxExceptions(response)) return;
Backend.displayNotification('Settings saved successfully!'); Backend.displayNotification('Settings saved successfully!');
// Update the logo title on the header.
$('#header-logo span').text($('#company-name').val());
// We need to refresh the working plan.
var workingPlan = BackendSettings.wp.get();
$('.breaks').empty();
BackendSettings.wp.setup(workingPlan);
BackendSettings.wp.timepickers(false);
}, 'json'); }, 'json');
}; };
@ -317,6 +357,9 @@ UserSettings.prototype.save = function(settings) {
if (!GeneralFunctions.handleAjaxExceptions(response)) return; if (!GeneralFunctions.handleAjaxExceptions(response)) return;
Backend.displayNotification('Settings saved successfully!'); Backend.displayNotification('Settings saved successfully!');
// Update footer greetings.
$('#footer-user-display-name').text('Hello, ' + $('#first-name').val() + ' ' + $('#last-name').val());
}, 'json'); }, 'json');
}; };

View file

@ -58,6 +58,16 @@ var BackendUsers = {
}); });
$('#secretary-providers').jScrollPane({ mouseWheelSpeed: 70 }); $('#secretary-providers').jScrollPane({ mouseWheelSpeed: 70 });
$('#reset-working-plan').qtip({
position: {
my: 'top center',
at: 'bottom center'
},
style: {
classes: 'qtip-green qtip-shadow custom-qtip'
}
});
// Bind event handlers. // Bind event handlers.
if (defaultEventHandlers) BackendUsers.bindEventHandlers(); if (defaultEventHandlers) BackendUsers.bindEventHandlers();
}, },

View file

@ -72,6 +72,7 @@ ProvidersHelper.prototype.bindEventHandlers = function() {
$('#providers .details').find('input, textarea').prop('readonly', false); $('#providers .details').find('input, textarea').prop('readonly', false);
$('#provider-password, #provider-password-confirm').addClass('required'); $('#provider-password, #provider-password-confirm').addClass('required');
$('#provider-notifications').prop('disabled', false); $('#provider-notifications').prop('disabled', false);
$('#providers').find('.add-break, .edit-break, .delete-break, #reset-working-plan').prop('disabled', false);
$('#provider-services input[type="checkbox"]').prop('disabled', false); $('#provider-services input[type="checkbox"]').prop('disabled', false);
$('#providers input[type="checkbox"]').prop('disabled', false); $('#providers input[type="checkbox"]').prop('disabled', false);

View file

@ -305,21 +305,11 @@ var FrontendBook = {
//console.log('Get Available Hours JSON Response:', response); //console.log('Get Available Hours JSON Response:', response);
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
if (response.exceptions) { if (!GeneralFunctions.handleAjaxExceptions(response)) return;
// Display a friendly message to the user with the exceptions information.
response.exceptions = GeneralFunctions.parseExceptions(response.exceptions);
GeneralFunctions.displayMessageBox('Unexpected Error', 'An unexpected '
+ 'error occured during the available hours calculation. Please '
+ 'refresh the page and try again.');
$('#message_box').append(GeneralFunctions.exceptionsToHtml(response.exceptions));
console.log('Get Available Hours Exceptions:', response.exceptions);
return;
}
// The response contains the available hours for the selected provider and // The response contains the available hours for the selected provider and
// service. Fill the available hours div with response data. // service. Fill the available hours div with response data.
if (response.length > 0) { if (response.length > 0) {
var currColumn = 1; var currColumn = 1;
$('#available-hours').html('<div style="width:50px; float:left;"></div>'); $('#available-hours').html('<div style="width:50px; float:left;"></div>');

View file

@ -230,7 +230,7 @@ INSERT INTO `ea_roles` (`id`, `name`, `slug`, `is_admin`, `appointments`, `custo
(1, 'Administrator', 'admin', 1, 15, 15, 15, 15, 15, 15), (1, 'Administrator', 'admin', 1, 15, 15, 15, 15, 15, 15),
(2, 'Provider', 'provider', 0, 15, 15, 0, 0, 0, 15), (2, 'Provider', 'provider', 0, 15, 15, 0, 0, 0, 15),
(3, 'Customer', 'customer', 0, 0, 0, 0, 0, 0, 0), (3, 'Customer', 'customer', 0, 0, 0, 0, 0, 0, 0),
(4, 'Secretary', 'secretary', 0, 15, 15, 0, 0, 15, 15); (4, 'Secretary', 'secretary', 0, 15, 15, 0, 0, 0, 15);
INSERT INTO `ea_settings` (`name`, `value`) VALUES INSERT INTO `ea_settings` (`name`, `value`) VALUES
('company_working_plan', '{"monday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"tuesday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"wednesday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"thursday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"friday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"saturday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"sunday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]}}'), ('company_working_plan', '{"monday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"tuesday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"wednesday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"thursday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"friday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"saturday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"sunday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]}}'),