* Completed the installation process.

* Added tooltip texts on the common controls of backend.
* GUI fixes on several pages.
This commit is contained in:
alextselegidis@gmail.com 2013-10-17 15:31:43 +00:00
parent dcecfd896d
commit 8f90da86be
21 changed files with 237 additions and 108 deletions

View file

@ -19,6 +19,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.
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View file

@ -646,35 +646,31 @@ class Appointments extends CI_Controller {
$this->db->query($query); $this->db->query($query);
} }
//$this->db->reconnect(); // Insert admin
$this->load->model('admins_model');
$admin = json_decode($_POST['admin'], true); $admin = json_decode($_POST['admin'], true);
$admin_role_id = $this->db->get_where('ea_roles', array('slug' => DB_SLUG_ADMIN))->row()->id; $admin['settings']['username'] = $admin['username'];
$admin = json_decode($_POST['admin'], true); $admin['settings']['password'] = $admin['password'];
$this->db->query('INSERT INTO `ea_users` (`first_name`, `last_name`, `email`, `phone_number`, `id_roles`) VALUES ' unset($admin['username'], $admin['password']);
. '("' . $admin['first_name'] . '", "' . $admin['last_name'] . '", "' . $admin['email'] . '", "' . $admin['phone_number'] . '", "' . $admin_role_id . '");'); $this->admins_model->add($admin);
$this->db->query('INSERT INTO `ea_user_settings` (`id_users`, `username`, `password`) VALUES '
. '("' . $this->db->insert_id() . '", "' . $admin['username'] . '", "' . $admin['password'] . '");');
// // Insert admin
// $this->load->model('admins_model');
// $admin = json_decode($_POST['admin'], true);
// $admin['settings']['username'] = $admin['username'];
// $admin['settings']['password'] = $admin['password'];
// unset($admin['username'], $admin['password']);
// $this->admins_model->add($admin);
// Save company settings // Save company settings
$this->load->model('settings_model');
$company = json_decode($_POST['company'], true); $company = json_decode($_POST['company'], true);
$this->db->query('INSERT INTO `ea_settings` (`name`, `value`) VALUES ' $this->settings_model->set_setting('company_name', $company['company_name']);
. '("company_name", "' . $company['company_name'] . '"),' $this->settings_model->set_setting('company_email', $company['company_email']);
. '("company_email", "' . $company['company_email'] . '"),' $this->settings_model->set_setting('company_link', $company['company_link']);
. '("company_link", "' . $company['company_link'] . '");');
// $this->load->model('settings_model'); // Try to send a notification email for the new installation.
// $company = json_decode($_POST['company'], true); // IMPORTANT: THIS WILL ONLY BE USED TO TRACK THE INSTALLATION NUMBER AND
// $this->settings_model->set_setting('company_name', $company['company_name']); // NO PERSONAL DATA WILL BE USED FOR OTHER CAUSE.
// $this->settings_model->set_setting('company_email', $company['company_email']); try {
// $this->settings_model->set_setting('company_link', $company['company_link']); $this->load->library('notifications');
$this->notifications->send_new_installation($company['company_name'],
$company['company_email'], $company['company_link']);
} catch(Exception $exc) {
// Well, I guess we'll never know ...
}
echo json_encode(AJAX_SUCCESS); echo json_encode(AJAX_SUCCESS);

View file

@ -188,13 +188,13 @@ class Notifications {
// :: SETUP EMAIL OBJECT AND SEND NOTIFICATION // :: SETUP EMAIL OBJECT AND SEND NOTIFICATION
$mail = new PHPMailer(); $mail = new PHPMailer();
$mail->From = $company_settings['company_email']; $mail->From = $company_settings['company_email'];
$mail->FromName = $company_settings['company_name']; $mail->FromName = $company_settings['company_name'];
$mail->AddAddress($email); // "Name" argument crushes the phpmailer class. $mail->AddAddress($email); // "Name" argument crushes the phpmailer class.
$mail->IsHTML(true); $mail->IsHTML(true);
$mail->CharSet = 'UTF-8'; $mail->CharSet = 'UTF-8';
$mail->Subject = 'New Account Password'; $mail->Subject = 'New Account Password';
$mail->Body = $email_html; $mail->Body = $email_html;
if (!$mail->Send()) { if (!$mail->Send()) {
throw new Exception('Email could not been sent. ' throw new Exception('Email could not been sent. '
@ -203,6 +203,30 @@ class Notifications {
return TRUE; return TRUE;
} }
/**
* Sends a simple email to notify for a new installation.
*
* This method will be only used for tracking the number of installations. No personal
* data will be retrieved for any other cause.
*
* @returns bool Returns the "send()" method result.
*/
public function send_new_installation($company_name, $company_email, $company_link) {
$mail = new PHPMailer();
$mail->From = $company_email;
$mail->FromName = 'New Installation: ' . $company_name ;
$mail->AddAddress('info@easyappointments.org');
$mail->IsHTML(true);
$mail->CharSet = 'UTF-8';
$mail->Subject = 'New Easy!Appointments Installation';
$mail->Body = 'Base URL: ' . $this->CI->config->item('base_url') . '<br>'
. 'E!A Version: ' . $this->CI->config->item('ea_version') . '<br>'
. 'Company Name: ' . $company_name . '<br>'
. 'Company Email: ' . $company_email . '<br>'
. 'Company Link: ' . $company_link . '<br>';
return $mail->Send();
}
} }
/* End of file notifications.php */ /* End of file notifications.php */

View file

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Book Appointment | <?php echo $company_name; ?></title> <title>Book Appointment With <?php echo $company_name; ?></title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta http-equiv="content-type" content="text/html; charset=UTF-8">
<?php <?php

View file

@ -36,7 +36,7 @@
<div id="calendar-toolbar"> <div id="calendar-toolbar">
<div id="calendar-filter"> <div id="calendar-filter">
<label for="select-filter-item">Display Calendar</label> <label for="select-filter-item">Display Calendar</label>
<select id="select-filter-item"></select> <select id="select-filter-item" title="Select a provider or a service and view the appointments on the calendar."></select>
</div> </div>
<div id="calendar-actions"> <div id="calendar-actions">
@ -100,16 +100,16 @@
<input id="appointment-id" type="hidden" /> <input id="appointment-id" type="hidden" />
<div class="control-group"> <div class="control-group">
<label for="select-service" class="control-label">Service</label> <label for="select-service" class="control-label">Service *</label>
<div class="controls"> <div class="controls">
<select id="select-service"></select> <select id="select-service" class="required"></select>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
<label for="select-provider" class="control-label">Provider</label> <label for="select-provider" class="control-label">Provider *</label>
<div class="controls"> <div class="controls">
<select id="select-provider"></select> <select id="select-provider" class="required"></select>
</div> </div>
</div> </div>

View file

@ -26,7 +26,7 @@
<div id="customers-page" class="row-fluid"> <div id="customers-page" class="row-fluid">
<div id="filter-customers" class="filter-records column span4"> <div id="filter-customers" class="filter-records column span4">
<form class="input-append"> <form class="input-append">
<input class="key span8" type="text" /> <input class="key span7" type="text" />
<button class="filter btn" type="submit"> <button class="filter btn" type="submit">
<i class="icon-filter"></i> <i class="icon-filter"></i>
Filter Filter
@ -41,7 +41,7 @@
<div class="results"></div> <div class="results"></div>
</div> </div>
<div id="details" class="span7 row-fluid"> <div class="details span7 row-fluid">
<div class="btn-toolbar"> <div class="btn-toolbar">
<div id="add-edit-delete-group" class="btn-group"> <div id="add-edit-delete-group" class="btn-group">
<?php if ($privileges[PRIV_CUSTOMERS]['add'] == TRUE) { ?> <?php if ($privileges[PRIV_CUSTOMERS]['add'] == TRUE) { ?>

View file

@ -1,8 +1,10 @@
<div id="footer"> <div id="footer">
<div id="footer-content"> <div id="footer-content">
Powered by <a href="http://easyappointments.org">Easy!Appointments</a> | Powered by
Copyright &copy; <?php echo date('Y'); ?> <a href="http://easyappointments.org">
<a href="http://alextselegidis.com">Alex Tselegidis</a> | Easy!Appointments
v<?php echo $this->config->item('ea_version'); ?>
</a> |
Licensed Under GPLv3 Licensed Under GPLv3
</div> </div>

View file

@ -85,7 +85,8 @@
// ------------------------------------------------------ ?> // ------------------------------------------------------ ?>
<?php $hidden = ($privileges[PRIV_APPOINTMENTS]['view'] == TRUE) ? '' : 'hidden'; ?> <?php $hidden = ($privileges[PRIV_APPOINTMENTS]['view'] == TRUE) ? '' : 'hidden'; ?>
<?php $active = ($active_menu == PRIV_APPOINTMENTS) ? 'active' : ''; ?> <?php $active = ($active_menu == PRIV_APPOINTMENTS) ? 'active' : ''; ?>
<a href="<?php echo $base_url; ?>backend" class="menu-item <?php echo $hidden; ?><?php echo $active; ?>"> <a href="<?php echo $base_url; ?>backend" class="menu-item <?php echo $hidden; ?><?php echo $active; ?>"
title="Manage all the appointment records of the available providers and services.">
Calendar Calendar
</a> </a>
@ -93,7 +94,8 @@
// ------------------------------------------------------ ?> // ------------------------------------------------------ ?>
<?php $hidden = ($privileges[PRIV_CUSTOMERS]['view'] == TRUE) ? '' : 'hidden'; ?> <?php $hidden = ($privileges[PRIV_CUSTOMERS]['view'] == TRUE) ? '' : 'hidden'; ?>
<?php $active = ($active_menu == PRIV_CUSTOMERS) ? 'active' : ''; ?> <?php $active = ($active_menu == PRIV_CUSTOMERS) ? 'active' : ''; ?>
<a href="<?php echo $base_url; ?>backend/customers" class="menu-item <?php echo $hidden; ?><?php echo $active; ?>"> <a href="<?php echo $base_url; ?>backend/customers" class="menu-item <?php echo $hidden; ?><?php echo $active; ?>"
title="Manage the registered customers and view their booking history.">
Customers Customers
</a> </a>
@ -101,7 +103,8 @@
// ------------------------------------------------------ ?> // ------------------------------------------------------ ?>
<?php $hidden = ($privileges[PRIV_SERVICES]['view'] == TRUE) ? '' : 'hidden'; ?> <?php $hidden = ($privileges[PRIV_SERVICES]['view'] == TRUE) ? '' : 'hidden'; ?>
<?php $active = ($active_menu == PRIV_SERVICES) ? 'active' : ''; ?> <?php $active = ($active_menu == PRIV_SERVICES) ? 'active' : ''; ?>
<a href="<?php echo $base_url; ?>backend/services" class="menu-item <?php echo $hidden; ?><?php echo $active; ?>"> <a href="<?php echo $base_url; ?>backend/services" class="menu-item <?php echo $hidden; ?><?php echo $active; ?>"
title="Manage the available services and categories of the system.">
Services Services
</a> </a>
@ -109,7 +112,8 @@
// ------------------------------------------------------ ?> // ------------------------------------------------------ ?>
<?php $hidden = ($privileges[PRIV_USERS]['view'] == TRUE) ? '' : 'hidden'; ?> <?php $hidden = ($privileges[PRIV_USERS]['view'] == TRUE) ? '' : 'hidden'; ?>
<?php $active = ($active_menu == PRIV_USERS) ? 'active' : ''; ?> <?php $active = ($active_menu == PRIV_USERS) ? 'active' : ''; ?>
<a href="<?php echo $base_url; ?>backend/users" class="menu-item <?php echo $hidden; ?><?php echo $active; ?>"> <a href="<?php echo $base_url; ?>backend/users" class="menu-item <?php echo $hidden; ?><?php echo $active; ?>"
title="Manage the backend users (admins, providers, secretaries).">
Users Users
</a> </a>
@ -118,7 +122,8 @@
<?php $hidden = ($privileges[PRIV_SYSTEM_SETTINGS]['view'] == TRUE <?php $hidden = ($privileges[PRIV_SYSTEM_SETTINGS]['view'] == TRUE
|| $privileges[PRIV_USER_SETTINGS]['view'] == TRUE) ? '' : 'hidden'; ?> || $privileges[PRIV_USER_SETTINGS]['view'] == TRUE) ? '' : 'hidden'; ?>
<?php $active = ($active_menu == PRIV_SYSTEM_SETTINGS) ? 'active' : ''; ?> <?php $active = ($active_menu == PRIV_SYSTEM_SETTINGS) ? 'active' : ''; ?>
<a href="<?php echo $base_url; ?>backend/settings" class="menu-item <?php echo $hidden; ?><?php echo $active; ?>"> <a href="<?php echo $base_url; ?>backend/settings" class="menu-item <?php echo $hidden; ?><?php echo $active; ?>"
title="Set system and user settings.">
Settings Settings
</a> </a>

View file

@ -36,7 +36,7 @@
<?php // FILTER SERVICES ?> <?php // FILTER SERVICES ?>
<div id="filter-services" class="filter-records column span4"> <div id="filter-services" class="filter-records column span4">
<form class="input-append"> <form class="input-append">
<input class="key span8" type="text" /> <input class="key span7" type="text" />
<button class="filter btn" type="submit"> <button class="filter btn" type="submit">
<i class="icon-filter"></i> <i class="icon-filter"></i>
Filter Filter
@ -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="span7 required" /> <input type="text" id="service-name" class="span6 required" />
<label for="service-duration">Duration *</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="span7 required" /> <input type="text" id="service-price" class="required" />
<label for="service-currency">Currency</label> <label for="service-currency">Currency</label>
<input type="text" id="service-currency" class="span7" /> <input type="text" id="service-currency" class="" />
<label for="service-description">Description</label>
<textarea id="service-description" rows="4" class="span7"></textarea>
<label for="service-category">Category</label> <label for="service-category">Category</label>
<select id="service-category" class="span7"></select> <select id="service-category"></select>
<label for="service-description">Description</label>
<textarea id="service-description" rows="4" class="span6"></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>
@ -113,7 +113,7 @@
<div id="categories" class="tab-content" style="display:none;"> <div id="categories" class="tab-content" style="display:none;">
<div id="filter-categories" class="filter-records column span4"> <div id="filter-categories" class="filter-records column span4">
<form class="input-append"> <form class="input-append">
<input class="key span8" type="text" class="" /> <input class="key span7" type="text" class="" />
<button class="filter btn" type="submit"> <button class="filter btn" type="submit">
<i class="icon-filter"></i> <i class="icon-filter"></i>
Filter Filter

View file

@ -82,7 +82,7 @@
<br> <br>
<a href="<?php echo $this->config->base_url(); ?>" target="_blank" class="btn btn-primary"> <a href="<?php echo $this->config->base_url(); ?>" target="_blank" class="btn btn-info">
<i class="icon-calendar icon-white"></i> <i class="icon-calendar icon-white"></i>
Go To Booking Page Go To Booking Page
</a> </a>

View file

@ -62,7 +62,7 @@
<div id="admins" class="tab-content"> <div id="admins" class="tab-content">
<div id="filter-admins" class="filter-records column span4"> <div id="filter-admins" class="filter-records column span4">
<form class="input-append"> <form class="input-append">
<input class="key span8" type="text" /> <input class="key span7" type="text" />
<button class="filter btn" type="submit"> <button class="filter btn" type="submit">
<i class="icon-filter"></i> <i class="icon-filter"></i>
Filter Filter
@ -170,7 +170,7 @@
<div id="providers" class="tab-content" style="display:none;"> <div id="providers" class="tab-content" style="display:none;">
<div id="filter-providers" class="filter-records column span4"> <div id="filter-providers" class="filter-records column span4">
<form class="input-append"> <form class="input-append">
<input class="key span8" type="text" /> <input class="key span7" type="text" />
<button class="filter btn" type="submit"> <button class="filter btn" type="submit">
<i class="icon-filter"></i> <i class="icon-filter"></i>
Filter Filter
@ -283,6 +283,10 @@
<div class="working-plan-view provider-view" style="display: none;"> <div class="working-plan-view provider-view" style="display: none;">
<h2>Working Plan</h2> <h2>Working Plan</h2>
<button id="reset-working-plan" class="btn btn-primary"
title="Reset the working plan back to the default values.">
<i class="icon-repeat icon-white"></i>
Reset Plan</button>
<table class="working-plan table table-striped"> <table class="working-plan table table-striped">
<thead> <thead>
<tr> <tr>
@ -335,8 +339,8 @@
<h2>Breaks</h2> <h2>Breaks</h2>
<span class="help-block"> <span class="help-block">
Add the working breaks during each day. These breaks will be applied for Add the working breaks during each day. During breaks the provider will
all new providers. not accept any appointments.
</span> </span>
<div> <div>
@ -374,7 +378,7 @@
<div id="secretaries" class="tab-content" style="display:none;"> <div id="secretaries" class="tab-content" style="display:none;">
<div id="filter-secretaries" class="filter-records column span4"> <div id="filter-secretaries" class="filter-records column span4">
<form class="input-append"> <form class="input-append">
<input class="key span8" type="text" /> <input class="key span7" type="text" />
<button class="filter btn" type="submit"> <button class="filter btn" type="submit">
<i class="icon-filter"></i> <i class="icon-filter"></i>
Filter Filter

View file

@ -45,6 +45,14 @@
var AJAX_SUCCESS = 'SUCCESS'; var AJAX_SUCCESS = 'SUCCESS';
var AJAX_FAILURE = 'FAILURE'; var AJAX_FAILURE = 'FAILURE';
$(document).ajaxStart(function() {
$('#loading').show();
});
$(document).ajaxStop(function() {
$('#loading').hide();
});
/** /**
* Event: Install Easy!Appointments Button "Click" * Event: Install Easy!Appointments Button "Click"
*/ */
@ -185,9 +193,28 @@
margin-top: 20px; margin-top: 20px;
border-top: 1px solid #EEE; border-top: 1px solid #EEE;
} }
#loading {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
z-index: 999999;
background: rgba(255, 255, 255, 0.75);
}
#loading img {
margin: auto;
display: block;
}
</style> </style>
</head> </head>
<body> <body>
<div id="loading" style="display: none;">
<img src="<?php echo $base_url; ?>assets/images/loading.gif" />
</div>
<header> <header>
<a href="http://easyappointments.org" target="_blank"> <a href="http://easyappointments.org" target="_blank">
<img src="<?php echo $base_url; ?>assets/images/installation-banner.png" alt="Easy!Appointents Installation Banner"> <img src="<?php echo $base_url; ?>assets/images/installation-banner.png" alt="Easy!Appointents Installation Banner">

View file

@ -110,14 +110,15 @@ root {
} }
body .modal-header { body .modal-header {
padding: 9px 15px; padding: 12px 15px;
background: #51B173; background: #3DD481;
border-bottom: 3px solid #3A8154; border-bottom: 4px solid #3A8154;
color: #FFF; color: #FFF;
} }
body .modal-header h3 { body .modal-header h3 {
font-size: 20px; font-size: 20px;
text-shadow: 1px 1px 1px #134D13;
} }
body .jspDrag { body .jspDrag {
@ -128,6 +129,32 @@ body .jspTrack {
background: #EBEBEB; background: #EBEBEB;
} }
body .ui-dialog .ui-dialog-titlebar-close {
display: none;
}
body .ui-draggable .ui-dialog-titlebar {
background: #3DD481;
color: #FFF;
text-shadow: 1px 1px 0px #327451;
padding: 14px 10px;
border-bottom: 4px solid #1A865F;
margin-bottom: 10px;
}
body .ui-dialog {
padding: 0;
}
body .ui-dialog .ui-dialog-buttonpane {
padding: .3em 1em .3em .4em;
}
.breaks tr:hover td {
background: #FFFFC2 !important;
}
/* BACKEND CALENDAR PAGE /* BACKEND CALENDAR PAGE
-------------------------------------------------------------------- */ -------------------------------------------------------------------- */
#calendar-page #calendar-toolbar { #calendar-page #calendar-toolbar {
@ -274,15 +301,15 @@ body .jspTrack {
margin: 5px 0; margin: 5px 0;
} }
#customers-page #details { #customers-page .details {
margin: 15px 0 15px 15px; margin: 15px 0 15px 15px;
} }
#customers-page #details .btn-toolbar { #customers-page .details .btn-toolbar {
margin-top: 0px; margin-top: 0px;
} }
#customers-page #details div.span5 { #customers-page .details div.span5 {
margin-left: 0; margin-left: 0;
} }
@ -304,8 +331,8 @@ body .jspTrack {
cursor: pointer; cursor: pointer;
} }
#customers-page #details input, #customers-page .details input,
#customers-page #details textarea { #customers-page .details textarea {
background-color: white; background-color: white;
cursor: default; cursor: default;
} }
@ -358,6 +385,10 @@ body .jspTrack {
margin-bottom: 10px; margin-bottom: 10px;
} }
#services-page .details .ui-state-disabled {
opacity: 1;
}
#services-page #service-duration { #services-page #service-duration {
margin: 0px; margin: 0px;
} }
@ -383,6 +414,13 @@ body .jspTrack {
cursor: pointer; cursor: pointer;
} }
.details input:read-only,
.details select:disabled,
.details textarea:read-only {
opacity: 0.85;
box-shadow: none;
}
/* BACKEND USERS PAGE /* BACKEND USERS PAGE
-------------------------------------------------------------------- */ -------------------------------------------------------------------- */
#users-page .tab-content { #users-page .tab-content {

View file

@ -27,6 +27,7 @@ var BackendCalendar = {
'defaultView': 'agendaWeek', 'defaultView': 'agendaWeek',
'height': BackendCalendar.getCalendarHeight(), 'height': BackendCalendar.getCalendarHeight(),
'editable': true, 'editable': true,
'firstDay': 1, // Monday
'slotMinutes': 30, 'slotMinutes': 30,
'axisFormat': 'HH:mm', 'axisFormat': 'HH:mm',
'timeFormat': 'HH:mm{ - HH:mm}', 'timeFormat': 'HH:mm{ - HH:mm}',
@ -67,28 +68,32 @@ var BackendCalendar = {
BackendCalendar.calendarWindowResize(); BackendCalendar.calendarWindowResize();
// Fill the select listboxes of the page. // Fill the select listboxes of the page.
var optgroupHtml = '<optgroup label="Providers" type="providers-group">'; if (GlobalVariables.availableProviders.length > 0) {
$.each(GlobalVariables.availableProviders, function(index, provider) { var optgroupHtml = '<optgroup label="Providers" type="providers-group">';
var hasGoogleSync = (provider['settings']['google_sync'] === '1') $.each(GlobalVariables.availableProviders, function(index, provider) {
? 'true' : 'false'; var hasGoogleSync = (provider['settings']['google_sync'] === '1')
? 'true' : 'false';
optgroupHtml += '<option value="' + provider['id'] + '" '
+ 'type="' + BackendCalendar.FILTER_TYPE_PROVIDER + '" ' optgroupHtml += '<option value="' + provider['id'] + '" '
+ 'google-sync="' + hasGoogleSync + '">' + 'type="' + BackendCalendar.FILTER_TYPE_PROVIDER + '" '
+ provider['first_name'] + ' ' + provider['last_name'] + 'google-sync="' + hasGoogleSync + '">'
+ '</option>'; + provider['first_name'] + ' ' + provider['last_name']
}); + '</option>';
optgroupHtml += '</optgroup>'; });
$('#select-filter-item').append(optgroupHtml); optgroupHtml += '</optgroup>';
$('#select-filter-item').append(optgroupHtml);
optgroupHtml = '<optgroup label="Services" type="services-group">'; }
$.each(GlobalVariables.availableServices, function(index, service) {
optgroupHtml += '<option value="' + service['id'] + '" ' + if (GlobalVariables.availableServices.length > 0) {
'type="' + BackendCalendar.FILTER_TYPE_SERVICE + '">' + optgroupHtml = '<optgroup label="Services" type="services-group">';
service['name'] + '</option>'; $.each(GlobalVariables.availableServices, function(index, service) {
}); optgroupHtml += '<option value="' + service['id'] + '" ' +
optgroupHtml += '</optgroup>'; 'type="' + BackendCalendar.FILTER_TYPE_SERVICE + '">' +
$('#select-filter-item').append(optgroupHtml); service['name'] + '</option>';
});
optgroupHtml += '</optgroup>';
$('#select-filter-item').append(optgroupHtml);
}
// Privileges Checks // Privileges Checks
if (GlobalVariables.user.role_slug == Backend.DB_SLUG_PROVIDER) { if (GlobalVariables.user.role_slug == Backend.DB_SLUG_PROVIDER) {
@ -799,7 +804,7 @@ var BackendCalendar = {
*/ */
getCalendarHeight: function () { getCalendarHeight: function () {
var result = window.innerHeight - $('#footer').height() - $('#header').height() var result = window.innerHeight - $('#footer').height() - $('#header').height()
- $('#calendar-toolbar').height() - 80; // 80 for fine tuning - $('#calendar-toolbar').height() - 50; // 80 for fine tuning
return (result > 500) ? result : 500; // Minimum height is 500px return (result > 500) ? result : 500; // Minimum height is 500px
}, },
@ -881,6 +886,8 @@ var BackendCalendar = {
var selDayName = $calendar.fullCalendar('getView') var selDayName = $calendar.fullCalendar('getView')
.start.toString('dddd').toLowerCase(); .start.toString('dddd').toLowerCase();
if (workingPlan[selDayName] == null) return; // go to next loop
// Add unavailable period before work starts. // Add unavailable period before work starts.
var calendarDateStart = $calendar.fullCalendar('getView').start; var calendarDateStart = $calendar.fullCalendar('getView').start;
var workDateStart = Date.parseExact( var workDateStart = Date.parseExact(
@ -961,6 +968,7 @@ var BackendCalendar = {
var currDateEnd = GeneralFunctions.clone(currDateStart).addDays(1); var currDateEnd = GeneralFunctions.clone(currDateStart).addDays(1);
$.each(workingPlan, function(index, workingDay) { $.each(workingPlan, function(index, workingDay) {
if (workingDay == null) return; // Go to the next loop.
var start, end; var start, end;
// Add unavailable period before work starts. // Add unavailable period before work starts.
@ -1672,7 +1680,7 @@ var BackendCalendar = {
// :: CHECK REQUIRED FIELDS // :: CHECK REQUIRED FIELDS
var missingRequiredField = false; var missingRequiredField = false;
$dialog.find('.required').each(function() { $dialog.find('.required').each(function() {
if ($(this).val() === '') { if ($(this).val() == '' || $(this).val() == null) {
$(this).parents().eq(1).addClass('error'); $(this).parents().eq(1).addClass('error');
missingRequiredField = true; missingRequiredField = true;
} }

View file

@ -136,7 +136,7 @@ CustomersHelper.prototype.bindEventHandlers = function() {
BackendCustomers.helper.resetForm(); BackendCustomers.helper.resetForm();
$('#add-edit-delete-group').hide(); $('#add-edit-delete-group').hide();
$('#save-cancel-group').show(); $('#save-cancel-group').show();
$('#details').find('input, textarea').prop('readonly', false); $('.details').find('input, textarea').prop('readonly', false);
$('#filter-customers button').prop('disabled', true); $('#filter-customers button').prop('disabled', true);
$('#filter-customers .results').css('color', '#AAA'); $('#filter-customers .results').css('color', '#AAA');
@ -146,7 +146,7 @@ CustomersHelper.prototype.bindEventHandlers = function() {
* Event: Edit Customer Button "Click" * Event: Edit Customer Button "Click"
*/ */
$('#edit-customer').click(function() { $('#edit-customer').click(function() {
$('#details').find('input, textarea').prop('readonly', false); $('.details').find('input, textarea').prop('readonly', false);
$('#add-edit-delete-group').hide(); $('#add-edit-delete-group').hide();
$('#save-cancel-group').show(); $('#save-cancel-group').show();
@ -296,8 +296,8 @@ CustomersHelper.prototype.validate = function(customer) {
* Bring the customer form back to its initial state. * Bring the customer form back to its initial state.
*/ */
CustomersHelper.prototype.resetForm = function() { CustomersHelper.prototype.resetForm = function() {
$('#details').find('input, textarea').val(''); $('.details').find('input, textarea').val('');
$('#details').find('input, textarea').prop('readonly', true); $('.details').find('input, textarea').prop('readonly', true);
$('#customer-appointments').html(''); $('#customer-appointments').html('');
$('#appointment-details').html(''); $('#appointment-details').html('');
@ -305,8 +305,8 @@ CustomersHelper.prototype.resetForm = function() {
$('#add-edit-delete-group').show(); $('#add-edit-delete-group').show();
$('#save-cancel-group').hide(); $('#save-cancel-group').hide();
$('#details .required').css('border', ''); $('.details .required').css('border', '');
$('#details #form-message').hide(); $('.details #form-message').hide();
$('#filter-customers button').prop('disabled', false); $('#filter-customers button').prop('disabled', false);
$('#filter-customers .selected-row').removeClass('selected-row'); $('#filter-customers .selected-row').removeClass('selected-row');

View file

@ -392,7 +392,7 @@ ServicesHelper.prototype.filter = function(key, selectId, display) {
$('#filter-services .results').jScrollPane({ mouseWheelSpeed: 70 }); $('#filter-services .results').jScrollPane({ mouseWheelSpeed: 70 });
if (response.length == 0) { if (response.length == 0) {
$('#filter-services .result').html('<em>No results found ...</em>'); $('#filter-services .results').html('<em>No results found ...</em>');
} }
if (selectId != undefined) { if (selectId != undefined) {
@ -642,7 +642,7 @@ CategoriesHelper.prototype.save = function(category) {
if (!GeneralFunctions.handleAjaxExceptions(response)) return; if (!GeneralFunctions.handleAjaxExceptions(response)) return;
Backend.displayNotification('Service saved successfully!'); Backend.displayNotification('Category saved successfully!');
BackendServices.helper.resetForm(); BackendServices.helper.resetForm();
$('#filter-categories .key').val(''); $('#filter-categories .key').val('');
BackendServices.helper.filter('', response.id, true); BackendServices.helper.filter('', response.id, true);

View file

@ -96,6 +96,8 @@ var BackendSettings = {
$('#user').find('button').prop('disabled', true); $('#user').find('button').prop('disabled', true);
} }
Backend.placeFooterToBottom();
}, },
/** /**
@ -137,6 +139,8 @@ var BackendSettings = {
$('#user-notifications').removeClass('active'); $('#user-notifications').removeClass('active');
} }
} }
Backend.placeFooterToBottom();
}); });
/** /**

View file

@ -92,7 +92,7 @@ ProvidersHelper.prototype.bindEventHandlers = function() {
$('#provider-password, #provider-password-confirm').removeClass('required'); $('#provider-password, #provider-password-confirm').removeClass('required');
$('#provider-notifications').prop('disabled', false); $('#provider-notifications').prop('disabled', false);
$('#provider-services input[type="checkbox"]').prop('disabled', false); $('#provider-services input[type="checkbox"]').prop('disabled', false);
$('#providers').find('.add-break, .edit-break, .delete-break').prop('disabled', false); $('#providers').find('.add-break, .edit-break, .delete-break, #reset-working-plan').prop('disabled', false);
$('#providers input[type="checkbox"]').prop('disabled', false); $('#providers input[type="checkbox"]').prop('disabled', false);
BackendUsers.wp.timepickers(false); BackendUsers.wp.timepickers(false);
}); });
@ -184,7 +184,6 @@ ProvidersHelper.prototype.bindEventHandlers = function() {
$('.working-plan-view').hide('fade', function() { $('.working-plan-view').hide('fade', function() {
$('.details-view').show('fade'); $('.details-view').show('fade');
}); });
}); });
/** /**
@ -197,6 +196,15 @@ ProvidersHelper.prototype.bindEventHandlers = function() {
$('.working-plan-view').show('fade'); $('.working-plan-view').show('fade');
}); });
}); });
/**
* Event: Reset Working Plan Button "Click".
*/
$('#reset-working-plan').click(function() {
$('.breaks').empty();
BackendUsers.wp.setup(GlobalVariables.workingPlan);
BackendUsers.wp.timepickers(false);
});
}; };
/** /**
@ -312,9 +320,10 @@ ProvidersHelper.prototype.resetForm = function() {
$('#provider-services input[type="checkbox"]').prop('disabled', true); $('#provider-services input[type="checkbox"]').prop('disabled', true);
$('#providers .required').css('border', ''); $('#providers .required').css('border', '');
$('#provider-password, #provider-password-confirm').css('border', ''); $('#provider-password, #provider-password-confirm').css('border', '');
$('#providers .add-break').prop('disabled', true); $('#providers .add-break, #reset-working-plan').prop('disabled', true);
BackendUsers.wp.timepickers(true); BackendUsers.wp.timepickers(true);
$('#providers .working-plan input[type="text"]').timepicker('destroy'); $('#providers .working-plan input[type="text"]').timepicker('destroy');
$('#providers .working-plan input[type="checkbox"]').prop('disabled', true);
$('.breaks').find('.edit-break, .delete-break').prop('disabled', true); $('.breaks').find('.edit-break, .delete-break').prop('disabled', true);
$('#edit-provider, #delete-provider').prop('disabled', true); $('#edit-provider, #delete-provider').prop('disabled', true);

View file

@ -45,6 +45,7 @@ var FrontendBook = {
$('#select-date').datepicker({ $('#select-date').datepicker({
dateFormat: 'dd-mm-yy', dateFormat: 'dd-mm-yy',
firstDay: 1, // Monday
minDate: 0, minDate: 0,
defaultDate: Date.today(), defaultDate: Date.today(),
onSelect: function(dateText, instance) { onSelect: function(dateText, instance) {
@ -272,6 +273,8 @@ var FrontendBook = {
* hours we need to receive. * hours we need to receive.
*/ */
getAvailableHours: function(selDate) { getAvailableHours: function(selDate) {
$('#available-hours').empty();
// Find the selected service duration (it is going to // Find the selected service duration (it is going to
// be send within the "postData" object. // be send within the "postData" object.
var selServiceDuration = 15; // Default value of duration (in minutes). var selServiceDuration = 15; // Default value of duration (in minutes).

View file

@ -65,6 +65,7 @@ var GeneralFunctions = {
}); });
jQuery("#message_box").dialog("open"); jQuery("#message_box").dialog("open");
jQuery(".ui-dialog .ui-dialog-buttonset button").addClass('btn');
jQuery("#message_box .ui-dialog-titlebar-close").hide(); jQuery("#message_box .ui-dialog-titlebar-close").hide();
}, },

View file

@ -173,8 +173,8 @@ WorkingPlan.prototype.bindEventHandlers = function() {
// Bind editable and event handlers. // Bind editable and event handlers.
tr = $('.breaks tr').get()[1]; tr = $('.breaks tr').get()[1];
BackendSettings.editableBreakDay($(tr).find('.break-day')); WorkingPlan.prototype.editableBreakDay($(tr).find('.break-day'));
BackendSettings.editableBreakTime($(tr).find('.break-start, .break-end')); WorkingPlan.prototype.editableBreakTime($(tr).find('.break-start, .break-end'));
$(tr).find('.edit-break').trigger('click'); $(tr).find('.edit-break').trigger('click');
}); });
@ -295,7 +295,7 @@ WorkingPlan.prototype.timepickers = function(disabled) {
if (disabled == false) { if (disabled == false) {
// Set timepickers where needed. // Set timepickers where needed.
$('.working-plan input').timepicker({ $('.working-plan input[type="text"]').timepicker({
'timeFormat': 'HH:mm', 'timeFormat': 'HH:mm',
'onSelect': function(datetime, inst) { 'onSelect': function(datetime, inst) {
// Start time must be earlier than end time. // Start time must be earlier than end time.
@ -310,4 +310,11 @@ WorkingPlan.prototype.timepickers = function(disabled) {
} else { } else {
$('.working-plan input').timepicker('destroy'); $('.working-plan input').timepicker('destroy');
} }
};
/**
* Reset the current plan back to the company's default working plan.
*/
WorkingPlan.prototype.reset = function() {
}; };