diff --git a/src/assets/css/backend.css b/src/assets/css/backend.css
index 0a311ce2..cc3266fe 100644
--- a/src/assets/css/backend.css
+++ b/src/assets/css/backend.css
@@ -289,14 +289,15 @@ body .jspTrack {
#existing-customers-list div {
display: inline-block;
width: 250px;
- margin: 0 5px 5px 0;
- padding: 3px 5px;
+ margin: 0 7px 7px 0;
+ padding: 5px;
border-radius: 3px;
}
#existing-customers-list div:hover {
- background: #B8F0C1;
+ background: #3DD481;
font-weight: bold;
+ color: #FFF;
cursor: pointer;
}
diff --git a/src/assets/js/general_functions.js b/src/assets/js/general_functions.js
index 179cf971..a3a81761 100644
--- a/src/assets/js/general_functions.js
+++ b/src/assets/js/general_functions.js
@@ -1,19 +1,19 @@
/* ----------------------------------------------------------------------------
* Easy!Appointments - Open Source Web Scheduler
- *
+ *
* @package EasyAppointments
* @author A.Tselegidis
* @copyright Copyright (c) 2013 - 2015, Alex Tselegidis
- * @license http://opensource.org/licenses/GPL-3.0 - GPLv3
+ * @license http://opensource.org/licenses/GPL-3.0 - GPLv3
* @link http://easyappointments.org
* @since v1.0.0
* ---------------------------------------------------------------------------- */
/**
* This file contains the General Functions javascript namespace.
- * It contains functions that apply both on the front and back
+ * It contains functions that apply both on the front and back
* end of the application.
- *
+ *
* @namespace GeneralFunctions
*/
var GeneralFunctions = {
@@ -24,26 +24,26 @@ var GeneralFunctions = {
EXCEPTIONS_MESSAGE: EALang['unexpected_issues_message'],
WARNINGS_TITLE: EALang['unexpected_warnings'],
WARNINGS_MESSAGE: EALang['unexpected_warnings_message'],
-
+
/**
* This functions displays a message box in
* the admin array. It is usefull when user
* decisions or verifications are needed.
- *
+ *
* @param {string} title The title of the message box.
* @param {string} message The message of the dialog.
- * @param {array} messageButtons Contains the dialog
+ * @param {array} messageButtons Contains the dialog
* buttons along with their functions.
*/
displayMessageBox: function(title, message, messageButtons) {
// Check arguments integrity.
if (title == undefined || title == '') {
title = '';
- }
+ }
if (message == undefined || message == '') {
message = '';
- }
+ }
if (messageButtons == undefined) {
messageButtons = {};
@@ -61,7 +61,7 @@ var GeneralFunctions = {
'
' +
'
' + message + '
' +
'
'
- );
+ );
$("#message_box").dialog({
autoOpen: false,
@@ -74,16 +74,16 @@ var GeneralFunctions = {
closeOnEscape: true
});
- $('#message_box').dialog('open');
- $('.ui-dialog .ui-dialog-buttonset button').addClass('btn');
+ $('#message_box').dialog('open');
+ $('.ui-dialog .ui-dialog-buttonset button').addClass('btn btn-default');
$('#message_box .ui-dialog-titlebar-close').hide();
},
/**
* This method centers a DOM element vertically and horizontally
* on the page.
- *
- * @param {object} elementHandle The object that is going to be
+ *
+ * @param {object} elementHandle The object that is going to be
* centered.
*/
centerElementOnPage: function(elementHandle) {
@@ -97,19 +97,19 @@ var GeneralFunctions = {
position: 'absolute',
left: elementLeft,
top: elementTop
- });
+ });
});
$(window).resize();
},
/**
- * This function retrieves a parameter from a "GET" formed url.
- *
+ * This function retrieves a parameter from a "GET" formed url.
+ *
* @link http://www.netlobo.com/url_query_string_javascript.html
- *
+ *
* @param {string} url The selected url.
* @param {string} name The parameter name.
- * @returns {String} Returns the parameter value.
+ * @returns {String} Returns the parameter value.
*/
getUrlParameter: function(url, parameterName) {
parameterName = parameterName.replace(/[\[]/,'\\\[').replace(/[\]]/,'\\\]');
@@ -125,7 +125,7 @@ var GeneralFunctions = {
/**
* This function creates a RFC 3339 date string. This string is needed
* by the Google Calendar API in order to pass dates as parameters.
- *
+ *
* @param {date} dt The given date that will be transformed
* @returns {String} Returns the transformed string.
*/
@@ -139,20 +139,20 @@ var GeneralFunctions = {
+ pad(dt.getUTCMinutes())+':'
+ pad(dt.getUTCSeconds())+'Z';
},
-
+
/**
- * This method creates and returns an exact copy of the provided object.
+ * This method creates and returns an exact copy of the provided object.
* It is very usefull whenever changes need to be made to an object without
* modyfing the original data.
- *
+ *
* @link http://stackoverflow.com/questions/728360/most-elegant-way-to-clone-a-javascript-object
- *
+ *
* @param {object} originalObject Object to be copied.
* @returns {object} Returns an exact copy of the provided element.
*/
clone: function(originalObject) {
// Handle the 3 simple types, and null or undefined
- if (null == originalObject || 'object' != typeof originalObject)
+ if (null == originalObject || 'object' != typeof originalObject)
return originalObject;
// Handle Date
@@ -175,7 +175,7 @@ var GeneralFunctions = {
if (originalObject instanceof Object) {
var copy = {};
for (var attr in originalObject) {
- if (originalObject.hasOwnProperty(attr))
+ if (originalObject.hasOwnProperty(attr))
copy[attr] = GeneralFunctions.clone(originalObject[attr]);
}
return copy;
@@ -183,11 +183,11 @@ var GeneralFunctions = {
throw new Error('Unable to copy obj! Its type isn\'t supported.');
},
-
+
/**
* This method validates an email address. If the address is not on the proper
* form then the result is FALSE.
- *
+ *
* @param {string} email The email address to be checked.
* @returns {bool} Returns the validation result.
*/
@@ -195,71 +195,71 @@ var GeneralFunctions = {
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
return reg.test(email);
},
-
+
/**
* This method returns the exception html display for javascript ajax calls.
* It uses the Bootstrap collapse module to show exception messages when the
* user opens the "Details" collapse component.
- *
+ *
* @param {array} exceptions Contains the exceptions to be displayed.
* @returns {string} Returns the html markup for the exceptions.
*/
exceptionsToHtml: function(exceptions) {
- var html =
- '
';
-
+
$.each(exceptions, function(index, exception) {
html +=
'
' +
- '
' +
+ '
' +
'
' + exception['message'] + '
' +
'
' +
'
';
});
-
+
html += '
';
-
+
return html;
},
-
+
/**
* This method parse the json encoded strings that are fetched by ajax calls.
- *
+ *
* @param {array} exceptions Exception array returned by an ajax call.
* @returns {array} Returns the parsed js objects.
*/
parseExceptions: function(exceptions) {
var parsedExceptions = new Array();
-
+
$.each(exceptions, function(index, exception) {
parsedExceptions.push($.parseJSON(exception));
});
-
+
return parsedExceptions;
},
-
+
/**
* Makes the first letter of the string upper case.
- *
+ *
* @param {string} str The string to be converted.
* @returns {string} Returns the capitalized string.
*/
ucaseFirstLetter: function(str){
return str.charAt(0).toUpperCase() + str.slice(1);
},
-
+
/**
* All backend js code has the same way of dislaying exceptions that are raised on the
- * server during an ajax call.
- *
- * @param {object} response Contains the server response. If exceptions or warnings are
+ * server during an ajax call.
+ *
+ * @param {object} response Contains the server response. If exceptions or warnings are
* found, user friendly messages are going to be displayed to the user.
* @returns {bool} Returns whether the the ajax callback should continue the execution or
* stop, due to critical server exceptions.
@@ -277,26 +277,26 @@ var GeneralFunctions = {
GeneralFunctions.displayMessageBox(GeneralFunctions.WARNINGS_TITLE, GeneralFunctions.WARNINGS_MESSAGE);
$('#message_box').append(GeneralFunctions.exceptionsToHtml(response.warnings));
}
-
+
return true;
},
-
+
/**
* Enables the language selection functionality. Must be called on every page has a
* language selection button. This method requires the global variable 'availableLanguages'
* to be initialized before the execution.
- *
+ *
* @param {object} $element Selected element button for the language selection.
*/
enableLanguageSelection: function($element) {
// Select Language
var html = '
';
$.each(availableLanguages, function() {
- html += '
'
+ html += '
'
+ GeneralFunctions.ucaseFirstLetter(this) + '
';
});
html += '
';
-
+
$element.popover({
'placement': 'top',
'title': 'Select Language',
@@ -305,7 +305,7 @@ var GeneralFunctions = {
'container': 'body',
'trigger': 'manual'
});
-
+
$element.click(function() {
if ($('#language-list').length == 0) {
$(this).popover('show');
@@ -313,11 +313,11 @@ var GeneralFunctions = {
$(this).popover('hide');
}
});
-
+
$(document).on('click', 'li.language', function() {
// Change language with ajax call and refresh page.
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_change_language';
- var postData = {
+ var postData = {
'csrfToken': GlobalVariables.csrfToken,
'language': $(this).attr('data-language'),
};
@@ -325,11 +325,11 @@ var GeneralFunctions = {
////////////////////////////////////////////////////
console.log('Change Language Response', response);
////////////////////////////////////////////////////
-
+
if (!GeneralFunctions.handleAjaxExceptions(response)) return;
document.location.reload(true);
-
+
}, 'json');
});
}
-};
\ No newline at end of file
+};
diff --git a/src/assets/js/installation.js b/src/assets/js/installation.js
index fd399a2f..497caaf3 100644
--- a/src/assets/js/installation.js
+++ b/src/assets/js/installation.js
@@ -57,10 +57,18 @@ $(document).ready(function() {
}
},
error: function(jqXHR, textStatus, errorThrown) {
- GeneralFunctions.displayMessageBox(GeneralFunctions.EXCEPTIONS_TITLE,
- GeneralFunctions.EXCEPTIONS_MESSAGE);
- console.log('The installation could be completed due to AJAX issues: ',
- jqXHR, textStatus, errorThrown);
+ // Treat the error the same way as php exceptions.
+ var exc = {
+ exceptions: [
+ JSON.stringify({
+ message: 'The installation could not be completed due to an ' +
+ 'unexpected issue. Please check the browser\'s console for ' +
+ 'more information.'
+ })
+ ]
+ };
+ GeneralFunctions.handleAjaxExceptions(exc);
+ console.log(exc.exceptions[0].message, jqXHR, textStatus, errorThrown);
}
});
});
diff --git a/src/assets/js/working_plan.js b/src/assets/js/working_plan.js
index 69b17174..3a2f15e3 100644
--- a/src/assets/js/working_plan.js
+++ b/src/assets/js/working_plan.js
@@ -1,41 +1,41 @@
/* ----------------------------------------------------------------------------
* Easy!Appointments - Open Source Web Scheduler
- *
+ *
* @package EasyAppointments
* @author A.Tselegidis
* @copyright Copyright (c) 2013 - 2015, Alex Tselegidis
- * @license http://opensource.org/licenses/GPL-3.0 - GPLv3
+ * @license http://opensource.org/licenses/GPL-3.0 - GPLv3
* @link http://easyappointments.org
* @since v1.0.0
* ---------------------------------------------------------------------------- */
/**
- * Contains the working plan functionality. The working plan DOM elements must be same
+ * Contains the working plan functionality. The working plan DOM elements must be same
* in every page this class is used.
- *
+ *
* @class WorkingPlan
*/
var WorkingPlan = function() {
/**
* This flag is used when trying to cancel row editing. It is
* true only whenever the user presses the cancel button.
- *
+ *
* @type {bool}
*/
this.enableCancel = false;
-
+
/**
- * This flag determines whether the jeditables are allowed to submit. It is
+ * This flag determines whether the jeditables are allowed to submit. It is
* true only whenever the user presses the save button.
- *
+ *
* @type {bool}
*/
this.enableSubmit = false;
};
/**
- * Setup the dom elements of a given working plan.
- *
+ * Setup the dom elements of a given working plan.
+ *
* @param {object} workingPlan Contains the working hours and breaks for each day of the week.
*/
WorkingPlan.prototype.setup = function(workingPlan) {
@@ -48,23 +48,23 @@ WorkingPlan.prototype.setup = function(workingPlan) {
// Add the day's breaks on the breaks table.
$.each(workingDay.breaks, function(i, brk) {
var day = WorkingPlan.prototype.convertValueToDay(index);
-
- var tr =
- '