From e013943fdec110eb09abbc258dcd0f5f637f4630 Mon Sep 17 00:00:00 2001 From: alext Date: Tue, 23 Jan 2018 10:08:37 +0100 Subject: [PATCH] Reformatted code files. --- src/application/config/autoload.php | 15 +- src/application/config/config.php | 42 +- src/application/config/constants.php | 22 +- src/application/config/database.php | 5 +- src/application/config/doctypes.php | 24 +- src/application/config/email.php | 4 +- src/application/config/foreign_chars.php | 109 ++--- src/application/config/hooks.php | 5 +- src/application/config/index.html | 4 +- src/application/config/migration.php | 1 + src/application/config/mimes.php | 413 ++++++++++------ src/application/config/profiler.php | 6 +- src/application/config/routes.php | 12 +- src/application/config/smileys.php | 95 ++-- src/application/config/user_agents.php | 285 +++++------ src/application/controllers/Backend.php | 13 +- src/application/controllers/Backend_api.php | 33 +- src/application/controllers/Errors.php | 3 +- src/application/controllers/Google.php | 12 +- src/application/controllers/Installation.php | 3 +- src/application/controllers/User.php | 6 +- .../controllers/api/v1/Availabilities.php | 18 +- src/application/helpers/asset_helper.php | 5 +- src/application/helpers/config_helper.php | 5 +- src/application/helpers/general_helper.php | 3 +- src/application/language/arabic/db_lang.php | 14 +- .../language/arabic/email_lang.php | 14 +- src/application/language/arabic/index.html | 2 +- .../language/arabic/translations_lang.php | 2 +- .../language/bulgarian/db_lang.php | 14 +- .../language/bulgarian/email_lang.php | 14 +- src/application/language/chinese/db_lang.php | 18 +- .../language/chinese/email_lang.php | 14 +- src/application/language/danish/db_lang.php | 14 +- .../language/danish/email_lang.php | 14 +- src/application/language/dutch/db_lang.php | 14 +- src/application/language/dutch/email_lang.php | 14 +- src/application/language/english/db_lang.php | 14 +- .../language/english/email_lang.php | 14 +- src/application/language/finnish/db_lang.php | 14 +- .../language/finnish/email_lang.php | 14 +- src/application/language/french/db_lang.php | 14 +- .../language/french/email_lang.php | 14 +- src/application/language/german/db_lang.php | 14 +- .../language/german/email_lang.php | 14 +- src/application/language/greek/db_lang.php | 14 +- src/application/language/greek/email_lang.php | 14 +- src/application/language/hindi/db_lang.php | 14 +- src/application/language/hindi/email_lang.php | 14 +- .../language/hungarian/db_lang.php | 14 +- .../language/hungarian/email_lang.php | 14 +- src/application/language/italian/db_lang.php | 14 +- .../language/italian/email_lang.php | 14 +- src/application/language/japanese/db_lang.php | 14 +- .../language/japanese/email_lang.php | 14 +- .../language/luxembourgish/db_lang.php | 14 +- .../language/luxembourgish/email_lang.php | 14 +- src/application/language/polish/db_lang.php | 14 +- .../language/polish/email_lang.php | 14 +- .../language/portuguese-br/db_lang.php | 14 +- .../language/portuguese-br/email_lang.php | 14 +- .../language/portuguese/db_lang.php | 14 +- .../language/portuguese/email_lang.php | 14 +- src/application/language/romanian/db_lang.php | 14 +- .../language/romanian/email_lang.php | 14 +- src/application/language/russian/db_lang.php | 14 +- .../language/russian/email_lang.php | 14 +- src/application/language/slovak/db_lang.php | 14 +- .../language/slovak/email_lang.php | 14 +- src/application/language/spanish/db_lang.php | 14 +- .../language/spanish/email_lang.php | 14 +- .../language/spanish/migration_lang.php | 14 +- src/application/language/turkish/db_lang.php | 14 +- .../language/turkish/email_lang.php | 14 +- src/application/libraries/Ics_file.php | 1 - src/application/models/Admins_model.php | 3 +- src/application/models/Appointments_model.php | 31 +- src/application/models/Customers_model.php | 3 +- src/application/models/Providers_model.php | 6 +- src/application/models/Secretaries_model.php | 3 +- src/application/models/Services_model.php | 6 +- src/application/models/Settings_model.php | 3 +- src/assets/css/general.css | 2 - src/assets/css/index.html | 4 +- src/assets/js/backend.js | 51 +- src/assets/js/backend_calendar.js | 18 +- src/assets/js/backend_calendar_api.js | 12 +- .../js/backend_calendar_appointments_modal.js | 158 +++--- .../js/backend_calendar_default_view.js | 6 +- src/assets/js/backend_calendar_google_sync.js | 96 ++-- src/assets/js/backend_calendar_table_view.js | 456 +++++++++--------- ...backend_calendar_unavailabilities_modal.js | 82 ++-- src/assets/js/backend_categories_helper.js | 68 +-- src/assets/js/backend_customers.js | 8 +- src/assets/js/backend_customers_helper.js | 110 ++--- src/assets/js/backend_services.js | 20 +- src/assets/js/backend_services_helper.js | 70 +-- src/assets/js/backend_settings.js | 14 +- src/assets/js/backend_settings_system.js | 19 +- src/assets/js/backend_settings_user.js | 17 +- src/assets/js/backend_users.js | 46 +- src/assets/js/backend_users_admins.js | 78 +-- src/assets/js/backend_users_providers.js | 118 ++--- src/assets/js/backend_users_secretaries.js | 86 ++-- src/assets/js/frontend_book.js | 149 +++--- src/assets/js/frontend_book_api.js | 42 +- src/assets/js/frontend_book_success.js | 42 +- src/assets/js/general_functions.js | 120 ++--- src/assets/js/index.html | 4 +- src/assets/js/installation.js | 22 +- src/assets/js/working_plan.js | 138 +++--- src/engine/Api/V1/Parsers/Appointments.php | 15 +- src/engine/Api/V1/Parsers/Providers.php | 6 +- src/engine/Api/V1/Processors/Sort.php | 6 +- 114 files changed, 2056 insertions(+), 1892 deletions(-) diff --git a/src/application/config/autoload.php b/src/application/config/autoload.php index b894a555..ac7826a6 100644 --- a/src/application/config/autoload.php +++ b/src/application/config/autoload.php @@ -1,4 +1,5 @@ - '', - 'xhtml1-strict' => '', - 'xhtml1-trans' => '', - 'xhtml1-frame' => '', - 'html5' => '', - 'html4-strict' => '', - 'html4-trans' => '', - 'html4-frame' => '' - ); +$_doctypes = [ + 'xhtml11' => '', + 'xhtml1-strict' => '', + 'xhtml1-trans' => '', + 'xhtml1-frame' => '', + 'html5' => '', + 'html4-strict' => '', + 'html4-trans' => '', + 'html4-frame' => '' +]; /* End of file doctypes.php */ -/* Location: ./application/config/doctypes.php */ \ No newline at end of file +/* Location: ./application/config/doctypes.php */ diff --git a/src/application/config/email.php b/src/application/config/email.php index dde38cc0..0c2470b0 100644 --- a/src/application/config/email.php +++ b/src/application/config/email.php @@ -1,10 +1,10 @@ - 'ae', - '/ö|œ/' => 'oe', - '/ü/' => 'ue', - '/Ä/' => 'Ae', - '/Ü/' => 'Ue', - '/Ö/' => 'Oe', - '/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ/' => 'A', - '/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª/' => 'a', - '/Ç|Ć|Ĉ|Ċ|Č/' => 'C', - '/ç|ć|ĉ|ċ|č/' => 'c', - '/Ð|Ď|Đ/' => 'D', - '/ð|ď|đ/' => 'd', - '/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě/' => 'E', - '/è|é|ê|ë|ē|ĕ|ė|ę|ě/' => 'e', - '/Ĝ|Ğ|Ġ|Ģ/' => 'G', - '/ĝ|ğ|ġ|ģ/' => 'g', - '/Ĥ|Ħ/' => 'H', - '/ĥ|ħ/' => 'h', - '/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ/' => 'I', - '/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı/' => 'i', - '/Ĵ/' => 'J', - '/ĵ/' => 'j', - '/Ķ/' => 'K', - '/ķ/' => 'k', - '/Ĺ|Ļ|Ľ|Ŀ|Ł/' => 'L', - '/ĺ|ļ|ľ|ŀ|ł/' => 'l', - '/Ñ|Ń|Ņ|Ň/' => 'N', - '/ñ|ń|ņ|ň|ʼn/' => 'n', - '/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ/' => 'O', - '/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º/' => 'o', - '/Ŕ|Ŗ|Ř/' => 'R', - '/ŕ|ŗ|ř/' => 'r', - '/Ś|Ŝ|Ş|Š/' => 'S', - '/ś|ŝ|ş|š|ſ/' => 's', - '/Ţ|Ť|Ŧ/' => 'T', - '/ţ|ť|ŧ/' => 't', - '/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ/' => 'U', - '/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ/' => 'u', - '/Ý|Ÿ|Ŷ/' => 'Y', - '/ý|ÿ|ŷ/' => 'y', - '/Ŵ/' => 'W', - '/ŵ/' => 'w', - '/Ź|Ż|Ž/' => 'Z', - '/ź|ż|ž/' => 'z', - '/Æ|Ǽ/' => 'AE', - '/ß/'=> 'ss', - '/IJ/' => 'IJ', - '/ij/' => 'ij', - '/Œ/' => 'OE', - '/ƒ/' => 'f' -); +$foreign_characters = [ + '/ä|æ|ǽ/' => 'ae', + '/ö|œ/' => 'oe', + '/ü/' => 'ue', + '/Ä/' => 'Ae', + '/Ü/' => 'Ue', + '/Ö/' => 'Oe', + '/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ/' => 'A', + '/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª/' => 'a', + '/Ç|Ć|Ĉ|Ċ|Č/' => 'C', + '/ç|ć|ĉ|ċ|č/' => 'c', + '/Ð|Ď|Đ/' => 'D', + '/ð|ď|đ/' => 'd', + '/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě/' => 'E', + '/è|é|ê|ë|ē|ĕ|ė|ę|ě/' => 'e', + '/Ĝ|Ğ|Ġ|Ģ/' => 'G', + '/ĝ|ğ|ġ|ģ/' => 'g', + '/Ĥ|Ħ/' => 'H', + '/ĥ|ħ/' => 'h', + '/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ/' => 'I', + '/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı/' => 'i', + '/Ĵ/' => 'J', + '/ĵ/' => 'j', + '/Ķ/' => 'K', + '/ķ/' => 'k', + '/Ĺ|Ļ|Ľ|Ŀ|Ł/' => 'L', + '/ĺ|ļ|ľ|ŀ|ł/' => 'l', + '/Ñ|Ń|Ņ|Ň/' => 'N', + '/ñ|ń|ņ|ň|ʼn/' => 'n', + '/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ/' => 'O', + '/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º/' => 'o', + '/Ŕ|Ŗ|Ř/' => 'R', + '/ŕ|ŗ|ř/' => 'r', + '/Ś|Ŝ|Ş|Š/' => 'S', + '/ś|ŝ|ş|š|ſ/' => 's', + '/Ţ|Ť|Ŧ/' => 'T', + '/ţ|ť|ŧ/' => 't', + '/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ/' => 'U', + '/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ/' => 'u', + '/Ý|Ÿ|Ŷ/' => 'Y', + '/ý|ÿ|ŷ/' => 'y', + '/Ŵ/' => 'W', + '/ŵ/' => 'w', + '/Ź|Ż|Ž/' => 'Z', + '/ź|ż|ž/' => 'z', + '/Æ|Ǽ/' => 'AE', + '/ß/' => 'ss', + '/IJ/' => 'IJ', + '/ij/' => 'ij', + '/Œ/' => 'OE', + '/ƒ/' => 'f' +]; /* End of file foreign_chars.php */ -/* Location: ./application/config/foreign_chars.php */ \ No newline at end of file +/* Location: ./application/config/foreign_chars.php */ diff --git a/src/application/config/hooks.php b/src/application/config/hooks.php index dfbb0be8..05134157 100644 --- a/src/application/config/hooks.php +++ b/src/application/config/hooks.php @@ -1,4 +1,5 @@ - - 403 Forbidden + 403 Forbidden

Directory access is forbidden.

- \ No newline at end of file + diff --git a/src/application/config/migration.php b/src/application/config/migration.php index 89821f3b..ee41eb43 100644 --- a/src/application/config/migration.php +++ b/src/application/config/migration.php @@ -1,4 +1,5 @@ array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'), - 'cpt' => 'application/mac-compactpro', - 'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'), - 'bin' => array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'), - 'dms' => 'application/octet-stream', - 'lha' => 'application/octet-stream', - 'lzh' => 'application/octet-stream', - 'exe' => array('application/octet-stream', 'application/x-msdownload'), - 'class' => 'application/octet-stream', - 'psd' => array('application/x-photoshop', 'image/vnd.adobe.photoshop'), - 'so' => 'application/octet-stream', - 'sea' => 'application/octet-stream', - 'dll' => 'application/octet-stream', - 'oda' => 'application/oda', - 'pdf' => array('application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'), - 'ai' => array('application/pdf', 'application/postscript'), - 'eps' => 'application/postscript', - 'ps' => 'application/postscript', - 'smi' => 'application/smil', - 'smil' => 'application/smil', - 'mif' => 'application/vnd.mif', - 'xls' => array('application/vnd.ms-excel', 'application/msexcel', 'application/x-msexcel', 'application/x-ms-excel', 'application/x-excel', 'application/x-dos_ms_excel', 'application/xls', 'application/x-xls', 'application/excel', 'application/download', 'application/vnd.ms-office', 'application/msword'), - 'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/msword'), - 'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/x-zip', 'application/zip'), - 'wbxml' => 'application/wbxml', - 'wmlc' => 'application/wmlc', - 'dcr' => 'application/x-director', - 'dir' => 'application/x-director', - 'dxr' => 'application/x-director', - 'dvi' => 'application/x-dvi', - 'gtar' => 'application/x-gtar', - 'gz' => 'application/x-gzip', - 'gzip' => 'application/x-gzip', - 'php' => array('application/x-httpd-php', 'application/php', 'application/x-php', 'text/php', 'text/x-php', 'application/x-httpd-php-source'), - 'php4' => 'application/x-httpd-php', - 'php3' => 'application/x-httpd-php', - 'phtml' => 'application/x-httpd-php', - 'phps' => 'application/x-httpd-php-source', - 'js' => array('application/x-javascript', 'text/plain'), - 'swf' => 'application/x-shockwave-flash', - 'sit' => 'application/x-stuffit', - 'tar' => 'application/x-tar', - 'tgz' => array('application/x-tar', 'application/x-gzip-compressed'), - 'z' => 'application/x-compress', - 'xhtml' => 'application/xhtml+xml', - 'xht' => 'application/xhtml+xml', - 'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'), - 'rar' => array('application/x-rar', 'application/rar', 'application/x-rar-compressed'), - 'mid' => 'audio/midi', - 'midi' => 'audio/midi', - 'mpga' => 'audio/mpeg', - 'mp2' => 'audio/mpeg', - 'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'), - 'aif' => array('audio/x-aiff', 'audio/aiff'), - 'aiff' => array('audio/x-aiff', 'audio/aiff'), - 'aifc' => 'audio/x-aiff', - 'ram' => 'audio/x-pn-realaudio', - 'rm' => 'audio/x-pn-realaudio', - 'rpm' => 'audio/x-pn-realaudio-plugin', - 'ra' => 'audio/x-realaudio', - 'rv' => 'video/vnd.rn-realvideo', - 'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'), - 'bmp' => array('image/bmp', 'image/x-bmp', 'image/x-bitmap', 'image/x-xbitmap', 'image/x-win-bitmap', 'image/x-windows-bmp', 'image/ms-bmp', 'image/x-ms-bmp', 'application/bmp', 'application/x-bmp', 'application/x-win-bitmap'), - 'gif' => 'image/gif', - 'jpeg' => array('image/jpeg', 'image/pjpeg'), - 'jpg' => array('image/jpeg', 'image/pjpeg'), - 'jpe' => array('image/jpeg', 'image/pjpeg'), - 'jp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), - 'j2k' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), - 'jpf' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), - 'jpg2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), - 'jpx' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), - 'jpm' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), - 'mj2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), - 'mjp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), - 'png' => array('image/png', 'image/x-png'), - 'tiff' => 'image/tiff', - 'tif' => 'image/tiff', - 'css' => array('text/css', 'text/plain'), - 'html' => array('text/html', 'text/plain'), - 'htm' => array('text/html', 'text/plain'), - 'shtml' => array('text/html', 'text/plain'), - 'txt' => 'text/plain', - 'text' => 'text/plain', - 'log' => array('text/plain', 'text/x-log'), - 'rtx' => 'text/richtext', - 'rtf' => 'text/rtf', - 'xml' => array('application/xml', 'text/xml', 'text/plain'), - 'xsl' => array('application/xml', 'text/xsl', 'text/xml'), - 'mpeg' => 'video/mpeg', - 'mpg' => 'video/mpeg', - 'mpe' => 'video/mpeg', - 'qt' => 'video/quicktime', - 'mov' => 'video/quicktime', - 'avi' => array('video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'), - 'movie' => 'video/x-sgi-movie', - 'doc' => array('application/msword', 'application/vnd.ms-office'), - 'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword', 'application/x-zip'), - 'dot' => array('application/msword', 'application/vnd.ms-office'), - 'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'), - 'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword', 'application/x-zip'), - 'word' => array('application/msword', 'application/octet-stream'), - 'xl' => 'application/excel', - 'eml' => 'message/rfc822', - 'json' => array('application/json', 'text/json'), - 'pem' => array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'), - 'p10' => array('application/x-pkcs10', 'application/pkcs10'), - 'p12' => 'application/x-pkcs12', - 'p7a' => 'application/x-pkcs7-signature', - 'p7c' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'), - 'p7m' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'), - 'p7r' => 'application/x-pkcs7-certreqresp', - 'p7s' => 'application/pkcs7-signature', - 'crt' => array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'), - 'crl' => array('application/pkix-crl', 'application/pkcs-crl'), - 'der' => 'application/x-x509-ca-cert', - 'kdb' => 'application/octet-stream', - 'pgp' => 'application/pgp', - 'gpg' => 'application/gpg-keys', - 'sst' => 'application/octet-stream', - 'csr' => 'application/octet-stream', - 'rsa' => 'application/x-pkcs7', - 'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'), - '3g2' => 'video/3gpp2', - '3gp' => array('video/3gp', 'video/3gpp'), - 'mp4' => 'video/mp4', - 'm4a' => 'audio/x-m4a', - 'f4v' => array('video/mp4', 'video/x-f4v'), - 'flv' => 'video/x-flv', - 'webm' => 'video/webm', - 'aac' => 'audio/x-acc', - 'm4u' => 'application/vnd.mpegurl', - 'm3u' => 'text/plain', - 'xspf' => 'application/xspf+xml', - 'vlc' => 'application/videolan', - 'wmv' => array('video/x-ms-wmv', 'video/x-ms-asf'), - 'au' => 'audio/x-au', - 'ac3' => 'audio/ac3', - 'flac' => 'audio/x-flac', - 'ogg' => array('audio/ogg', 'video/ogg', 'application/ogg'), - 'kmz' => array('application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'), - 'kml' => array('application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml'), - 'ics' => 'text/calendar', - 'ical' => 'text/calendar', - 'zsh' => 'text/x-scriptzsh', - '7zip' => array('application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'), - 'cdr' => array('application/cdr', 'application/coreldraw', 'application/x-cdr', 'application/x-coreldraw', 'image/cdr', 'image/x-cdr', 'zz-application/zz-winassoc-cdr'), - 'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'), - 'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'), - 'svg' => array('image/svg+xml', 'application/xml', 'text/xml'), - 'vcf' => 'text/x-vcard', - 'srt' => array('text/srt', 'text/plain'), - 'vtt' => array('text/vtt', 'text/plain'), - 'ico' => array('image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon') -); +return [ + 'hqx' => [ + 'application/mac-binhex40', + 'application/mac-binhex', + 'application/x-binhex40', + 'application/x-mac-binhex40' + ], + 'cpt' => 'application/mac-compactpro', + 'csv' => [ + 'text/x-comma-separated-values', + 'text/comma-separated-values', + 'application/octet-stream', + 'application/vnd.ms-excel', + 'application/x-csv', + 'text/x-csv', + 'text/csv', + 'application/csv', + 'application/excel', + 'application/vnd.msexcel', + 'text/plain' + ], + 'bin' => [ + 'application/macbinary', + 'application/mac-binary', + 'application/octet-stream', + 'application/x-binary', + 'application/x-macbinary' + ], + 'dms' => 'application/octet-stream', + 'lha' => 'application/octet-stream', + 'lzh' => 'application/octet-stream', + 'exe' => ['application/octet-stream', 'application/x-msdownload'], + 'class' => 'application/octet-stream', + 'psd' => ['application/x-photoshop', 'image/vnd.adobe.photoshop'], + 'so' => 'application/octet-stream', + 'sea' => 'application/octet-stream', + 'dll' => 'application/octet-stream', + 'oda' => 'application/oda', + 'pdf' => ['application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'], + 'ai' => ['application/pdf', 'application/postscript'], + 'eps' => 'application/postscript', + 'ps' => 'application/postscript', + 'smi' => 'application/smil', + 'smil' => 'application/smil', + 'mif' => 'application/vnd.mif', + 'xls' => [ + 'application/vnd.ms-excel', + 'application/msexcel', + 'application/x-msexcel', + 'application/x-ms-excel', + 'application/x-excel', + 'application/x-dos_ms_excel', + 'application/xls', + 'application/x-xls', + 'application/excel', + 'application/download', + 'application/vnd.ms-office', + 'application/msword' + ], + 'ppt' => [ + 'application/powerpoint', + 'application/vnd.ms-powerpoint', + 'application/vnd.ms-office', + 'application/msword' + ], + 'pptx' => [ + 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'application/x-zip', + 'application/zip' + ], + 'wbxml' => 'application/wbxml', + 'wmlc' => 'application/wmlc', + 'dcr' => 'application/x-director', + 'dir' => 'application/x-director', + 'dxr' => 'application/x-director', + 'dvi' => 'application/x-dvi', + 'gtar' => 'application/x-gtar', + 'gz' => 'application/x-gzip', + 'gzip' => 'application/x-gzip', + 'php' => [ + 'application/x-httpd-php', + 'application/php', + 'application/x-php', + 'text/php', + 'text/x-php', + 'application/x-httpd-php-source' + ], + 'php4' => 'application/x-httpd-php', + 'php3' => 'application/x-httpd-php', + 'phtml' => 'application/x-httpd-php', + 'phps' => 'application/x-httpd-php-source', + 'js' => ['application/x-javascript', 'text/plain'], + 'swf' => 'application/x-shockwave-flash', + 'sit' => 'application/x-stuffit', + 'tar' => 'application/x-tar', + 'tgz' => ['application/x-tar', 'application/x-gzip-compressed'], + 'z' => 'application/x-compress', + 'xhtml' => 'application/xhtml+xml', + 'xht' => 'application/xhtml+xml', + 'zip' => [ + 'application/x-zip', + 'application/zip', + 'application/x-zip-compressed', + 'application/s-compressed', + 'multipart/x-zip' + ], + 'rar' => ['application/x-rar', 'application/rar', 'application/x-rar-compressed'], + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mpga' => 'audio/mpeg', + 'mp2' => 'audio/mpeg', + 'mp3' => ['audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'], + 'aif' => ['audio/x-aiff', 'audio/aiff'], + 'aiff' => ['audio/x-aiff', 'audio/aiff'], + 'aifc' => 'audio/x-aiff', + 'ram' => 'audio/x-pn-realaudio', + 'rm' => 'audio/x-pn-realaudio', + 'rpm' => 'audio/x-pn-realaudio-plugin', + 'ra' => 'audio/x-realaudio', + 'rv' => 'video/vnd.rn-realvideo', + 'wav' => ['audio/x-wav', 'audio/wave', 'audio/wav'], + 'bmp' => [ + 'image/bmp', + 'image/x-bmp', + 'image/x-bitmap', + 'image/x-xbitmap', + 'image/x-win-bitmap', + 'image/x-windows-bmp', + 'image/ms-bmp', + 'image/x-ms-bmp', + 'application/bmp', + 'application/x-bmp', + 'application/x-win-bitmap' + ], + 'gif' => 'image/gif', + 'jpeg' => ['image/jpeg', 'image/pjpeg'], + 'jpg' => ['image/jpeg', 'image/pjpeg'], + 'jpe' => ['image/jpeg', 'image/pjpeg'], + 'jp2' => ['image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'], + 'j2k' => ['image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'], + 'jpf' => ['image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'], + 'jpg2' => ['image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'], + 'jpx' => ['image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'], + 'jpm' => ['image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'], + 'mj2' => ['image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'], + 'mjp2' => ['image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'], + 'png' => ['image/png', 'image/x-png'], + 'tiff' => 'image/tiff', + 'tif' => 'image/tiff', + 'css' => ['text/css', 'text/plain'], + 'html' => ['text/html', 'text/plain'], + 'htm' => ['text/html', 'text/plain'], + 'shtml' => ['text/html', 'text/plain'], + 'txt' => 'text/plain', + 'text' => 'text/plain', + 'log' => ['text/plain', 'text/x-log'], + 'rtx' => 'text/richtext', + 'rtf' => 'text/rtf', + 'xml' => ['application/xml', 'text/xml', 'text/plain'], + 'xsl' => ['application/xml', 'text/xsl', 'text/xml'], + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpe' => 'video/mpeg', + 'qt' => 'video/quicktime', + 'mov' => 'video/quicktime', + 'avi' => ['video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'], + 'movie' => 'video/x-sgi-movie', + 'doc' => ['application/msword', 'application/vnd.ms-office'], + 'docx' => [ + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'application/zip', + 'application/msword', + 'application/x-zip' + ], + 'dot' => ['application/msword', 'application/vnd.ms-office'], + 'dotx' => [ + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'application/zip', + 'application/msword' + ], + 'xlsx' => [ + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'application/zip', + 'application/vnd.ms-excel', + 'application/msword', + 'application/x-zip' + ], + 'word' => ['application/msword', 'application/octet-stream'], + 'xl' => 'application/excel', + 'eml' => 'message/rfc822', + 'json' => ['application/json', 'text/json'], + 'pem' => ['application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'], + 'p10' => ['application/x-pkcs10', 'application/pkcs10'], + 'p12' => 'application/x-pkcs12', + 'p7a' => 'application/x-pkcs7-signature', + 'p7c' => ['application/pkcs7-mime', 'application/x-pkcs7-mime'], + 'p7m' => ['application/pkcs7-mime', 'application/x-pkcs7-mime'], + 'p7r' => 'application/x-pkcs7-certreqresp', + 'p7s' => 'application/pkcs7-signature', + 'crt' => ['application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'], + 'crl' => ['application/pkix-crl', 'application/pkcs-crl'], + 'der' => 'application/x-x509-ca-cert', + 'kdb' => 'application/octet-stream', + 'pgp' => 'application/pgp', + 'gpg' => 'application/gpg-keys', + 'sst' => 'application/octet-stream', + 'csr' => 'application/octet-stream', + 'rsa' => 'application/x-pkcs7', + 'cer' => ['application/pkix-cert', 'application/x-x509-ca-cert'], + '3g2' => 'video/3gpp2', + '3gp' => ['video/3gp', 'video/3gpp'], + 'mp4' => 'video/mp4', + 'm4a' => 'audio/x-m4a', + 'f4v' => ['video/mp4', 'video/x-f4v'], + 'flv' => 'video/x-flv', + 'webm' => 'video/webm', + 'aac' => 'audio/x-acc', + 'm4u' => 'application/vnd.mpegurl', + 'm3u' => 'text/plain', + 'xspf' => 'application/xspf+xml', + 'vlc' => 'application/videolan', + 'wmv' => ['video/x-ms-wmv', 'video/x-ms-asf'], + 'au' => 'audio/x-au', + 'ac3' => 'audio/ac3', + 'flac' => 'audio/x-flac', + 'ogg' => ['audio/ogg', 'video/ogg', 'application/ogg'], + 'kmz' => ['application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'], + 'kml' => ['application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml'], + 'ics' => 'text/calendar', + 'ical' => 'text/calendar', + 'zsh' => 'text/x-scriptzsh', + '7zip' => ['application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'], + 'cdr' => [ + 'application/cdr', + 'application/coreldraw', + 'application/x-cdr', + 'application/x-coreldraw', + 'image/cdr', + 'image/x-cdr', + 'zz-application/zz-winassoc-cdr' + ], + 'wma' => ['audio/x-ms-wma', 'video/x-ms-asf'], + 'jar' => [ + 'application/java-archive', + 'application/x-java-application', + 'application/x-jar', + 'application/x-compressed' + ], + 'svg' => ['image/svg+xml', 'application/xml', 'text/xml'], + 'vcf' => 'text/x-vcard', + 'srt' => ['text/srt', 'text/plain'], + 'vtt' => ['text/vtt', 'text/plain'], + 'ico' => ['image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon'] +]; diff --git a/src/application/config/profiler.php b/src/application/config/profiler.php index f8a5b1a1..b3c36367 100644 --- a/src/application/config/profiler.php +++ b/src/application/config/profiler.php @@ -1,4 +1,5 @@ - array('grin.gif', '19', '19', 'grin'), - ':lol:' => array('lol.gif', '19', '19', 'LOL'), - ':cheese:' => array('cheese.gif', '19', '19', 'cheese'), - ':)' => array('smile.gif', '19', '19', 'smile'), - ';-)' => array('wink.gif', '19', '19', 'wink'), - ';)' => array('wink.gif', '19', '19', 'wink'), - ':smirk:' => array('smirk.gif', '19', '19', 'smirk'), - ':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'), - ':-S' => array('confused.gif', '19', '19', 'confused'), - ':wow:' => array('surprise.gif', '19', '19', 'surprised'), - ':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'), - ':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'), - '%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'), - ';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'), - ':P' => array('raspberry.gif', '19', '19', 'raspberry'), - ':blank:' => array('blank.gif', '19', '19', 'blank stare'), - ':long:' => array('longface.gif', '19', '19', 'long face'), - ':ohh:' => array('ohh.gif', '19', '19', 'ohh'), - ':grrr:' => array('grrr.gif', '19', '19', 'grrr'), - ':gulp:' => array('gulp.gif', '19', '19', 'gulp'), - '8-/' => array('ohoh.gif', '19', '19', 'oh oh'), - ':down:' => array('downer.gif', '19', '19', 'downer'), - ':red:' => array('embarrassed.gif', '19', '19', 'red face'), - ':sick:' => array('sick.gif', '19', '19', 'sick'), - ':shut:' => array('shuteye.gif', '19', '19', 'shut eye'), - ':-/' => array('hmm.gif', '19', '19', 'hmmm'), - '>:(' => array('mad.gif', '19', '19', 'mad'), - ':mad:' => array('mad.gif', '19', '19', 'mad'), - '>:-(' => array('angry.gif', '19', '19', 'angry'), - ':angry:' => array('angry.gif', '19', '19', 'angry'), - ':zip:' => array('zip.gif', '19', '19', 'zipper'), - ':kiss:' => array('kiss.gif', '19', '19', 'kiss'), - ':ahhh:' => array('shock.gif', '19', '19', 'shock'), - ':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'), - ':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'), - ':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'), - ':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'), - ':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'), - ':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'), - ':vampire:' => array('vampire.gif', '19', '19', 'vampire'), - ':snake:' => array('snake.gif', '19', '19', 'snake'), - ':exclaim:' => array('exclaim.gif', '19', '19', 'excaim'), - ':question:' => array('question.gif', '19', '19', 'question') // no comma after last item + ':-)' => ['grin.gif', '19', '19', 'grin'], + ':lol:' => ['lol.gif', '19', '19', 'LOL'], + ':cheese:' => ['cheese.gif', '19', '19', 'cheese'], + ':)' => ['smile.gif', '19', '19', 'smile'], + ';-)' => ['wink.gif', '19', '19', 'wink'], + ';)' => ['wink.gif', '19', '19', 'wink'], + ':smirk:' => ['smirk.gif', '19', '19', 'smirk'], + ':roll:' => ['rolleyes.gif', '19', '19', 'rolleyes'], + ':-S' => ['confused.gif', '19', '19', 'confused'], + ':wow:' => ['surprise.gif', '19', '19', 'surprised'], + ':bug:' => ['bigsurprise.gif', '19', '19', 'big surprise'], + ':-P' => ['tongue_laugh.gif', '19', '19', 'tongue laugh'], + '%-P' => ['tongue_rolleye.gif', '19', '19', 'tongue rolleye'], + ';-P' => ['tongue_wink.gif', '19', '19', 'tongue wink'], + ':P' => ['raspberry.gif', '19', '19', 'raspberry'], + ':blank:' => ['blank.gif', '19', '19', 'blank stare'], + ':long:' => ['longface.gif', '19', '19', 'long face'], + ':ohh:' => ['ohh.gif', '19', '19', 'ohh'], + ':grrr:' => ['grrr.gif', '19', '19', 'grrr'], + ':gulp:' => ['gulp.gif', '19', '19', 'gulp'], + '8-/' => ['ohoh.gif', '19', '19', 'oh oh'], + ':down:' => ['downer.gif', '19', '19', 'downer'], + ':red:' => ['embarrassed.gif', '19', '19', 'red face'], + ':sick:' => ['sick.gif', '19', '19', 'sick'], + ':shut:' => ['shuteye.gif', '19', '19', 'shut eye'], + ':-/' => ['hmm.gif', '19', '19', 'hmmm'], + '>:(' => ['mad.gif', '19', '19', 'mad'], + ':mad:' => ['mad.gif', '19', '19', 'mad'], + '>:-(' => ['angry.gif', '19', '19', 'angry'], + ':angry:' => ['angry.gif', '19', '19', 'angry'], + ':zip:' => ['zip.gif', '19', '19', 'zipper'], + ':kiss:' => ['kiss.gif', '19', '19', 'kiss'], + ':ahhh:' => ['shock.gif', '19', '19', 'shock'], + ':coolsmile:' => ['shade_smile.gif', '19', '19', 'cool smile'], + ':coolsmirk:' => ['shade_smirk.gif', '19', '19', 'cool smirk'], + ':coolgrin:' => ['shade_grin.gif', '19', '19', 'cool grin'], + ':coolhmm:' => ['shade_hmm.gif', '19', '19', 'cool hmm'], + ':coolmad:' => ['shade_mad.gif', '19', '19', 'cool mad'], + ':coolcheese:' => ['shade_cheese.gif', '19', '19', 'cool cheese'], + ':vampire:' => ['vampire.gif', '19', '19', 'vampire'], + ':snake:' => ['snake.gif', '19', '19', 'snake'], + ':exclaim:' => ['exclaim.gif', '19', '19', 'excaim'], + ':question:' => ['question.gif', '19', '19', 'question'] // no comma after last item - ); +]; /* End of file smileys.php */ -/* Location: ./application/config/smileys.php */ \ No newline at end of file +/* Location: ./application/config/smileys.php */ diff --git a/src/application/config/user_agents.php b/src/application/config/user_agents.php index e2d3c3af..0e12ecc1 100644 --- a/src/application/config/user_agents.php +++ b/src/application/config/user_agents.php @@ -1,4 +1,5 @@ - 'Windows Longhorn', - 'windows nt 5.2' => 'Windows 2003', - 'windows nt 5.0' => 'Windows 2000', - 'windows nt 5.1' => 'Windows XP', - 'windows nt 4.0' => 'Windows NT 4.0', - 'winnt4.0' => 'Windows NT 4.0', - 'winnt 4.0' => 'Windows NT', - 'winnt' => 'Windows NT', - 'windows 98' => 'Windows 98', - 'win98' => 'Windows 98', - 'windows 95' => 'Windows 95', - 'win95' => 'Windows 95', - 'windows' => 'Unknown Windows OS', - 'os x' => 'Mac OS X', - 'ppc mac' => 'Power PC Mac', - 'freebsd' => 'FreeBSD', - 'ppc' => 'Macintosh', - 'linux' => 'Linux', - 'debian' => 'Debian', - 'sunos' => 'Sun Solaris', - 'beos' => 'BeOS', - 'apachebench' => 'ApacheBench', - 'aix' => 'AIX', - 'irix' => 'Irix', - 'osf' => 'DEC OSF', - 'hp-ux' => 'HP-UX', - 'netbsd' => 'NetBSD', - 'bsdi' => 'BSDi', - 'openbsd' => 'OpenBSD', - 'gnu' => 'GNU/Linux', - 'unix' => 'Unknown Unix OS' - ); +$platforms = [ + 'windows nt 6.0' => 'Windows Longhorn', + 'windows nt 5.2' => 'Windows 2003', + 'windows nt 5.0' => 'Windows 2000', + 'windows nt 5.1' => 'Windows XP', + 'windows nt 4.0' => 'Windows NT 4.0', + 'winnt4.0' => 'Windows NT 4.0', + 'winnt 4.0' => 'Windows NT', + 'winnt' => 'Windows NT', + 'windows 98' => 'Windows 98', + 'win98' => 'Windows 98', + 'windows 95' => 'Windows 95', + 'win95' => 'Windows 95', + 'windows' => 'Unknown Windows OS', + 'os x' => 'Mac OS X', + 'ppc mac' => 'Power PC Mac', + 'freebsd' => 'FreeBSD', + 'ppc' => 'Macintosh', + 'linux' => 'Linux', + 'debian' => 'Debian', + 'sunos' => 'Sun Solaris', + 'beos' => 'BeOS', + 'apachebench' => 'ApacheBench', + 'aix' => 'AIX', + 'irix' => 'Irix', + 'osf' => 'DEC OSF', + 'hp-ux' => 'HP-UX', + 'netbsd' => 'NetBSD', + 'bsdi' => 'BSDi', + 'openbsd' => 'OpenBSD', + 'gnu' => 'GNU/Linux', + 'unix' => 'Unknown Unix OS' +]; // The order of this array should NOT be changed. Many browsers return // multiple browser types so we want to identify the sub-type first. -$browsers = array( - 'Flock' => 'Flock', - 'Chrome' => 'Chrome', - 'Opera' => 'Opera', - 'MSIE' => 'Internet Explorer', - 'Internet Explorer' => 'Internet Explorer', - 'Shiira' => 'Shiira', - 'Firefox' => 'Firefox', - 'Chimera' => 'Chimera', - 'Phoenix' => 'Phoenix', - 'Firebird' => 'Firebird', - 'Camino' => 'Camino', - 'Netscape' => 'Netscape', - 'OmniWeb' => 'OmniWeb', - 'Safari' => 'Safari', - 'Mozilla' => 'Mozilla', - 'Konqueror' => 'Konqueror', - 'icab' => 'iCab', - 'Lynx' => 'Lynx', - 'Links' => 'Links', - 'hotjava' => 'HotJava', - 'amaya' => 'Amaya', - 'IBrowse' => 'IBrowse' - ); +$browsers = [ + 'Flock' => 'Flock', + 'Chrome' => 'Chrome', + 'Opera' => 'Opera', + 'MSIE' => 'Internet Explorer', + 'Internet Explorer' => 'Internet Explorer', + 'Shiira' => 'Shiira', + 'Firefox' => 'Firefox', + 'Chimera' => 'Chimera', + 'Phoenix' => 'Phoenix', + 'Firebird' => 'Firebird', + 'Camino' => 'Camino', + 'Netscape' => 'Netscape', + 'OmniWeb' => 'OmniWeb', + 'Safari' => 'Safari', + 'Mozilla' => 'Mozilla', + 'Konqueror' => 'Konqueror', + 'icab' => 'iCab', + 'Lynx' => 'Lynx', + 'Links' => 'Links', + 'hotjava' => 'HotJava', + 'amaya' => 'Amaya', + 'IBrowse' => 'IBrowse' +]; -$mobiles = array( - // legacy array, old values commented out - 'mobileexplorer' => 'Mobile Explorer', +$mobiles = [ + // legacy array, old values commented out + 'mobileexplorer' => 'Mobile Explorer', // 'openwave' => 'Open Wave', // 'opera mini' => 'Opera Mini', // 'operamini' => 'Opera Mini', // 'elaine' => 'Palm', - 'palmsource' => 'Palm', + 'palmsource' => 'Palm', // 'digital paths' => 'Palm', // 'avantgo' => 'Avantgo', // 'xiino' => 'Xiino', - 'palmscape' => 'Palmscape', + 'palmscape' => 'Palmscape', // 'nokia' => 'Nokia', // 'ericsson' => 'Ericsson', // 'blackberry' => 'BlackBerry', // 'motorola' => 'Motorola' - // Phones and Manufacturers - 'motorola' => "Motorola", - 'nokia' => "Nokia", - 'palm' => "Palm", - 'iphone' => "Apple iPhone", - 'ipad' => "iPad", - 'ipod' => "Apple iPod Touch", - 'sony' => "Sony Ericsson", - 'ericsson' => "Sony Ericsson", - 'blackberry' => "BlackBerry", - 'cocoon' => "O2 Cocoon", - 'blazer' => "Treo", - 'lg' => "LG", - 'amoi' => "Amoi", - 'xda' => "XDA", - 'mda' => "MDA", - 'vario' => "Vario", - 'htc' => "HTC", - 'samsung' => "Samsung", - 'sharp' => "Sharp", - 'sie-' => "Siemens", - 'alcatel' => "Alcatel", - 'benq' => "BenQ", - 'ipaq' => "HP iPaq", - 'mot-' => "Motorola", - 'playstation portable' => "PlayStation Portable", - 'hiptop' => "Danger Hiptop", - 'nec-' => "NEC", - 'panasonic' => "Panasonic", - 'philips' => "Philips", - 'sagem' => "Sagem", - 'sanyo' => "Sanyo", - 'spv' => "SPV", - 'zte' => "ZTE", - 'sendo' => "Sendo", + // Phones and Manufacturers + 'motorola' => "Motorola", + 'nokia' => "Nokia", + 'palm' => "Palm", + 'iphone' => "Apple iPhone", + 'ipad' => "iPad", + 'ipod' => "Apple iPod Touch", + 'sony' => "Sony Ericsson", + 'ericsson' => "Sony Ericsson", + 'blackberry' => "BlackBerry", + 'cocoon' => "O2 Cocoon", + 'blazer' => "Treo", + 'lg' => "LG", + 'amoi' => "Amoi", + 'xda' => "XDA", + 'mda' => "MDA", + 'vario' => "Vario", + 'htc' => "HTC", + 'samsung' => "Samsung", + 'sharp' => "Sharp", + 'sie-' => "Siemens", + 'alcatel' => "Alcatel", + 'benq' => "BenQ", + 'ipaq' => "HP iPaq", + 'mot-' => "Motorola", + 'playstation portable' => "PlayStation Portable", + 'hiptop' => "Danger Hiptop", + 'nec-' => "NEC", + 'panasonic' => "Panasonic", + 'philips' => "Philips", + 'sagem' => "Sagem", + 'sanyo' => "Sanyo", + 'spv' => "SPV", + 'zte' => "ZTE", + 'sendo' => "Sendo", - // Operating Systems - 'symbian' => "Symbian", - 'SymbianOS' => "SymbianOS", - 'elaine' => "Palm", - 'palm' => "Palm", - 'series60' => "Symbian S60", - 'windows ce' => "Windows CE", + // Operating Systems + 'symbian' => "Symbian", + 'SymbianOS' => "SymbianOS", + 'elaine' => "Palm", + 'palm' => "Palm", + 'series60' => "Symbian S60", + 'windows ce' => "Windows CE", - // Browsers - 'obigo' => "Obigo", - 'netfront' => "Netfront Browser", - 'openwave' => "Openwave Browser", - 'mobilexplorer' => "Mobile Explorer", - 'operamini' => "Opera Mini", - 'opera mini' => "Opera Mini", + // Browsers + 'obigo' => "Obigo", + 'netfront' => "Netfront Browser", + 'openwave' => "Openwave Browser", + 'mobilexplorer' => "Mobile Explorer", + 'operamini' => "Opera Mini", + 'opera mini' => "Opera Mini", - // Other - 'digital paths' => "Digital Paths", - 'avantgo' => "AvantGo", - 'xiino' => "Xiino", - 'novarra' => "Novarra Transcoder", - 'vodafone' => "Vodafone", - 'docomo' => "NTT DoCoMo", - 'o2' => "O2", + // Other + 'digital paths' => "Digital Paths", + 'avantgo' => "AvantGo", + 'xiino' => "Xiino", + 'novarra' => "Novarra Transcoder", + 'vodafone' => "Vodafone", + 'docomo' => "NTT DoCoMo", + 'o2' => "O2", - // Fallback - 'mobile' => "Generic Mobile", - 'wireless' => "Generic Mobile", - 'j2me' => "Generic Mobile", - 'midp' => "Generic Mobile", - 'cldc' => "Generic Mobile", - 'up.link' => "Generic Mobile", - 'up.browser' => "Generic Mobile", - 'smartphone' => "Generic Mobile", - 'cellphone' => "Generic Mobile" - ); + // Fallback + 'mobile' => "Generic Mobile", + 'wireless' => "Generic Mobile", + 'j2me' => "Generic Mobile", + 'midp' => "Generic Mobile", + 'cldc' => "Generic Mobile", + 'up.link' => "Generic Mobile", + 'up.browser' => "Generic Mobile", + 'smartphone' => "Generic Mobile", + 'cellphone' => "Generic Mobile" +]; // There are hundreds of bots but these are the most common. -$robots = array( - 'googlebot' => 'Googlebot', - 'msnbot' => 'MSNBot', - 'slurp' => 'Inktomi Slurp', - 'yahoo' => 'Yahoo', - 'askjeeves' => 'AskJeeves', - 'fastcrawler' => 'FastCrawler', - 'infoseek' => 'InfoSeek Robot 1.0', - 'lycos' => 'Lycos' - ); +$robots = [ + 'googlebot' => 'Googlebot', + 'msnbot' => 'MSNBot', + 'slurp' => 'Inktomi Slurp', + 'yahoo' => 'Yahoo', + 'askjeeves' => 'AskJeeves', + 'fastcrawler' => 'FastCrawler', + 'infoseek' => 'InfoSeek Robot 1.0', + 'lycos' => 'Lycos' +]; /* End of file user_agents.php */ -/* Location: ./application/config/user_agents.php */ \ No newline at end of file +/* Location: ./application/config/user_agents.php */ diff --git a/src/application/controllers/Backend.php b/src/application/controllers/Backend.php index 77fcd5d4..bcd177c9 100644 --- a/src/application/controllers/Backend.php +++ b/src/application/controllers/Backend.php @@ -30,7 +30,8 @@ class Backend extends CI_Controller { { $this->config->set_item('language', $this->session->userdata('language')); $this->lang->load('translations', $this->session->userdata('language')); - } else + } + else { $this->lang->load('translations', $this->config->item('language')); // default } @@ -80,7 +81,8 @@ class Backend extends CI_Controller { { $secretary = $this->secretaries_model->get_row($this->session->userdata('user_id')); $view['secretary_providers'] = $secretary['providers']; - } else + } + else { $view['secretary_providers'] = []; } @@ -92,7 +94,8 @@ class Backend extends CI_Controller { $appointment = $results[0]; $appointment['customer'] = $this->customers_model->get_row($appointment['id_users_customer']); $view['edit_appointment'] = $appointment; // This will display the appointment edit dialog on page load. - } else + } + else { $view['edit_appointment'] = NULL; } @@ -320,11 +323,11 @@ class Backend extends CI_Controller { throw new Exception($this->migration->error_string()); } - $view = ['success' => true]; + $view = ['success' => TRUE]; } catch (Exception $exc) { - $view = ['success' => false, 'exception' => $exc->getMessage()]; + $view = ['success' => FALSE, 'exception' => $exc->getMessage()]; } $this->load->view('general/update', $view); diff --git a/src/application/controllers/Backend_api.php b/src/application/controllers/Backend_api.php index ccc4fbb6..fb5abeff 100644 --- a/src/application/controllers/Backend_api.php +++ b/src/application/controllers/Backend_api.php @@ -54,7 +54,8 @@ class Backend_api extends CI_Controller { { $this->config->set_item('language', $this->session->userdata('language')); $this->lang->load('translations', $this->session->userdata('language')); - } else + } + else { $this->lang->load('translations', $this->config->item('language')); // default } @@ -191,7 +192,8 @@ class Backend_api extends CI_Controller { if ($this->input->post('filter_type') == FILTER_TYPE_PROVIDER) { $where_id = 'id_users_provider'; - } else + } + else { $where_id = 'id_services'; } @@ -328,7 +330,8 @@ class Backend_api extends CI_Controller { $service, $customer, $company_settings); $appointment['id_google_calendar'] = $google_event->id; $this->appointments_model->add($appointment); // Store google calendar id. - } else + } + else { $this->google_sync->update_appointment($appointment, $provider, $service, $customer, $company_settings); @@ -355,7 +358,8 @@ class Backend_api extends CI_Controller { $customer_message = new Text($this->lang->line('thank_you_for_appointment')); $provider_title = new Text($this->lang->line('appointment_added_to_your_plan')); $provider_message = new Text($this->lang->line('appointment_link_description')); - } else + } + else { $customer_title = new Text($this->lang->line('appointment_changes_saved')); $customer_message = new Text(''); @@ -396,7 +400,8 @@ class Backend_api extends CI_Controller { $this->output ->set_content_type('application/json') ->set_output(json_encode(AJAX_SUCCESS)); - } else + } + else { $this->output ->set_content_type('application/json') @@ -516,7 +521,8 @@ class Backend_api extends CI_Controller { $this->output ->set_content_type('application/json') ->set_output(json_encode(AJAX_SUCCESS)); - } else + } + else { $this->output ->set_content_type('application/json') @@ -688,7 +694,8 @@ class Backend_api extends CI_Controller { $google_event = $this->google_sync->add_unavailable($provider, $unavailable); $unavailable['id_google_calendar'] = $google_event->id; $this->appointments_model->add_unavailable($unavailable); - } else + } + else { $google_event = $this->google_sync->update_unavailable($provider, $unavailable); } @@ -704,7 +711,8 @@ class Backend_api extends CI_Controller { $this->output ->set_content_type('application/json') ->set_output(json_encode(['warnings' => $warnings])); - } else + } + else { $this->output ->set_content_type('application/json') @@ -767,7 +775,8 @@ class Backend_api extends CI_Controller { $this->output ->set_content_type('application/json') ->set_output(json_encode(['warnings' => $warnings])); - } else + } + else { $this->output ->set_content_type('application/json') @@ -1434,7 +1443,8 @@ class Backend_api extends CI_Controller { $this->load->model('settings_model'); $settings = json_decode($this->input->post('settings'), TRUE); $this->settings_model->save_settings($settings); - } else + } + else { if ($this->input->post('type') == SETTINGS_USER) { @@ -1566,7 +1576,8 @@ class Backend_api extends CI_Controller { $this->output ->set_content_type('application/json') ->set_output(json_encode($calendars)); - } else + } + else { $this->output ->set_content_type('application/json') diff --git a/src/application/controllers/Errors.php b/src/application/controllers/Errors.php index 8135b187..b1c65256 100644 --- a/src/application/controllers/Errors.php +++ b/src/application/controllers/Errors.php @@ -31,7 +31,8 @@ class Errors extends CI_Controller { { $this->config->set_item('language', $this->session->userdata('language')); $this->lang->load('translations', $this->session->userdata('language')); - } else + } + else { $this->lang->load('translations', $this->config->item('language')); // default } diff --git a/src/application/controllers/Google.php b/src/application/controllers/Google.php index c20c3d07..636b414a 100644 --- a/src/application/controllers/Google.php +++ b/src/application/controllers/Google.php @@ -71,11 +71,13 @@ class Google extends CI_Controller { $this->providers_model->set_setting('google_sync', TRUE, $_SESSION['oauth_provider_id']); $this->providers_model->set_setting('google_token', $token, $_SESSION['oauth_provider_id']); $this->providers_model->set_setting('google_calendar', 'primary', $_SESSION['oauth_provider_id']); - } else + } + else { $this->output->set_output('

Sync provider id not specified!

'); } - } else + } + else { $this->output->set_output('

Authorization Failed!

'); } @@ -154,7 +156,8 @@ class Google extends CI_Controller { { $service = $this->services_model->get_row($appointment['id_services']); $customer = $this->customers_model->get_row($appointment['id_users_customer']); - } else + } + else { $service = NULL; $customer = NULL; @@ -167,7 +170,8 @@ class Google extends CI_Controller { $service, $customer, $company_settings); $appointment['id_google_calendar'] = $google_event->id; $this->appointments_model->add($appointment); // Save gcal id - } else + } + else { // Appointment is synced with google calendar. try diff --git a/src/application/controllers/Installation.php b/src/application/controllers/Installation.php index b3e1c4cc..c4f17070 100644 --- a/src/application/controllers/Installation.php +++ b/src/application/controllers/Installation.php @@ -33,7 +33,8 @@ class Installation extends CI_Controller { { $this->config->set_item('language', $this->session->userdata('language')); $this->lang->load('translations', $this->session->userdata('language')); - } else + } + else { $this->lang->load('translations', $this->config->item('language')); // default } diff --git a/src/application/controllers/User.php b/src/application/controllers/User.php index 259ee5df..fb5f2588 100644 --- a/src/application/controllers/User.php +++ b/src/application/controllers/User.php @@ -33,7 +33,8 @@ class User extends CI_Controller { { $this->config->set_item('language', $this->session->userdata('language')); $this->lang->load('translations', $this->session->userdata('language')); - } else + } + else { $this->lang->load('translations', $this->config->item('language')); // default } @@ -135,7 +136,8 @@ class User extends CI_Controller { $this->output ->set_content_type('application/json') ->set_output(json_encode(AJAX_SUCCESS)); - } else + } + else { $this->output ->set_content_type('application/json') diff --git a/src/application/controllers/api/v1/Availabilities.php b/src/application/controllers/api/v1/Availabilities.php index 5809b5e5..58594257 100644 --- a/src/application/controllers/api/v1/Availabilities.php +++ b/src/application/controllers/api/v1/Availabilities.php @@ -51,7 +51,8 @@ class Availabilities extends API_V1_Controller { if ($this->input->get('date')) { $date = new DateTime($this->input->get('date')); - } else + } + else { $date = new DateTime(); } @@ -238,14 +239,16 @@ class Availabilities extends API_V1_Controller { { // The appointment does not belong in this time period, so we // will not change anything. - } else + } + else { if ($a_start <= $p_start && $a_end <= $p_end && $a_end >= $p_start) { // The appointment starts before the period and finishes somewhere inside. // We will need to break this period and leave the available part. $period['start'] = date('H:i', $a_end); - } else + } + else { if ($a_start >= $p_start && $a_end <= $p_end) { @@ -260,19 +263,22 @@ class Availabilities extends API_V1_Controller { 'start' => date('H:i', $a_end), 'end' => date('H:i', $p_end) ]; - } else + } + else { if ($a_start >= $p_start && $a_end >= $p_start && $a_start <= $p_end) { // The appointment starts in the period and finishes out of it. We will // need to remove the time that is taken from the appointment. $period['end'] = date('H:i', $a_start); - } else + } + else { if ($a_start >= $p_start && $a_end >= $p_end && $a_start >= $p_end) { // The appointment does not belong in the period so do not change anything. - } else + } + else { if ($a_start <= $p_start && $a_end >= $p_end && $a_start <= $p_end) { diff --git a/src/application/helpers/asset_helper.php b/src/application/helpers/asset_helper.php index 51890ebb..25ac929d 100644 --- a/src/application/helpers/asset_helper.php +++ b/src/application/helpers/asset_helper.php @@ -22,10 +22,11 @@ * * @return string Returns the final asset URL. */ -function asset_url($uri = '', $protocol = NULL) { +function asset_url($uri = '', $protocol = NULL) +{ $ci =& get_instance(); - $cache_busting_token = !Config::DEBUG_MODE ? '?' . $ci->config->item('cache_busting_token') : ''; + $cache_busting_token = ! Config::DEBUG_MODE ? '?' . $ci->config->item('cache_busting_token') : ''; return base_url($uri . $cache_busting_token, $protocol); } diff --git a/src/application/helpers/config_helper.php b/src/application/helpers/config_helper.php index 69582570..a7f27055 100644 --- a/src/application/helpers/config_helper.php +++ b/src/application/helpers/config_helper.php @@ -18,8 +18,9 @@ * * @return mixed Returns the configuration value. */ -function config($key) { - $framework = & get_instance(); +function config($key) +{ + $framework = &get_instance(); return $framework->config->item($key); } diff --git a/src/application/helpers/general_helper.php b/src/application/helpers/general_helper.php index aaef9f48..89b95db8 100644 --- a/src/application/helpers/general_helper.php +++ b/src/application/helpers/general_helper.php @@ -34,7 +34,8 @@ function date3339($timestamp = 0) if (preg_match('/^([\-+])(\d{2})(\d{2})$/', date('O', $timestamp), $matches)) { $date .= $matches[1] . $matches[2] . ':' . $matches[3]; - } else + } + else { $date .= 'Z'; } diff --git a/src/application/language/arabic/db_lang.php b/src/application/language/arabic/db_lang.php index b44bda95..b9da89b1 100644 --- a/src/application/language/arabic/db_lang.php +++ b/src/application/language/arabic/db_lang.php @@ -26,13 +26,13 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link https://codeigniter.com - * @since Version 1.0.0 + * @package CodeIgniter + * @author EllisLab Dev Team + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @license http://opensource.org/licenses/MIT MIT License + * @link https://codeigniter.com + * @since Version 1.0.0 * @filesource */ defined('BASEPATH') OR exit('No direct script access allowed'); diff --git a/src/application/language/arabic/email_lang.php b/src/application/language/arabic/email_lang.php index 22dc0fa7..e104db52 100644 --- a/src/application/language/arabic/email_lang.php +++ b/src/application/language/arabic/email_lang.php @@ -26,13 +26,13 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link https://codeigniter.com - * @since Version 1.0.0 + * @package CodeIgniter + * @author EllisLab Dev Team + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @license http://opensource.org/licenses/MIT MIT License + * @link https://codeigniter.com + * @since Version 1.0.0 * @filesource */ defined('BASEPATH') OR exit('No direct script access allowed'); diff --git a/src/application/language/arabic/index.html b/src/application/language/arabic/index.html index e705af27..7afc7bb7 100644 --- a/src/application/language/arabic/index.html +++ b/src/application/language/arabic/index.html @@ -1,6 +1,6 @@ - ٤٠٣ غير مصرح للوصول هنا + ٤٠٣ غير مصرح للوصول هنا diff --git a/src/application/language/arabic/translations_lang.php b/src/application/language/arabic/translations_lang.php index 2daa27ef..cd28ace3 100644 --- a/src/application/language/arabic/translations_lang.php +++ b/src/application/language/arabic/translations_lang.php @@ -232,7 +232,7 @@ $lang['filter'] = 'تنقية/فلترة'; $lang['clear'] = 'تنظيف'; $lang['uncategorized'] = 'غير مصنّف'; $lang['username_already_exists'] = 'اسم المستخدم موجود مسبقا'; -$lang['password_length_notice'] = 'حرف على الأقل $number اسم المستخدم يجب ان يكون'; +$lang['password_length_notice'] = 'حرف على الأقل $number اسم المستخدم يجب ان يكون'; $lang['general_settings'] = 'الاعدادات العامة'; $lang['personal_information'] = 'المعلومات الشخصية'; $lang['system_login'] = 'تسجيل الدخول الى النظام'; diff --git a/src/application/language/bulgarian/db_lang.php b/src/application/language/bulgarian/db_lang.php index b44bda95..b9da89b1 100644 --- a/src/application/language/bulgarian/db_lang.php +++ b/src/application/language/bulgarian/db_lang.php @@ -26,13 +26,13 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link https://codeigniter.com - * @since Version 1.0.0 + * @package CodeIgniter + * @author EllisLab Dev Team + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @license http://opensource.org/licenses/MIT MIT License + * @link https://codeigniter.com + * @since Version 1.0.0 * @filesource */ defined('BASEPATH') OR exit('No direct script access allowed'); diff --git a/src/application/language/bulgarian/email_lang.php b/src/application/language/bulgarian/email_lang.php index 22dc0fa7..e104db52 100644 --- a/src/application/language/bulgarian/email_lang.php +++ b/src/application/language/bulgarian/email_lang.php @@ -26,13 +26,13 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link https://codeigniter.com - * @since Version 1.0.0 + * @package CodeIgniter + * @author EllisLab Dev Team + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @license http://opensource.org/licenses/MIT MIT License + * @link https://codeigniter.com + * @since Version 1.0.0 * @filesource */ defined('BASEPATH') OR exit('No direct script access allowed'); diff --git a/src/application/language/chinese/db_lang.php b/src/application/language/chinese/db_lang.php index 65a807a0..a549f6eb 100644 --- a/src/application/language/chinese/db_lang.php +++ b/src/application/language/chinese/db_lang.php @@ -1,7 +1,7 @@ _insert($admin); - } else + } + else { $admin['id'] = $this->_update($admin); } diff --git a/src/application/models/Appointments_model.php b/src/application/models/Appointments_model.php index 681eacea..38f99566 100644 --- a/src/application/models/Appointments_model.php +++ b/src/application/models/Appointments_model.php @@ -37,7 +37,8 @@ class Appointments_Model extends CI_Model { if ( ! isset($appointment['id'])) { $appointment['id'] = $this->_insert($appointment); - } else + } + else { $this->_update($appointment); } @@ -338,7 +339,7 @@ class Appointments_Model extends CI_Model { * * @return array Returns the rows from the database. */ - public function get_batch($where_clause = '', $aggregates = false) + public function get_batch($where_clause = '', $aggregates = FALSE) { if ($where_clause != '') { @@ -347,8 +348,10 @@ class Appointments_Model extends CI_Model { $appointments = $this->db->get('ea_appointments')->result_array(); - if ($aggregates) { - foreach($appointments as &$appointment) { + if ($aggregates) + { + foreach ($appointments as &$appointment) + { $appointment = $this->get_aggregates($appointment); } } @@ -409,7 +412,8 @@ class Appointments_Model extends CI_Model { $this->db->insert('ea_appointments', $unavailable); $unavailable['id'] = $this->db->insert_id(); - } else + } + else { $this->db->where(['id' => $unavailable['id']]); $this->db->update('ea_appointments', $unavailable); @@ -490,8 +494,9 @@ class Appointments_Model extends CI_Model { * * @return int Returns the number of attendants for selected time period. */ - public function get_attendants_number_for_period(DateTime $slot_start, DateTime $slot_end, $service_id) { - return(int)$this->db + public function get_attendants_number_for_period(DateTime $slot_start, DateTime $slot_end, $service_id) + { + return (int)$this->db ->select('count(*) AS attendants_number') ->from('ea_appointments') ->group_start() @@ -515,10 +520,14 @@ class Appointments_Model extends CI_Model { * * @return array Returns the appointment with the aggregates. */ - private function get_aggregates(array $appointment) { - $appointment['service'] = $this->db->get_where('ea_services', ['id' => $appointment['id_services']])->row_array(); - $appointment['provider'] = $this->db->get_where('ea_users', ['id' => $appointment['id_users_provider']])->row_array(); - $appointment['customer'] = $this->db->get_where('ea_users', ['id' => $appointment['id_users_customer']])->row_array(); + private function get_aggregates(array $appointment) + { + $appointment['service'] = $this->db->get_where('ea_services', + ['id' => $appointment['id_services']])->row_array(); + $appointment['provider'] = $this->db->get_where('ea_users', + ['id' => $appointment['id_users_provider']])->row_array(); + $appointment['customer'] = $this->db->get_where('ea_users', + ['id' => $appointment['id_users_customer']])->row_array(); return $appointment; } } diff --git a/src/application/models/Customers_model.php b/src/application/models/Customers_model.php index 3fc7bd04..b44dff5e 100644 --- a/src/application/models/Customers_model.php +++ b/src/application/models/Customers_model.php @@ -44,7 +44,8 @@ class Customers_Model extends CI_Model { if ( ! isset($customer['id'])) { $customer['id'] = $this->_insert($customer); - } else + } + else { $this->_update($customer); } diff --git a/src/application/models/Providers_model.php b/src/application/models/Providers_model.php index 1faba681..9697978e 100644 --- a/src/application/models/Providers_model.php +++ b/src/application/models/Providers_model.php @@ -68,7 +68,8 @@ class Providers_Model extends CI_Model { if ( ! isset($provider['id'])) { $provider['id'] = $this->_insert($provider); - } else + } + else { $provider['id'] = $this->_update($provider); } @@ -256,7 +257,8 @@ class Providers_Model extends CI_Model { if ( ! isset($provider['services']) || ! is_array($provider['services'])) { throw new Exception('Invalid provider services given: ' . print_r($provider, TRUE)); - } else + } + else { // Check if services are valid int values. foreach ($provider['services'] as $service_id) { diff --git a/src/application/models/Secretaries_model.php b/src/application/models/Secretaries_model.php index 6e598f08..eb29b235 100644 --- a/src/application/models/Secretaries_model.php +++ b/src/application/models/Secretaries_model.php @@ -56,7 +56,8 @@ class Secretaries_Model extends CI_Model { if ( ! isset($secretary['id'])) { $secretary['id'] = $this->_insert($secretary); - } else + } + else { $secretary['id'] = $this->_update($secretary); } diff --git a/src/application/models/Services_model.php b/src/application/models/Services_model.php index 6ae51393..6af1b79c 100644 --- a/src/application/models/Services_model.php +++ b/src/application/models/Services_model.php @@ -31,7 +31,8 @@ class Services_Model extends CI_Model { if ( ! isset($service['id'])) { $service['id'] = $this->_insert($service); - } else + } + else { $this->_update($service); } @@ -359,7 +360,8 @@ class Services_Model extends CI_Model { { $this->db->insert('ea_service_categories', $category); $category['id'] = $this->db->insert_id(); - } else + } + else { $this->db->where('id', $category['id']); $this->db->update('ea_service_categories', $category); diff --git a/src/application/models/Settings_model.php b/src/application/models/Settings_model.php index 17e8d56e..50de4090 100644 --- a/src/application/models/Settings_model.php +++ b/src/application/models/Settings_model.php @@ -75,7 +75,8 @@ class Settings_Model extends CI_Model { throw new Exception('Could not update database setting.'); } $setting_id = (int)$this->db->get_where('ea_settings', ['name' => $name])->row()->id; - } else + } + else { // Insert setting $insert_data = [ diff --git a/src/assets/css/general.css b/src/assets/css/general.css index bd6b4f00..3867772d 100644 --- a/src/assets/css/general.css +++ b/src/assets/css/general.css @@ -9,8 +9,6 @@ * @since v1.0.0 * ---------------------------------------------------------------------------- */ - - @-moz-document url-prefix() { body .checkbox input[type="checkbox"] { float: left; diff --git a/src/assets/css/index.html b/src/assets/css/index.html index c942a79c..423d9d58 100644 --- a/src/assets/css/index.html +++ b/src/assets/css/index.html @@ -1,10 +1,10 @@ - 403 Forbidden + 403 Forbidden

Directory access is forbidden.

- \ No newline at end of file + diff --git a/src/assets/js/backend.js b/src/assets/js/backend.js index 5219f0b8..352c5b1a 100644 --- a/src/assets/js/backend.js +++ b/src/assets/js/backend.js @@ -11,34 +11,35 @@ window.Backend = window.Backend || {}; - /** - * Backend - * - * This module contains functions that are used in the backend section of the application. - * - * @module Backend - */ -(function(exports) { +/** + * Backend + * + * This module contains functions that are used in the backend section of the application. + * + * @module Backend + */ +(function (exports) { 'use strict'; /** * Main javascript code for the backend of Easy!Appointments. */ - $(document).ready(function() { - window.console = window.console || function() {}; // IE compatibility + $(document).ready(function () { + window.console = window.console || function () { + }; // IE compatibility $(window) - .on('resize', function() { + .on('resize', function () { Backend.placeFooterToBottom(); }) .trigger('resize'); - $(document).ajaxStart(function() { + $(document).ajaxStart(function () { $('#loading').show(); }); - $(document).ajaxStop(function() { + $(document).ajaxStop(function () { $('#loading').hide(); }); @@ -78,7 +79,7 @@ window.Backend = window.Backend || {}; /** * Place the backend footer always on the bottom of the page. */ - exports.placeFooterToBottom = function() { + exports.placeFooterToBottom = function () { var $footer = $('#footer'); if (window.innerHeight > $('body').height()) { @@ -104,35 +105,35 @@ window.Backend = window.Backend || {}; * @param {Array} actions An array with custom actions that will be available to the user. Every * array item is an object that contains the 'label' and 'function' key values. */ - exports.displayNotification = function(message, actions) { + exports.displayNotification = function (message, actions) { message = message || 'NO MESSAGE PROVIDED FOR THIS NOTIFICATION'; if (actions === undefined) { actions = []; - setTimeout(function() { + setTimeout(function () { $('#notification').fadeIn(); }, 5000); } var customActionsHtml = ''; - $.each(actions, function(index, action) { + $.each(actions, function (index, action) { var actionId = action.label.toLowerCase().replace(' ', '-'); customActionsHtml += ''; + + action.label + ''; $(document).off('click', '#' + actionId); $(document).on('click', '#' + actionId, action.function); }); var notificationHtml = - '
' + - '' + - '' + message + '' + - customActionsHtml + - '
'; + '
' + + '' + + '' + message + '' + + customActionsHtml + + '
'; $('#notification').html(notificationHtml); $('#notification').show('fade'); diff --git a/src/assets/js/backend_calendar.js b/src/assets/js/backend_calendar.js index 59935144..481fe921 100644 --- a/src/assets/js/backend_calendar.js +++ b/src/assets/js/backend_calendar.js @@ -18,7 +18,7 @@ */ window.BackendCalendar = window.BackendCalendar || {}; -(function(exports) { +(function (exports) { 'use strict'; @@ -26,16 +26,16 @@ window.BackendCalendar = window.BackendCalendar || {}; * Bind common event handlers. */ function _bindEventHandlers() { - var $calendarPage = $('#calendar-page'); + var $calendarPage = $('#calendar-page'); - $calendarPage.on('click', '#toggle-fullscreen', function() { + $calendarPage.on('click', '#toggle-fullscreen', function () { var $target = $(this); - var element = document.documentElement; + var element = document.documentElement; var isFullScreen = (document.fullScreenElement && document.fullScreenElement !== null) || document.mozFullScreen || document.webkitIsFullScreen; - - if (isFullScreen) { + + if (isFullScreen) { // Exit fullscreen mode. if (document.exitFullscreen) document.exitFullscreen(); @@ -49,7 +49,7 @@ window.BackendCalendar = window.BackendCalendar || {}; $target .removeClass('btn-success') .addClass('btn-default'); - + } else { // Switch to fullscreen mode. if (element.requestFullscreen) @@ -76,10 +76,10 @@ window.BackendCalendar = window.BackendCalendar || {}; * * @param {String} view Optional (default), the calendar view to be loaded. */ - exports.initialize = function(view) { + exports.initialize = function (view) { // Load and initialize the calendar view. if (view === 'table') { - BackendCalendarTableView.initialize(); + BackendCalendarTableView.initialize(); } else { BackendCalendarDefaultView.initialize(); } diff --git a/src/assets/js/backend_calendar_api.js b/src/assets/js/backend_calendar_api.js index be5a2c4b..6c5f81ab 100644 --- a/src/assets/js/backend_calendar_api.js +++ b/src/assets/js/backend_calendar_api.js @@ -18,9 +18,9 @@ */ window.BackendCalendarApi = window.BackendCalendarApi || {}; -(function(exports) { +(function (exports) { - 'use strict'; + 'use strict'; /** * Save Appointment @@ -33,7 +33,7 @@ window.BackendCalendarApi = window.BackendCalendarApi || {}; * @param {Function} successCallback Optional, if defined, this function is going to be executed on post success. * @param {Function} errorCallback Optional, if defined, this function is going to be executed on post failure. */ - exports.saveAppointment = function(appointment, customer, successCallback, errorCallback) { + exports.saveAppointment = function (appointment, customer, successCallback, errorCallback) { var url = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_appointment'; var data = { csrfToken: GlobalVariables.csrfToken, @@ -50,12 +50,12 @@ window.BackendCalendarApi = window.BackendCalendarApi || {}; data: data, dataType: 'json' }) - .done(function(response) { + .done(function (response) { if (successCallback !== undefined) { successCallback(response); } }) - .fail(function(jqXHR, textStatus, errorThrown) { + .fail(function (jqXHR, textStatus, errorThrown) { if (errorCallback !== undefined) { errorCallback(); } @@ -69,7 +69,7 @@ window.BackendCalendarApi = window.BackendCalendarApi || {}; * @param {Function} successCallback The ajax success callback function. * @param {Function} errorCallback The ajax failure callback function. */ - exports.saveUnavailable = function(unavailable, successCallback, errorCallback) { + exports.saveUnavailable = function (unavailable, successCallback, errorCallback) { var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_unavailable'; var postData = { csrfToken: GlobalVariables.csrfToken, diff --git a/src/assets/js/backend_calendar_appointments_modal.js b/src/assets/js/backend_calendar_appointments_modal.js index 6e419f92..01a67606 100644 --- a/src/assets/js/backend_calendar_appointments_modal.js +++ b/src/assets/js/backend_calendar_appointments_modal.js @@ -18,7 +18,7 @@ */ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModal || {}; -(function(exports) { +(function (exports) { 'use strict'; @@ -28,7 +28,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa * * Closes the dialog without saving any changes to the database. */ - $('#manage-appointment #cancel-appointment').click(function() { + $('#manage-appointment #cancel-appointment').click(function () { $('#manage-appointment').modal('hide'); }); @@ -37,7 +37,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa * * Stores the appointment changes or inserts a new appointment depending the dialog mode. */ - $('#manage-appointment #save-appointment').click(function() { + $('#manage-appointment #save-appointment').click(function () { // Before doing anything the appointment data need to be validated. if (!_validateAppointmentForm()) { return; @@ -84,7 +84,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa } // Define success callback. - var successCallback = function(response) { + var successCallback = function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { $dialog.find('.modal-message').text(EALang.unexpected_issues_occurred); $dialog.find('.modal-message').addClass('alert-danger').removeClass('hidden'); @@ -97,7 +97,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa $dialog.find('.modal-body').scrollTop(0); // Close the modal dialog and refresh the calendar appointments after one second. - setTimeout(function() { + setTimeout(function () { $dialog.find('.alert').addClass('hidden'); $dialog.modal('hide'); $('#select-filter-item').trigger('change'); @@ -105,7 +105,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa }; // Define error callback. - var errorCallback = function() { + var errorCallback = function () { $dialog.find('.modal-message').text(EALang.server_communication_error); $dialog.find('.modal-message').addClass('alert-danger').removeClass('hidden'); $dialog.find('.modal-body').scrollTop(0); @@ -121,16 +121,16 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa * When the user presses this button, the manage appointment dialog opens and lets the user to * create a new appointment. */ - $('#insert-appointment').click(function() { + $('#insert-appointment').click(function () { BackendCalendarAppointmentsModal.resetAppointmentDialog(); var $dialog = $('#manage-appointment'); // Set the selected filter item and find the next appointment time as the default modal values. if ($('#select-filter-item option:selected').attr('type') == 'provider') { var $providerOption = $dialog.find('#select-provider option[value="' - + $('#select-filter-item').val() + '"]'); + + $('#select-filter-item').val() + '"]'); if ($providerOption.length === 0) { // Change the services until you find the correct. - $.each($dialog.find('#select-service option'), function() { + $.each($dialog.find('#select-service option'), function () { $(this).prop('selected', true).parent().change(); if ($providerOption.length > 0) return false; @@ -139,11 +139,11 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa $providerOption.prop('selected', true); } else { $dialog.find('#select-service option[value="' - + $('#select-filter-item').val() + '"]').prop('selected', true); + + $('#select-filter-item').val() + '"]').prop('selected', true); } var serviceDuration = 0; - $.each(GlobalVariables.availableServices, function(index, service) { + $.each(GlobalVariables.availableServices, function (index, service) { if (service.id == $dialog.find('#select-service').val()) { serviceDuration = service.duration; return false; // exit loop @@ -154,18 +154,18 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa var currentMin = parseInt(start.toString('mm')); if (currentMin > 0 && currentMin < 15) { - start.set({ 'minute': 15 }); + start.set({'minute': 15}); } else if (currentMin > 15 && currentMin < 30) { - start.set({ 'minute': 30 }); + start.set({'minute': 30}); } else if (currentMin > 30 && currentMin < 45) { - start.set({ 'minute': 45 }); + start.set({'minute': 45}); } else { - start.addHours(1).set({ 'minute': 0 }); + start.addHours(1).set({'minute': 0}); } $dialog.find('#start-datetime').val(GeneralFunctions.formatDate(start, GlobalVariables.dateFormat, true)); $dialog.find('#end-datetime').val(GeneralFunctions.formatDate(start.addMinutes(serviceDuration), - GlobalVariables.dateFormat, true)); + GlobalVariables.dateFormat, true)); // Display modal form. $dialog.find('.modal-header h3').text(EALang.new_appointment_title); @@ -175,7 +175,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa /** * Event: Pick Existing Customer Button "Click" */ - $('#select-customer').click(function() { + $('#select-customer').click(function () { var $list = $('#existing-customers-list'); if (!$list.is(':visible')) { @@ -184,9 +184,9 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa $list.slideDown('slow'); $('#filter-existing-customers').fadeIn('slow'); $('#filter-existing-customers').val(''); - $.each(GlobalVariables.customers, function(index, c) { + $.each(GlobalVariables.customers, function (index, c) { $list.append('
' - + c.first_name + ' ' + c.last_name + '
'); + + c.first_name + ' ' + c.last_name + ''); }); } else { $list.slideUp('slow'); @@ -198,10 +198,10 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa /** * Event: Select Existing Customer From List "Click" */ - $('#manage-appointment').on('click', '#existing-customers-list div', function() { + $('#manage-appointment').on('click', '#existing-customers-list div', function () { var id = $(this).attr('data-id'); - $.each(GlobalVariables.customers, function(index, c) { + $.each(GlobalVariables.customers, function (index, c) { if (c.id == id) { $('#customer-id').val(c.id); $('#first-name').val(c.first_name); @@ -222,7 +222,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa /** * Event: Filter Existing Customers "Change" */ - $('#filter-existing-customers').keyup(function() { + $('#filter-existing-customers').keyup(function () { var key = $(this).val().toLowerCase(); var $list = $('#existing-customers-list'); var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_customers'; @@ -239,36 +239,38 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa dataType: 'json', timeout: 1000, global: false, - success: function(response) { + success: function (response) { $list.empty(); - $.each(response, function(index, c) { + $.each(response, function (index, c) { $list.append('
' - + c.first_name + ' ' + c.last_name + '
'); + + c.first_name + ' ' + c.last_name + ''); // Verify if this customer is on the old customer list. var result = $.grep(GlobalVariables.customers, - function(e){ return e.id == c.id; }); + function (e) { + return e.id == c.id; + }); // Add it to the customer list. - if(result.length == 0){ + if (result.length == 0) { GlobalVariables.customers.push(c); } }); }, - error: function(jqXHR, textStatus, errorThrown) { + error: function (jqXHR, textStatus, errorThrown) { // If there is any error on the request, search by the local client database. $list.empty(); - $.each(GlobalVariables.customers, function(index, c) { + $.each(GlobalVariables.customers, function (index, c) { if (c.first_name.toLowerCase().indexOf(key) != -1 - || c.last_name.toLowerCase().indexOf(key) != -1 - || c.email.toLowerCase().indexOf(key) != -1 - || c.phone_number.toLowerCase().indexOf(key) != -1 - || c.address.toLowerCase().indexOf(key) != -1 - || c.city.toLowerCase().indexOf(key) != -1 - || c.zip_code.toLowerCase().indexOf(key) != -1 - || c.notes.toLowerCase().indexOf(key) != -1) { + || c.last_name.toLowerCase().indexOf(key) != -1 + || c.email.toLowerCase().indexOf(key) != -1 + || c.phone_number.toLowerCase().indexOf(key) != -1 + || c.address.toLowerCase().indexOf(key) != -1 + || c.city.toLowerCase().indexOf(key) != -1 + || c.zip_code.toLowerCase().indexOf(key) != -1 + || c.notes.toLowerCase().indexOf(key) != -1) { $list.append('
' - + c.first_name + ' ' + c.last_name + '
'); + + c.first_name + ' ' + c.last_name + ''); } }); } @@ -281,12 +283,12 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa * When the user clicks on a service, its available providers should become visible. Also we need to * update the start and end time of the appointment. */ - $('#select-service').change(function() { + $('#select-service').change(function () { var sid = $('#select-service').val(); $('#select-provider').empty(); // Automatically update the service duration. - $.each(GlobalVariables.availableServices, function(indexService, service) { + $.each(GlobalVariables.availableServices, function (indexService, service) { if (service.id == sid) { var start = $('#start-datetime').datetimepicker('getDate'); $('#end-datetime').datetimepicker('setDate', new Date(start.getTime() + service.duration * 60000)); @@ -295,13 +297,13 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa }); // Update the providers select box. - $.each(GlobalVariables.availableProviders, function(indexProvider, provider) { - $.each(provider.services, function(indexService, serviceId) { + $.each(GlobalVariables.availableProviders, function (indexProvider, provider) { + $.each(provider.services, function (indexService, serviceId) { // If the current provider is able to provide the selected service, add him to the listbox. if (serviceId == sid) { var optionHtml = ''; + + provider.first_name + ' ' + provider.last_name + + ''; $('#select-provider').append(optionHtml); } }); @@ -311,9 +313,9 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa /** * Event: Enter New Customer Button "Click" */ - $('#new-customer').click(function() { + $('#new-customer').click(function () { $('#manage-appointment').find('#customer-id, #first-name, #last-name, #email, ' - + '#phone-number, #address, #city, #zip-code, #customer-notes').val(''); + + '#phone-number, #address, #city, #zip-code, #customer-notes').val(''); }); } @@ -323,7 +325,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa * This method resets the manage appointment dialog modal to its initial state. After that you can make * any modification might be necessary in order to bring the dialog to the desired state. */ - exports.resetAppointmentDialog = function() { + exports.resetAppointmentDialog = function () { var $dialog = $('#manage-appointment'); // Empty form fields. @@ -332,15 +334,15 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa // Prepare service and provider select boxes. $dialog.find('#select-service').val( - $dialog.find('#select-service').eq(0).attr('value')); + $dialog.find('#select-service').eq(0).attr('value')); // Fill the providers listbox with providers that can serve the appointment's // service and then select the user's provider. $dialog.find('#select-provider').empty(); - $.each(GlobalVariables.availableProviders, function(index, provider) { + $.each(GlobalVariables.availableProviders, function (index, provider) { var canProvideService = false; - $.each(provider.services, function(index, serviceId) { + $.each(provider.services, function (index, serviceId) { if (serviceId == $dialog.find('#select-service').val()) { canProvideService = true; return false; @@ -349,7 +351,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa if (canProvideService) { // Add the provider to the listbox. var option = new Option(provider.first_name - + ' ' + provider.last_name, provider.id); + + ' ' + provider.last_name, provider.id); $dialog.find('#select-provider').append(option); } }); @@ -362,7 +364,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa // Setup start and datetimepickers. // Get the selected service duration. It will be needed in order to calculate the appointment end datetime. var serviceDuration = 0; - $.each(GlobalVariables.availableServices, function(index, service) { + $.each(GlobalVariables.availableServices, function (index, service) { if (service.id == $dialog.find('#select-service').val()) { serviceDuration = service.duration; return false; @@ -370,10 +372,10 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa }); var startDatetime = new Date().addMinutes(GlobalVariables.bookAdvanceTimeout); - var endDatetime = new Date().addMinutes(GlobalVariables.bookAdvanceTimeout).addMinutes(serviceDuration); + var endDatetime = new Date().addMinutes(GlobalVariables.bookAdvanceTimeout).addMinutes(serviceDuration); var dateFormat; - switch(GlobalVariables.dateFormat) { + switch (GlobalVariables.dateFormat) { case 'DMY': dateFormat = 'dd/mm/yy'; break; @@ -393,18 +395,18 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa // Translation dayNames: [EALang.sunday, EALang.monday, EALang.tuesday, EALang.wednesday, - EALang.thursday, EALang.friday, EALang.saturday], - dayNamesShort: [EALang.sunday.substr(0,3), EALang.monday.substr(0,3), - EALang.tuesday.substr(0,3), EALang.wednesday.substr(0,3), - EALang.thursday.substr(0,3), EALang.friday.substr(0,3), - EALang.saturday.substr(0,3)], - dayNamesMin: [EALang.sunday.substr(0,2), EALang.monday.substr(0,2), - EALang.tuesday.substr(0,2), EALang.wednesday.substr(0,2), - EALang.thursday.substr(0,2), EALang.friday.substr(0,2), - EALang.saturday.substr(0,2)], + EALang.thursday, EALang.friday, EALang.saturday], + dayNamesShort: [EALang.sunday.substr(0, 3), EALang.monday.substr(0, 3), + EALang.tuesday.substr(0, 3), EALang.wednesday.substr(0, 3), + EALang.thursday.substr(0, 3), EALang.friday.substr(0, 3), + EALang.saturday.substr(0, 3)], + dayNamesMin: [EALang.sunday.substr(0, 2), EALang.monday.substr(0, 2), + EALang.tuesday.substr(0, 2), EALang.wednesday.substr(0, 2), + EALang.thursday.substr(0, 2), EALang.friday.substr(0, 2), + EALang.saturday.substr(0, 2)], monthNames: [EALang.january, EALang.february, EALang.march, EALang.april, - EALang.may, EALang.june, EALang.july, EALang.august, EALang.september, - EALang.october, EALang.november, EALang.december], + EALang.may, EALang.june, EALang.july, EALang.august, EALang.september, + EALang.october, EALang.november, EALang.december], prevText: EALang.previous, nextText: EALang.next, currentText: EALang.now, @@ -423,18 +425,18 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa // Translation dayNames: [EALang.sunday, EALang.monday, EALang.tuesday, EALang.wednesday, - EALang.thursday, EALang.friday, EALang.saturday], - dayNamesShort: [EALang.sunday.substr(0,3), EALang.monday.substr(0,3), - EALang.tuesday.substr(0,3), EALang.wednesday.substr(0,3), - EALang.thursday.substr(0,3), EALang.friday.substr(0,3), - EALang.saturday.substr(0,3)], - dayNamesMin: [EALang.sunday.substr(0,2), EALang.monday.substr(0,2), - EALang.tuesday.substr(0,2), EALang.wednesday.substr(0,2), - EALang.thursday.substr(0,2), EALang.friday.substr(0,2), - EALang.saturday.substr(0,2)], + EALang.thursday, EALang.friday, EALang.saturday], + dayNamesShort: [EALang.sunday.substr(0, 3), EALang.monday.substr(0, 3), + EALang.tuesday.substr(0, 3), EALang.wednesday.substr(0, 3), + EALang.thursday.substr(0, 3), EALang.friday.substr(0, 3), + EALang.saturday.substr(0, 3)], + dayNamesMin: [EALang.sunday.substr(0, 2), EALang.monday.substr(0, 2), + EALang.tuesday.substr(0, 2), EALang.wednesday.substr(0, 2), + EALang.thursday.substr(0, 2), EALang.friday.substr(0, 2), + EALang.saturday.substr(0, 2)], monthNames: [EALang.january, EALang.february, EALang.march, EALang.april, - EALang.may, EALang.june, EALang.july, EALang.august, EALang.september, - EALang.october, EALang.november, EALang.december], + EALang.may, EALang.june, EALang.july, EALang.august, EALang.september, + EALang.october, EALang.november, EALang.december], prevText: EALang.previous, nextText: EALang.next, currentText: EALang.now, @@ -465,7 +467,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa // Check required fields. var missingRequiredField = false; - $dialog.find('.required').each(function() { + $dialog.find('.required').each(function () { if ($(this).val() == '' || $(this).val() == null) { $(this).closest('.form-group').addClass('has-error'); missingRequiredField = true; @@ -491,13 +493,13 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa } return true; - } catch(exc) { + } catch (exc) { $dialog.find('.modal-message').addClass('alert-danger').text(exc).removeClass('hidden'); return false; } } - exports.initialize = function() { + exports.initialize = function () { _bindEventHandlers(); }; diff --git a/src/assets/js/backend_calendar_default_view.js b/src/assets/js/backend_calendar_default_view.js index f9a0e837..4b5f02d7 100644 --- a/src/assets/js/backend_calendar_default_view.js +++ b/src/assets/js/backend_calendar_default_view.js @@ -473,7 +473,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {}; // Display success notification to user. var undoFunction = function () { - unavailable.end_datetime = event.data.end_datetime = Date.parseExact( + unavailable.end_datetime = event.data.end_datetime = Date.parseExact( unavailable.end_datetime, 'yyyy-MM-dd HH:mm:ss') .add({minutes: -delta.minutes()}) .toString('yyyy-MM-dd HH:mm:ss'); @@ -1069,7 +1069,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {}; firstDay: 0, snapDuration: '00:30:00', timeFormat: 'h:mm A', - slotLabelFormat : 'h(:mm) A', + slotLabelFormat: 'h(:mm) A', allDayText: EALang.all_day, columnFormat: columnFormat, titleFormat: 'MMMM YYYY', @@ -1082,7 +1082,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {}; // Selectable selectable: true, selectHelper: true, - select: function(start, end, jsEvent, view) { + select: function (start, end, jsEvent, view) { if (!start.hasTime() || !end.hasTime()) { return; } diff --git a/src/assets/js/backend_calendar_google_sync.js b/src/assets/js/backend_calendar_google_sync.js index f8a5ab9d..21e48735 100644 --- a/src/assets/js/backend_calendar_google_sync.js +++ b/src/assets/js/backend_calendar_google_sync.js @@ -12,18 +12,18 @@ /** * Backend Calendar Google Sync * - * This module implements the Google Calendar sync operations. + * This module implements the Google Calendar sync operations. * * @module BackendCalendarGoogleSync */ window.BackendCalendarGoogleSync = window.BackendCalendarGoogleSync || {}; -(function(exports) { +(function (exports) { 'use strict'; /** - * Bind event handlers. + * Bind event handlers. */ function _bindEventHandlers() { /** @@ -32,57 +32,57 @@ window.BackendCalendarGoogleSync = window.BackendCalendarGoogleSync || {}; * When the user clicks on the "Enable Sync" button, a popup should appear * that is going to follow the web server authorization flow of OAuth. */ - $('#enable-sync').click(function() { + $('#enable-sync').click(function () { if ($('#enable-sync').hasClass('enabled') === false) { // Enable synchronization for selected provider. var authUrl = GlobalVariables.baseUrl + '/index.php/google/oauth/' - + $('#select-filter-item').val(); + + $('#select-filter-item').val(); var redirectUrl = GlobalVariables.baseUrl + '/index.php/google/oauth_callback'; var windowHandle = window.open(authUrl, 'Authorize Easy!Appointments', - 'width=800, height=600'); + 'width=800, height=600'); - var authInterval = window.setInterval(function() { + var authInterval = window.setInterval(function () { // When the browser redirects to the google user consent page the "window.document" variable // becomes "undefined" and when it comes back to the redirect URL it changes back. So check // whether the variable is undefined to avoid javascript errors. try { if (windowHandle.document !== undefined) { - if (windowHandle.document.URL.indexOf(redirectUrl) !== -1) { - // The user has granted access to his data. - windowHandle.close(); - window.clearInterval(authInterval); - $('#enable-sync').addClass('btn-danger enabled'); - $('#enable-sync span:eq(1)').text(EALang.disable_sync); - $('#google-sync').prop('disabled', false); - $('#select-filter-item option:selected').attr('google-sync', 'true'); + if (windowHandle.document.URL.indexOf(redirectUrl) !== -1) { + // The user has granted access to his data. + windowHandle.close(); + window.clearInterval(authInterval); + $('#enable-sync').addClass('btn-danger enabled'); + $('#enable-sync span:eq(1)').text(EALang.disable_sync); + $('#google-sync').prop('disabled', false); + $('#select-filter-item option:selected').attr('google-sync', 'true'); - // Display the calendar selection dialog. First we will get a list of the available - // user's calendars and then we will display a selection modal so the user can select - // the sync calendar. - var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_get_google_calendars'; - var postData = { - csrfToken: GlobalVariables.csrfToken, - provider_id: $('#select-filter-item').val() - }; + // Display the calendar selection dialog. First we will get a list of the available + // user's calendars and then we will display a selection modal so the user can select + // the sync calendar. + var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_get_google_calendars'; + var postData = { + csrfToken: GlobalVariables.csrfToken, + provider_id: $('#select-filter-item').val() + }; - $.post(postUrl, postData, function(response) { - if (!GeneralFunctions.handleAjaxExceptions(response)) { - return; - } + $.post(postUrl, postData, function (response) { + if (!GeneralFunctions.handleAjaxExceptions(response)) { + return; + } - $('#google-calendar').empty(); - $.each(response, function() { - var option = ''; - $('#google-calendar').append(option); - }); + $('#google-calendar').empty(); + $.each(response, function () { + var option = ''; + $('#google-calendar').append(option); + }); - $('#select-google-calendar').modal('show'); - }, 'json').fail(GeneralFunctions.ajaxFailureHandler); + $('#select-google-calendar').modal('show'); + }, 'json').fail(GeneralFunctions.ajaxFailureHandler); + } } - } - } catch(Error) { + } catch (Error) { // Accessing the document object before the window is loaded throws an error, but // it will only happen during the initialization of the window. Attaching "load" // event handling is not possible due to CORS restrictions. @@ -93,7 +93,7 @@ window.BackendCalendarGoogleSync = window.BackendCalendarGoogleSync || {}; // Disable synchronization for selected provider. // Update page elements and make an AJAX call to remove the google sync setting of the // selected provider. - $.each(GlobalVariables.availableProviders, function(index, provider) { + $.each(GlobalVariables.availableProviders, function (index, provider) { if (provider.id == $('#select-filter-item').val()) { provider.settings.google_sync = '0'; provider.settings.google_token = null; @@ -114,14 +114,14 @@ window.BackendCalendarGoogleSync = window.BackendCalendarGoogleSync || {}; /** * Event: Select Google Calendar "Click" */ - $('#select-calendar').click(function() { + $('#select-calendar').click(function () { var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_select_google_calendar'; var postData = { csrfToken: GlobalVariables.csrfToken, provider_id: $('#select-filter-item').val(), calendar_id: $('#google-calendar').val() }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -133,7 +133,7 @@ window.BackendCalendarGoogleSync = window.BackendCalendarGoogleSync || {}; /** * Event: Close Google Calendar "Click" */ - $('#close-calendar').click(function() { + $('#close-calendar').click(function () { $('#select-google-calendar').modal('hide'); }); @@ -142,7 +142,7 @@ window.BackendCalendarGoogleSync = window.BackendCalendarGoogleSync || {}; * * Trigger the synchronization algorithm. */ - $('#google-sync').click(function() { + $('#google-sync').click(function () { var url = GlobalVariables.baseUrl + '/index.php/google/sync/' + $('#select-filter-item').val(); $.ajax({ @@ -150,11 +150,11 @@ window.BackendCalendarGoogleSync = window.BackendCalendarGoogleSync || {}; type: 'GET', dataType: 'json' }) - .done(function(response) { + .done(function (response) { if (response.exceptions) { response.exceptions = GeneralFunctions.parseExceptions(response.exceptions); GeneralFunctions.displayMessageBox(GeneralFunctions.EXCEPTIONS_TITLE, - GeneralFunctions.EXCEPTIONS_MESSAGE); + GeneralFunctions.EXCEPTIONS_MESSAGE); $('#message_box').append(GeneralFunctions.exceptionsToHtml(response.exceptions)); return; } @@ -162,14 +162,14 @@ window.BackendCalendarGoogleSync = window.BackendCalendarGoogleSync || {}; if (response.warnings) { response.warnings = GeneralFunctions.parseExceptions(response.warnings); GeneralFunctions.displayMessageBox(GeneralFunctions.WARNINGS_TITLE, - GeneralFunctions.WARNINGS_MESSAGE); + GeneralFunctions.WARNINGS_MESSAGE); $('#message_box').append(GeneralFunctions.exceptionsToHtml(response.warnings)); } Backend.displayNotification(EALang.google_sync_completed); $('#reload-appointments').trigger('click'); }) - .fail(function(jqXHR, textStatus, errorThrown) { + .fail(function (jqXHR, textStatus, errorThrown) { Backend.displayNotification(EALang.google_sync_failed); }); }); @@ -191,7 +191,7 @@ window.BackendCalendarGoogleSync = window.BackendCalendarGoogleSync || {}; provider_id: providerId }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (response.exceptions) { response.exceptions = GeneralFunctions.parseExceptions(response.exceptions); GeneralFunctions.displayMessageBox(GeneralFunctions.EXCEPTIONS_TITLE, GeneralFunctions.EXCEPTIONS_MESSAGE); @@ -201,8 +201,8 @@ window.BackendCalendarGoogleSync = window.BackendCalendarGoogleSync || {}; } - exports.initialize = function() { - _bindEventHandlers(); + exports.initialize = function () { + _bindEventHandlers(); }; })(window.BackendCalendarGoogleSync); diff --git a/src/assets/js/backend_calendar_table_view.js b/src/assets/js/backend_calendar_table_view.js index ea1ed90c..2b43eac7 100644 --- a/src/assets/js/backend_calendar_table_view.js +++ b/src/assets/js/backend_calendar_table_view.js @@ -18,85 +18,85 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; * * @module BackendCalendarTableView */ -(function(exports) { +(function (exports) { 'use strict'; /** - * Sticky Table Header Fix - * + * Sticky Table Header Fix + * * @type {Number} */ - var stickyTableHeaderInterval; + var stickyTableHeaderInterval; /** - * Bind page event handlers. + * Bind page event handlers. */ function _bindEventHandlers() { var $calendarToolbar = $('#calendar-toolbar'); - var $calendar = $('#calendar'); + var $calendar = $('#calendar'); - $calendar.on('click', '.calendar-header .btn.previous', function() { - var endDate = new Date($('#calendar .date-column:first').data('date')).add({days: -1}); + $calendar.on('click', '.calendar-header .btn.previous', function () { + var endDate = new Date($('#calendar .date-column:first').data('date')).add({days: -1}); var startDate = new Date(endDate.getTime()).add({days: -1 * (parseInt($('#select-filter-item').val()) - 1)}); $('.select-date').datepicker('setDate', startDate); _createView(startDate, endDate); }); - $calendar.on('click', '.calendar-header .btn.next', function() { - var startDate = new Date($('#calendar .date-column:last').data('date')).add({days: 1}); - var endDate = new Date(startDate.getTime()).add({days: parseInt($('#select-filter-item').val()) - 1}); + $calendar.on('click', '.calendar-header .btn.next', function () { + var startDate = new Date($('#calendar .date-column:last').data('date')).add({days: 1}); + var endDate = new Date(startDate.getTime()).add({days: parseInt($('#select-filter-item').val()) - 1}); $('.select-date').datepicker('setDate', startDate); _createView(startDate, endDate); }); - $calendarToolbar.on('change', '#select-filter-item', function() { - var startDate = new Date($('.calendar-view .date-column:first').data('date')); - var endDate = new Date(startDate.getTime()).add({days: parseInt($(this).val()) - 1}); + $calendarToolbar.on('change', '#select-filter-item', function () { + var startDate = new Date($('.calendar-view .date-column:first').data('date')); + var endDate = new Date(startDate.getTime()).add({days: parseInt($(this).val()) - 1}); _createView(startDate, endDate); // Horizontal scrolling fix for sticky table headers. - stickyTableHeaderInterval = setInterval(function() { + stickyTableHeaderInterval = setInterval(function () { $(window).trigger('resize.stickyTableHeaders'); }, 1000); }); - $calendarToolbar.on('click', '#reload-appointments', function() { + $calendarToolbar.on('click', '#reload-appointments', function () { // Remove all the events from the tables. - $('.calendar-view .event').remove(); + $('.calendar-view .event').remove(); // Fetch the events and place them in the existing HTML format. var startDate = new Date($('.calendar-view .date-column:first').data('date')); var endDate = new Date($('.calendar-view .date-column:last').data('date')); _getCalendarEvents(startDate, endDate) - .done(function(response) { + .done(function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } - var currentDate = startDate; + var currentDate = startDate; - while(currentDate <= endDate) { - $('.calendar-view .date-column').each(function(index, dateColumn) { - var $dateColumn = $(dateColumn); + while (currentDate <= endDate) { + $('.calendar-view .date-column').each(function (index, dateColumn) { + var $dateColumn = $(dateColumn); var date = new Date($dateColumn.data('date')); if (currentDate.getTime() !== date.getTime()) { return true; } - $(dateColumn).find('.provider-column').each(function(index, providerColumn) { + $(dateColumn).find('.provider-column').each(function (index, providerColumn) { var $providerColumn = $(providerColumn); var provider = $providerColumn.data('provider'); // Add the appointments to the column. - _createAppointments($providerColumn, response.appointments); - + _createAppointments($providerColumn, response.appointments); + // Add the unavailabilities to the column. - _createUnavailabilities($providerColumn, response.unavailabilities); + _createUnavailabilities($providerColumn, response.unavailabilities); // Add the provider breaks to the column. - var workingPlan = JSON.parse(provider.settings.working_plan); + var workingPlan = JSON.parse(provider.settings.working_plan); var day = date.toString('dddd').toLowerCase(); if (workingPlan[day]) { var breaks = workingPlan[day].breaks; @@ -105,22 +105,22 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; }); }); - currentDate.add({days: 1}); + currentDate.add({days: 1}); } _setCalendarSize(); Backend.placeFooterToBottom(); }) .fail(GeneralFunctions.ajaxFailureHandler); - }); - - $calendar.on('click', '.calendar-view table td', function() { + }); + + $calendar.on('click', '.calendar-view table td', function () { if ($(this).index() === 0) { return; // Clicked on an hour slot. } // Open the appointments modal in the selected hour. - var hour = $(this).parent().find('td:first').text().split(':'); + var hour = $(this).parent().find('td:first').text().split(':'); var date = new Date($(this).parents('.date-column').data('date')); date.set({hour: parseInt(hour[0]), minute: parseInt(hour[1])}); @@ -128,25 +128,25 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; $('#insert-appointment').trigger('click'); // Update start date field. - $('#start-datetime').datepicker('setDate', date); + $('#start-datetime').datepicker('setDate', date); // Select Service and provider. var $providerColumn = $(this).parents('.provider-column'); var serviceId = $providerColumn.find('thead tr:last th').eq($(this).index()).data('id'); - var providerId = $providerColumn.data('provider').id; + var providerId = $providerColumn.data('provider').id; $('#select-service').val(serviceId).trigger('change'); $('#select-provider').val(providerId).trigger('change'); - }); + }); var lastFocusedEventData; - + /** * Event: On Table Event Click - * + * * @param {jQuery.Event} event */ - $calendar.on('click', '.event', function(event) { - event.stopPropagation(); + $calendar.on('click', '.event', function (event) { + event.stopPropagation(); if ($(this).hasClass('break')) { return; // Do nothing with break events. @@ -155,61 +155,61 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; $('.popover').remove(); // Close all open popovers. var html; - var entry = $(this).data(); + var entry = $(this).data(); - if ($(this).hasClass('unavailability')) { + if ($(this).hasClass('unavailability')) { var notes = 'Notes ' + entry.notes; html = - '' + - '' + EALang.start + ' ' - + GeneralFunctions.formatDate(entry.start_datetime, GlobalVariables.dateFormat, true) - + '
' + - '' + EALang.end + ' ' - + GeneralFunctions.formatDate(entry.end_datetime, GlobalVariables.dateFormat, true) - + '
' - + notes - + '
' + - '
' + - '' + - '' + - '' + - '
'; + '' + + '' + EALang.start + ' ' + + GeneralFunctions.formatDate(entry.start_datetime, GlobalVariables.dateFormat, true) + + '
' + + '' + EALang.end + ' ' + + GeneralFunctions.formatDate(entry.end_datetime, GlobalVariables.dateFormat, true) + + '
' + + notes + + '
' + + '
' + + '' + + '' + + '' + + '
'; } else { html = - '' + - '' + EALang.start + ' ' - + GeneralFunctions.formatDate(entry.start_datetime, GlobalVariables.dateFormat, true) - + '
' + - '' + EALang.end + ' ' - + GeneralFunctions.formatDate(entry.end_datetime, GlobalVariables.dateFormat, true) - + '
' + - '' + EALang.service + ' ' - + entry.service.name - + '
' + - '' + EALang.provider + ' ' - + entry.provider.first_name + ' ' - + entry.provider.last_name - + '
' + - '' + EALang.customer + ' ' - + entry.customer.first_name + ' ' - + entry.customer.last_name - + '
' + - '
' + - '' + - '' + - '' + - '
'; + '' + + '' + EALang.start + ' ' + + GeneralFunctions.formatDate(entry.start_datetime, GlobalVariables.dateFormat, true) + + '
' + + '' + EALang.end + ' ' + + GeneralFunctions.formatDate(entry.end_datetime, GlobalVariables.dateFormat, true) + + '
' + + '' + EALang.service + ' ' + + entry.service.name + + '
' + + '' + EALang.provider + ' ' + + entry.provider.first_name + ' ' + + entry.provider.last_name + + '
' + + '' + EALang.customer + ' ' + + entry.customer.first_name + ' ' + + entry.customer.last_name + + '
' + + '
' + + '' + + '' + + '' + + '
'; } var title = entry.is_unavailable !== '0' ? EALang.unavailable : entry.service.name + ' - ' - + entry.customer.first_name + ' ' + entry.customer.last_name; + + entry.customer.first_name + ' ' + entry.customer.last_name; $(event.target).popover({ placement: 'top', @@ -225,7 +225,7 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; // Fix popover position if ($('.popover').length > 0 && $('.popover').position().top < 200) { - $('.popover').css('top', '200px'); + $('.popover').css('top', '200px'); } }); @@ -239,7 +239,7 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; * * Hides the open popover element. */ - $calendar.on('click', '.close-popover', function() { + $calendar.on('click', '.close-popover', function () { $(this).parents().eq(2).popover('destroy'); }); @@ -248,7 +248,7 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; * * Enables the edit dialog of the selected table event. */ - $calendar.on('click', '.edit-popover', function() { + $calendar.on('click', '.edit-popover', function () { $(this).parents().eq(2).popover('destroy'); // Hide the popover var $dialog; @@ -267,11 +267,11 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; // Set the start and end datetime of the appointment. var startDatetime = Date.parseExact(appointment.start_datetime, - 'yyyy-MM-dd HH:mm:ss'); + 'yyyy-MM-dd HH:mm:ss'); $dialog.find('#start-datetime').datetimepicker('setDate', startDatetime); var endDatetime = Date.parseExact(appointment.end_datetime, - 'yyyy-MM-dd HH:mm:ss'); + 'yyyy-MM-dd HH:mm:ss'); $dialog.find('#end-datetime').datetimepicker('setDate', endDatetime); var customer = appointment.customer; @@ -314,22 +314,22 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; * Displays a prompt on whether the user wants the appointment to be deleted. If he confirms the * deletion then an ajax call is made to the server and deletes the appointment from the database. */ - $calendar.on('click', '.delete-popover', function() { + $calendar.on('click', '.delete-popover', function () { $(this).parents().eq(2).popover('destroy'); // Hide the popover if (lastFocusedEventData.is_unavailable == false) { var buttons = [ { text: 'OK', - click: function() { + click: function () { var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_appointment'; var postData = { csrfToken: GlobalVariables.csrfToken, - appointment_id : lastFocusedEventData.id, + appointment_id: lastFocusedEventData.id, delete_reason: $('#delete-reason').val() }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { $('#message_box').dialog('close'); if (response.exceptions) { @@ -355,14 +355,14 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; { text: EALang.cancel, - click: function() { + click: function () { $('#message_box').dialog('close'); } } ]; GeneralFunctions.displayMessageBox(EALang.delete_appointment_title, - EALang.write_appointment_removal_reason, buttons); + EALang.write_appointment_removal_reason, buttons); var $formGroup = $('
', { 'class': 'form-group' @@ -379,10 +379,10 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; var url = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_unavailable'; var data = { csrfToken: GlobalVariables.csrfToken, - unavailable_id : lastFocusedEventData.id + unavailable_id: lastFocusedEventData.id }; - $.post(url, data, function(response) { + $.post(url, data, function (response) { $('#message_box').dialog('close'); if (response.exceptions) { @@ -406,35 +406,35 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; } /** - * Create table view header container. + * Create table view header container. * * The header contains the date navigation elements (buttons and datepicker). */ function _createHeader() { - var $calendarFilter = $('#calendar-filter'); + var $calendarFilter = $('#calendar-filter'); $calendarFilter .find('select') .empty() - .append(new Option('1 ' + EALang.day , 1)) + .append(new Option('1 ' + EALang.day, 1)) .append(new Option('3 ' + EALang.days, 3)); - - var $calendarHeader = $('
').appendTo('#calendar'); + + var $calendarHeader = $('
').appendTo('#calendar'); $calendarHeader .html( '' + '' + '' ); - var dateFormat; + var dateFormat; - switch(GlobalVariables.dateFormat) { + switch (GlobalVariables.dateFormat) { case 'DMY': dateFormat = 'dd/mm/yy'; break; @@ -449,28 +449,28 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; default: throw new Error('Invalid date format setting provided!', GlobalVariables.dateFormat); - } + } $calendarHeader.find('.select-date').datepicker({ defaultDate: new Date(), dateFormat: dateFormat, - onSelect: function(dateText, instance) { + onSelect: function (dateText, instance) { var startDate = new Date(instance.currentYear, instance.currentMonth, instance.currentDay); - var endDate = new Date(startDate.getTime()).add({days: parseInt($('#select-filter-item').val()) - 1}); + var endDate = new Date(startDate.getTime()).add({days: parseInt($('#select-filter-item').val()) - 1}); _createView(startDate, endDate); - } + } }); } /** - * Create table schedule view. + * Create table schedule view. + * + * This method will destroy any previous instances and create a new view for displaying the appointments in + * a table format. * - * This method will destroy any previous instances and create a new view for displaying the appointments in - * a table format. - * * @param {Date} startDate Start date to be displayed. - * @param {Date} endDate End date to be displayed. + * @param {Date} endDate End date to be displayed. */ function _createView(startDate, endDate) { // Disable date navigation. @@ -480,7 +480,7 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; $('#calendar .calendar-view').remove(); var displayDate = startDate.getTime() !== endDate.getTime(); - var $calendarView = $('
').appendTo('#calendar'); + var $calendarView = $('
').appendTo('#calendar'); $calendarView.data({ startDate: startDate.toString('yyyy-MM-dd'), @@ -490,16 +490,16 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; var $wrapper = $('
').appendTo($calendarView); _getCalendarEvents(startDate, endDate) - .done(function(response) { + .done(function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } - var currentDate = startDate; + var currentDate = startDate; - while(currentDate <= endDate) { - _createDateColumn($wrapper, currentDate, response, displayDate); - currentDate.add({days: 1}); + while (currentDate <= endDate) { + _createDateColumn($wrapper, currentDate, response, displayDate); + currentDate.add({days: 1}); } _setCalendarSize(); @@ -512,17 +512,17 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; } /** - * Create Date Column Container + * Create Date Column Container * - * This element will contain the provider columns. - * - * @param {jQuery} $wrapper The wrapper div element of the table view. + * This element will contain the provider columns. + * + * @param {jQuery} $wrapper The wrapper div element of the table view. * @param {Date} date Selected date for the column. - * @param {Object[]} events Events to be displayed on this date. - * @param {Boolean} displayDate Whether to display the date in the column container. + * @param {Object[]} events Events to be displayed on this date. + * @param {Boolean} displayDate Whether to display the date in the column container. */ function _createDateColumn($wrapper, date, events, displayDate) { - var $dateColumn = $('
').appendTo($wrapper); + var $dateColumn = $('
').appendTo($wrapper); $dateColumn.data('date', date.getTime()); @@ -535,7 +535,7 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; if (GlobalVariables.user.role_slug === 'provider') { GlobalVariables.availableProviders.forEach(function (provider) { if (provider.id == GlobalVariables.user.id) { - providers = [provider]; + providers = [provider]; } }); } @@ -550,39 +550,39 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; } for (var index in providers) { - var provider = GlobalVariables.availableProviders[index]; + var provider = GlobalVariables.availableProviders[index]; _createProviderColumn($dateColumn, date, provider, events); } } /** - * Create Provider Column Container - * + * Create Provider Column Container + * * @param {jQuery} $dateColumn Element to container the provider's column. * @param {Date} date Selected date for the column. - * @param {Object} provider Contains the provider data. - * {Object[]} events Events to be displayed on this date. + * @param {Object} provider Contains the provider data. + * {Object[]} events Events to be displayed on this date. */ function _createProviderColumn($dateColumn, date, provider, events) { if (provider.services.length === 0) { return; } - var $providerColumn = $('
').appendTo($dateColumn); + var $providerColumn = $('
').appendTo($dateColumn); - $providerColumn.data('provider', provider); + $providerColumn.data('provider', provider); // Create the table slots. - _createSlots($providerColumn, date, provider); + _createSlots($providerColumn, date, provider); // Add the appointments to the column. - _createAppointments($providerColumn, events.appointments); - + _createAppointments($providerColumn, events.appointments); + // Add the unavailabilities to the column. - _createUnavailabilities($providerColumn, events.unavailabilities); + _createUnavailabilities($providerColumn, events.unavailabilities); // Add the provider breaks to the column. - var workingPlan = JSON.parse(provider.settings.working_plan); + var workingPlan = JSON.parse(provider.settings.working_plan); var day = date.toString('dddd').toLowerCase(); if (workingPlan[day]) { var breaks = workingPlan[day].breaks; @@ -591,22 +591,22 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; } /** - * Create Table View Slots + * Create Table View Slots + * + * The time slots will be added to a specific provider's column. * - * The time slots will be added to a specific provider's column. - * * @param {jQuery} $providerColumn The selected provider column. * @param {Date} date Selected date for the slot. * @param {Object} provider Contains the provider data. */ function _createSlots($providerColumn, date, provider) { - var day = date.toString('dddd').toLowerCase(); - var plan = JSON.parse(provider.settings.working_plan)[day]; + var day = date.toString('dddd').toLowerCase(); + var plan = JSON.parse(provider.settings.working_plan)[day]; if (!plan) { - $providerColumn.append('
' - + (provider.first_name + ' ' + provider.last_name).trim() +'
' + EALang.not_working - + '
'); + $providerColumn.append('
' + + (provider.first_name + ' ' + provider.last_name).trim() + '
' + EALang.not_working + + '
'); return; } @@ -615,90 +615,90 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; .addClass('table table-condensed table-responsive table-hover table-striped') .html( '' + - '' + - '' + - (provider.first_name + ' ' + provider.last_name).trim() + - '' + - '' + - '' + - '' + EALang.time + '' + - '' + + '' + + '' + + (provider.first_name + ' ' + provider.last_name).trim() + + '' + + '' + + '' + + '' + EALang.time + '' + + '' + '' + '' ); for (var index in GlobalVariables.availableServices) { - var service = GlobalVariables.availableServices[index]; + var service = GlobalVariables.availableServices[index]; if (provider.services.indexOf(service.id) > -1) { - $table.find('thead tr:last').append('' + service.name + ''); + $table.find('thead tr:last').append('' + service.name + ''); } } - var start = parseInt(plan.start.split(':')[0]); + var start = parseInt(plan.start.split(':')[0]); var end = parseInt(plan.end.split(':')[0]) + 1; var current = start; - var $tbody = $table.find('tbody'); + var $tbody = $table.find('tbody'); - while(current <= end) { - var $tr = $('').appendTo($tbody); + while (current <= end) { + var $tr = $('').appendTo($tbody); - var time = (current < 10 ? '0' + parseInt(current) : parseInt(current)) + (current % 1 === 0 ? ':00' : ':30'); + var time = (current < 10 ? '0' + parseInt(current) : parseInt(current)) + (current % 1 === 0 ? ':00' : ':30'); $tr .append('' + time + '') - .append(''.repeat(provider.services.length)); + .append(''.repeat(provider.services.length)); - current += 0.5; + current += 0.5; } $table.stickyTableHeaders(); } /** - * Create Appointment Events + * Create Appointment Events + * + * This method will add the appointment events on the table view. * - * This method will add the appointment events on the table view. - * * @param {jQuery} $providerColumn The provider column container. - * @param {Object[]} appointments Contains the appointment events data. + * @param {Object[]} appointments Contains the appointment events data. */ function _createAppointments($providerColumn, appointments) { if (appointments.length === 0) { return; } - var currentDate = new Date($providerColumn.parents('.date-column').data('date')); + var currentDate = new Date($providerColumn.parents('.date-column').data('date')); var $tbody = $providerColumn.find('table tbody'); for (var index in appointments) { - var appointment = appointments[index]; + var appointment = appointments[index]; if (appointment.id_users_provider !== $providerColumn.data('provider').id) { continue; } - var eventDate = Date.parse(appointment.start_datetime); - var $event = $('
'); + var eventDate = Date.parse(appointment.start_datetime); + var $event = $('
'); var startDate = Date.parse(appointment.start_datetime); var endDate = Date.parse(appointment.end_datetime); var eventDuration = Math.round((endDate - startDate) / 60000); - $event.html( + $event.html( appointment.customer.first_name.charAt(0) + '. ' + appointment.customer.last_name + ' ' + startDate.toString('h:mm tt') + ' ' - + (eventDuration !== parseInt(appointment.service.duration) ? '(' + eventDuration + '\')' : '') + + (eventDuration !== parseInt(appointment.service.duration) ? '(' + eventDuration + '\')' : '') ); $event.data(appointment); - $tbody.find('tr').each(function(index, tr) { - var $td = $(tr).find('td:first'); + $tbody.find('tr').each(function (index, tr) { + var $td = $(tr).find('td:first'); var cellDate = new Date(currentDate.getTime()).set({ hour: parseInt($td.text().split(':')[0]), minute: parseInt($td.text().split(':')[1]) - }); + }); if (eventDate < cellDate) { var cellIndex = $providerColumn @@ -714,50 +714,50 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; return false; } - }); + }); } } /** - * Create Unavailabilities Events + * Create Unavailabilities Events + * + * This method will add the unavailability events on the table view. * - * This method will add the unavailability events on the table view. - * * @param {jQuery} $providerColumn The provider column container. - * @param {Object[]} unavailabilities Contains the unavailability events data. + * @param {Object[]} unavailabilities Contains the unavailability events data. */ function _createUnavailabilities($providerColumn, unavailabilities) { if (unavailabilities.length === 0) { return; } - var currentDate = new Date($providerColumn.parents('.date-column').data('date')); + var currentDate = new Date($providerColumn.parents('.date-column').data('date')); var $tbody = $providerColumn.find('table tbody'); for (var index in unavailabilities) { - var unavailability = unavailabilities[index]; + var unavailability = unavailabilities[index]; if (unavailability.id_users_provider !== $providerColumn.data('provider').id) { continue; } - var eventDate = Date.parse(unavailability.start_datetime); + var eventDate = Date.parse(unavailability.start_datetime); var endDate = Date.parse(unavailability.end_datetime); var eventDuration = Math.round((endDate - eventDate) / 60000); - var $event = $('
'); + var $event = $('
'); $event.html((unavailability.notes || EALang.unavailable) + ' ' + eventDate.toString('h:mm tt') + ' (' + eventDuration + '\')'); $event.data(unavailability); - $tbody.find('tr').each(function(index, tr) { - var $td = $(tr).find('td:first'); + $tbody.find('tr').each(function (index, tr) { + var $td = $(tr).find('td:first'); var cellDate = new Date(currentDate.getTime()).set({ hour: parseInt($td.text().split(':')[0]), minute: parseInt($td.text().split(':')[1]) - }); + }); if (eventDate < cellDate) { $event.appendTo($(tr).prev().find('td').eq(1)); @@ -769,13 +769,13 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; return false; } - }); + }); } } /** - * Create break events in the table view. - * + * Create break events in the table view. + * * @param {jQuery} $providerColumn The provider column container. * @param {Object[]} breaks Contains the break events data. */ @@ -784,17 +784,17 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; return; } - var currentDate = new Date($providerColumn.parents('.date-column').data('date')); + var currentDate = new Date($providerColumn.parents('.date-column').data('date')); var $tbody = $providerColumn.find('table tbody'); for (var index in breaks) { var entry = breaks[index]; var startHour = entry.start.split(':'); - var eventDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate(), startHour[0], startHour[1]); + var eventDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate(), startHour[0], startHour[1]); var endHour = entry.end.split(':'); - var endDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate(), endHour[0], endHour[1]); + var endDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate(), endHour[0], endHour[1]); var eventDuration = Math.round((endDate - eventDate) / 60000); - var $event = $('
'); + var $event = $('
'); $event.html( EALang.break + @@ -802,13 +802,13 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; $event.data(entry); - $tbody.find('tr').each(function(index, tr) { - var $td = $(tr).find('td:first'); + $tbody.find('tr').each(function (index, tr) { + var $td = $(tr).find('td:first'); var cellDate = new Date(currentDate.getTime()).set({ hour: parseInt($td.text().split(':')[0]), minute: parseInt($td.text().split(':')[1]) - }); + }); if (eventDate < cellDate) { // Remove the hour from the event if it is the same as the row. @@ -816,24 +816,24 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; $event.find('.hour').remove(); } - $(tr).prev().find('td:gt(0)').each(function(index, td) { + $(tr).prev().find('td:gt(0)').each(function (index, td) { $event.clone().appendTo($(td)); }); return false; } - }); + }); } } /** - * Set Table Calendar View + * Set Table Calendar View * * This method will set the optimal size in the calendar view elements in order to fit in the page without * using scrollbars. */ function _setCalendarSize() { - var height = window.innerHeight - $('#header').outerHeight() - $('#footer').outerHeight() - - $('#calendar-toolbar').outerHeight() - $('.calendar-header').outerHeight() - 50; + var height = window.innerHeight - $('#header').outerHeight() - $('#footer').outerHeight() + - $('#calendar-toolbar').outerHeight() - $('.calendar-header').outerHeight() - 50; if (height < 500) { height = 500; @@ -843,29 +843,29 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; $('.calendar-view > div').css('min-width', '1000%'); - var width = 0; + var width = 0; - $('.date-column').each(function(index, dateColumn) { + $('.date-column').each(function (index, dateColumn) { width += $(dateColumn).outerWidth(); }); $('.calendar-view > div').css('min-width', width + 200); var dateColumnHeight = $('.date-column').outerHeight(); - - $('.calendar-view .not-working').outerHeight((dateColumnHeight > height ? dateColumnHeight : height ) - 70); + + $('.calendar-view .not-working').outerHeight((dateColumnHeight > height ? dateColumnHeight : height) - 70); } /** - * Get the calendar events. - * + * Get the calendar events. + * * @param {Date} startDate The start date of the selected period. * @param {Date} endDate The end date of the selected period. - * + * * @return {jQuery.jqXHR} */ function _getCalendarEvents(startDate, endDate) { - var url = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_get_calendar_events'; + var url = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_get_calendar_events'; var data = { csrfToken: GlobalVariables.csrfToken, startDate: startDate.toString('yyyy-MM-dd'), @@ -873,33 +873,33 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; }; return $.ajax({ - url: url, - data: data, + url: url, + data: data, method: 'POST', - beforeSend: function() { + beforeSend: function () { $('#loading').css('visibility', 'hidden'); - }, - complete: function() { - $('#loading').css('visibility', ''); + }, + complete: function () { + $('#loading').css('visibility', ''); } - }); + }); } /** - * Initialize Page + * Initialize Page */ - exports.initialize = function() { - _createHeader(); + exports.initialize = function () { + _createHeader(); _createView(Date.today(), Date.today().add({days: parseInt($('#select-filter-item').val() - 1)})); _bindEventHandlers(); - + // Hide Google Calendar Sync buttons cause they can not be used within this view. $('#enable-sync, #google-sync').hide(); // Auto-reload the results every one minute. - setInterval(function() { + setInterval(function () { $('#reload-appointments').trigger('click'); - }, 20000); + }, 20000); }; })(window.BackendCalendarTableView); diff --git a/src/assets/js/backend_calendar_unavailabilities_modal.js b/src/assets/js/backend_calendar_unavailabilities_modal.js index 0784291b..7678f833 100644 --- a/src/assets/js/backend_calendar_unavailabilities_modal.js +++ b/src/assets/js/backend_calendar_unavailabilities_modal.js @@ -18,7 +18,7 @@ */ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabilitiesModal || {}; -(function(exports) { +(function (exports) { 'use strict'; @@ -28,7 +28,7 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili * * Stores the unavailable period changes or inserts a new record. */ - $('#manage-unavailable #save-unavailable').click(function() { + $('#manage-unavailable #save-unavailable').click(function () { var $dialog = $('#manage-unavailable'); $dialog.find('.has-error').removeClass('has-error'); var start = $dialog.find('#unavailable-start').datetimepicker('getDate'); @@ -58,11 +58,11 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili unavailable.id = $dialog.find('#unavailable-id').val(); } - var successCallback = function(response) { + var successCallback = function (response) { if (response.exceptions) { response.exceptions = GeneralFunctions.parseExceptions(response.exceptions); GeneralFunctions.displayMessageBox(GeneralFunctions.EXCEPTIONS_TITLE, - GeneralFunctions.EXCEPTIONS_MESSAGE); + GeneralFunctions.EXCEPTIONS_MESSAGE); $('#message_box').append(GeneralFunctions.exceptionsToHtml(response.exceptions)); $dialog.find('.modal-message') @@ -76,7 +76,7 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili if (response.warnings) { response.warnings = GeneralFunctions.parseExceptions(response.warnings); GeneralFunctions.displayMessageBox(GeneralFunctions.WARNINGS_TITLE, - GeneralFunctions.WARNINGS_MESSAGE); + GeneralFunctions.WARNINGS_MESSAGE); $('#message_box').append(GeneralFunctions.exceptionsToHtml(response.warnings)); } @@ -87,16 +87,16 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili .removeClass('alert-danger hidden'); // Close the modal dialog and refresh the calendar appointments after one second. - setTimeout(function() { + setTimeout(function () { $dialog.find('.alert').addClass('hidden'); $dialog.modal('hide'); $('#select-filter-item').trigger('change'); }, 2000); }; - var errorCallback = function(jqXHR, textStatus, errorThrown) { + var errorCallback = function (jqXHR, textStatus, errorThrown) { GeneralFunctions.displayMessageBox('Communication Error', 'Unfortunately ' + - 'the operation could not complete due to server communication errors.'); + 'the operation could not complete due to server communication errors.'); $dialog.find('.modal-message').txt(EALang.service_communication_error); $dialog.find('.modal-message').addClass('alert-danger').removeClass('hidden'); @@ -110,7 +110,7 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili * * Closes the dialog without saveing any changes to the database. */ - $('#manage-unavailable #cancel-unavailable').click(function() { + $('#manage-unavailable #cancel-unavailable').click(function () { $('#manage-unavailable').modal('hide'); }); @@ -120,7 +120,7 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili * When the user clicks this button a popup dialog appears and the use can set a time period where * he cannot accept any appointments. */ - $('#insert-unavailable').click(function() { + $('#insert-unavailable').click(function () { BackendCalendarUnavailabilitiesModal.resetUnavailableDialog(); var $dialog = $('#manage-unavailable'); @@ -129,13 +129,13 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili var currentMin = parseInt(start.toString('mm')); if (currentMin > 0 && currentMin < 15) { - start.set({ 'minute': 15 }); + start.set({'minute': 15}); } else if (currentMin > 15 && currentMin < 30) { - start.set({ 'minute': 30 }); + start.set({'minute': 30}); } else if (currentMin > 30 && currentMin < 45) { - start.set({ 'minute': 45 }); + start.set({'minute': 45}); } else { - start.addHours(1).set({ 'minute': 0 }); + start.addHours(1).set({'minute': 0}); } if ($('.calendar-view').length === 0) { @@ -158,7 +158,7 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili * Reset the "#manage-unavailable" dialog. Use this method to bring the dialog to the initial state * before it becomes visible to the user. */ - exports.resetUnavailableDialog = function() { + exports.resetUnavailableDialog = function () { var $dialog = $('#manage-unavailable'); $dialog.find('#unavailable-id').val(''); @@ -168,7 +168,7 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili var end = GeneralFunctions.formatDate(new Date().addHours(1), GlobalVariables.dateFormat, true); var dateFormat; - switch(GlobalVariables.dateFormat) { + switch (GlobalVariables.dateFormat) { case 'DMY': dateFormat = 'dd/mm/yy'; break; @@ -187,18 +187,18 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili // Translation dayNames: [EALang.sunday, EALang.monday, EALang.tuesday, EALang.wednesday, - EALang.thursday, EALang.friday, EALang.saturday], - dayNamesShort: [EALang.sunday.substr(0,3), EALang.monday.substr(0,3), - EALang.tuesday.substr(0,3), EALang.wednesday.substr(0,3), - EALang.thursday.substr(0,3), EALang.friday.substr(0,3), - EALang.saturday.substr(0,3)], - dayNamesMin: [EALang.sunday.substr(0,2), EALang.monday.substr(0,2), - EALang.tuesday.substr(0,2), EALang.wednesday.substr(0,2), - EALang.thursday.substr(0,2), EALang.friday.substr(0,2), - EALang.saturday.substr(0,2)], + EALang.thursday, EALang.friday, EALang.saturday], + dayNamesShort: [EALang.sunday.substr(0, 3), EALang.monday.substr(0, 3), + EALang.tuesday.substr(0, 3), EALang.wednesday.substr(0, 3), + EALang.thursday.substr(0, 3), EALang.friday.substr(0, 3), + EALang.saturday.substr(0, 3)], + dayNamesMin: [EALang.sunday.substr(0, 2), EALang.monday.substr(0, 2), + EALang.tuesday.substr(0, 2), EALang.wednesday.substr(0, 2), + EALang.thursday.substr(0, 2), EALang.friday.substr(0, 2), + EALang.saturday.substr(0, 2)], monthNames: [EALang.january, EALang.february, EALang.march, EALang.april, - EALang.may, EALang.june, EALang.july, EALang.august, EALang.september, - EALang.october, EALang.november, EALang.december], + EALang.may, EALang.june, EALang.july, EALang.august, EALang.september, + EALang.october, EALang.november, EALang.december], prevText: EALang.previous, nextText: EALang.next, currentText: EALang.now, @@ -217,18 +217,18 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili // Translation dayNames: [EALang.sunday, EALang.monday, EALang.tuesday, EALang.wednesday, - EALang.thursday, EALang.friday, EALang.saturday], - dayNamesShort: [EALang.sunday.substr(0,3), EALang.monday.substr(0,3), - EALang.tuesday.substr(0,3), EALang.wednesday.substr(0,3), - EALang.thursday.substr(0,3), EALang.friday.substr(0,3), - EALang.saturday.substr(0,3)], - dayNamesMin: [EALang.sunday.substr(0,2), EALang.monday.substr(0,2), - EALang.tuesday.substr(0,2), EALang.wednesday.substr(0,2), - EALang.thursday.substr(0,2), EALang.friday.substr(0,2), - EALang.saturday.substr(0,2)], + EALang.thursday, EALang.friday, EALang.saturday], + dayNamesShort: [EALang.sunday.substr(0, 3), EALang.monday.substr(0, 3), + EALang.tuesday.substr(0, 3), EALang.wednesday.substr(0, 3), + EALang.thursday.substr(0, 3), EALang.friday.substr(0, 3), + EALang.saturday.substr(0, 3)], + dayNamesMin: [EALang.sunday.substr(0, 2), EALang.monday.substr(0, 2), + EALang.tuesday.substr(0, 2), EALang.wednesday.substr(0, 2), + EALang.thursday.substr(0, 2), EALang.friday.substr(0, 2), + EALang.saturday.substr(0, 2)], monthNames: [EALang.january, EALang.february, EALang.march, EALang.april, - EALang.may, EALang.june, EALang.july, EALang.august, EALang.september, - EALang.october, EALang.november, EALang.december], + EALang.may, EALang.june, EALang.july, EALang.august, EALang.september, + EALang.october, EALang.november, EALang.december], prevText: EALang.previous, nextText: EALang.next, currentText: EALang.now, @@ -245,11 +245,11 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili $dialog.find('#unavailable-notes').val(''); }; - exports.initialize = function() { - var $unavailabilityProvider = $('#unavailable-provider'); + exports.initialize = function () { + var $unavailabilityProvider = $('#unavailable-provider'); for (var index in GlobalVariables.availableProviders) { - var provider = GlobalVariables.availableProviders[index]; + var provider = GlobalVariables.availableProviders[index]; $unavailabilityProvider.append(new Option(provider.first_name + ' ' + provider.last_name, provider.id)); } diff --git a/src/assets/js/backend_categories_helper.js b/src/assets/js/backend_categories_helper.js index ce6f3a02..638938f2 100644 --- a/src/assets/js/backend_categories_helper.js +++ b/src/assets/js/backend_categories_helper.js @@ -9,7 +9,7 @@ * @since v1.0.0 * ---------------------------------------------------------------------------- */ -(function() { +(function () { 'use strict'; @@ -28,13 +28,13 @@ /** * Binds the default event handlers of the categories tab. */ - CategoriesHelper.prototype.bindEventHandlers = function() { + CategoriesHelper.prototype.bindEventHandlers = function () { var instance = this; /** * Event: Filter Categories Cancel Button "Click" */ - $('#filter-categories .clear').click(function() { + $('#filter-categories .clear').click(function () { $('#filter-categories .key').val(''); instance.filter(''); instance.resetForm(); @@ -43,7 +43,7 @@ /** * Event: Filter Categories Form "Submit" */ - $('#filter-categories form').submit(function() { + $('#filter-categories form').submit(function () { var key = $('#filter-categories .key').val(); $('.selected').removeClass('selected'); instance.resetForm(); @@ -56,7 +56,7 @@ * * Displays the selected row data on the right side of the page. */ - $(document).on('click', '.category-row', function() { + $(document).on('click', '.category-row', function () { if ($('#filter-categories .filter').prop('disabled')) { $('#filter-categories .results').css('color', '#AAA'); return; // exit because we are on edit mode @@ -64,7 +64,7 @@ var categoryId = $(this).attr('data-id'); var category = {}; - $.each(instance.filterResults, function(index, item) { + $.each(instance.filterResults, function (index, item) { if (item.id === categoryId) { category = item; return false; @@ -80,7 +80,7 @@ /** * Event: Add Category Button "Click" */ - $('#add-category').click(function() { + $('#add-category').click(function () { instance.resetForm(); $('#categories .add-edit-delete-group').hide(); $('#categories .save-cancel-group').show(); @@ -92,7 +92,7 @@ /** * Event: Edit Category Button "Click" */ - $('#edit-category').click(function() { + $('#edit-category').click(function () { $('#categories .add-edit-delete-group').hide(); $('#categories .save-cancel-group').show(); $('#categories .record-details').find('input, textarea').prop('readonly', false); @@ -104,33 +104,33 @@ /** * Event: Delete Category Button "Click" */ - $('#delete-category').click(function() { + $('#delete-category').click(function () { var categoryId = $('#category-id').val(); var buttons = [ { text: EALang.delete, - click: function() { + click: function () { instance.delete(categoryId); $('#message_box').dialog('close'); } }, { text: EALang.cancel, - click: function() { + click: function () { $('#message_box').dialog('close'); } } ]; GeneralFunctions.displayMessageBox(EALang.delete_category, - EALang.delete_record_prompt, buttons); + EALang.delete_record_prompt, buttons); }); /** * Event: Categories Save Button "Click" */ - $('#save-category').click(function() { + $('#save-category').click(function () { var category = { name: $('#category-name').val(), description: $('#category-description').val() @@ -150,7 +150,7 @@ /** * Event: Cancel Category Button "Click" */ - $('#cancel-category').click(function() { + $('#cancel-category').click(function () { var id = $('#category-id').val(); instance.resetForm(); if (id !== '') { @@ -167,14 +167,14 @@ * ID will be selected (but not displayed). * @param {Boolean} display Optional (false), if true then the selected record will be displayed on the form. */ - CategoriesHelper.prototype.filter = function(key, selectId, display) { + CategoriesHelper.prototype.filter = function (key, selectId, display) { var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_service_categories'; var postData = { csrfToken: GlobalVariables.csrfToken, key: key }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -182,7 +182,7 @@ this.filterResults = response; $('#filter-categories .results').html(''); - $.each(response, function(index, category) { + $.each(response, function (index, category) { var html = this.getFilterHtml(category); $('#filter-categories .results').append(html); }.bind(this)); @@ -202,14 +202,14 @@ * * @param {Object} category Contains the category data. */ - CategoriesHelper.prototype.save = function(category) { + CategoriesHelper.prototype.save = function (category) { var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_service_category'; var postData = { csrfToken: GlobalVariables.csrfToken, category: JSON.stringify(category) }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -219,7 +219,7 @@ $('#filter-categories .key').val(''); this.filter('', response.id, true); BackendServices.updateAvailableCategories(); - }. bind(this), 'json').fail(GeneralFunctions.ajaxFailureHandler); + }.bind(this), 'json').fail(GeneralFunctions.ajaxFailureHandler); }; /** @@ -227,14 +227,14 @@ * * @param Number} id Record ID to be deleted. */ - CategoriesHelper.prototype.delete = function(id) { + CategoriesHelper.prototype.delete = function (id) { var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_service_category'; var postData = { csrfToken: GlobalVariables.csrfToken, category_id: id }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -252,7 +252,7 @@ * * @param {Object} category Contains the category data. */ - CategoriesHelper.prototype.display = function(category) { + CategoriesHelper.prototype.display = function (category) { $('#category-id').val(category.id); $('#category-name').val(category.name); $('#category-description').val(category.description); @@ -263,13 +263,13 @@ * * @return {Boolean} Returns the validation result. */ - CategoriesHelper.prototype.validate = function() { + CategoriesHelper.prototype.validate = function () { $('#categories .has-error').removeClass('has-error'); try { var missingRequired = false; - $('#categories .required').each(function() { + $('#categories .required').each(function () { if ($(this).val() === '' || $(this).val() === undefined) { $(this).closest('.form-group').addClass('has-error'); missingRequired = true; @@ -281,7 +281,7 @@ } return true; - } catch(message) { + } catch (message) { return false; } }; @@ -289,7 +289,7 @@ /** * Bring the category form back to its initial state. */ - CategoriesHelper.prototype.resetForm = function() { + CategoriesHelper.prototype.resetForm = function () { $('#categories .add-edit-delete-group').show(); $('#categories .save-cancel-group').hide(); $('#categories .record-details').find('input, textarea').val(''); @@ -308,11 +308,11 @@ * * @return {String} Returns the record HTML code. */ - CategoriesHelper.prototype.getFilterHtml = function(category) { + CategoriesHelper.prototype.getFilterHtml = function (category) { var html = - '
' + - '' + category.name + '' + - '

'; + '
' + + '' + category.name + '' + + '

'; return html; }; @@ -326,12 +326,12 @@ * @param {Boolean} display Optional (false), if true then the method will display the record * on the form. */ - CategoriesHelper.prototype.select = function(id, display) { + CategoriesHelper.prototype.select = function (id, display) { display = display || false; $('#filter-categories .selected').removeClass('selected'); - $('#filter-categories .category-row').each(function() { + $('#filter-categories .category-row').each(function () { if ($(this).attr('data-id') == id) { $(this).addClass('selected'); return false; @@ -339,7 +339,7 @@ }); if (display) { - $.each(this.filterResults, function(index, category) { + $.each(this.filterResults, function (index, category) { if (category.id == id) { this.display(category); $('#edit-category, #delete-category').prop('disabled', false); diff --git a/src/assets/js/backend_customers.js b/src/assets/js/backend_customers.js index 7018fbc9..905291ab 100644 --- a/src/assets/js/backend_customers.js +++ b/src/assets/js/backend_customers.js @@ -9,7 +9,7 @@ * @since v1.0.0 * ---------------------------------------------------------------------------- */ - window.BackendCustomers = window.BackendCustomers || {}; +window.BackendCustomers = window.BackendCustomers || {}; /** * Backend Customers @@ -20,7 +20,7 @@ * * @module BackendCustomers */ -(function(exports) { +(function (exports) { 'use strict'; @@ -39,7 +39,7 @@ * @param {Boolean} defaultEventHandlers Optional (false), whether to bind the default * event handlers or not. */ - exports.initialize = function(defaultEventHandlers) { + exports.initialize = function (defaultEventHandlers) { defaultEventHandlers = defaultEventHandlers || false; helper = new CustomersHelper(); @@ -47,7 +47,7 @@ helper.filter(''); if (defaultEventHandlers) { - _bindEventHandlers(); + _bindEventHandlers(); } }; diff --git a/src/assets/js/backend_customers_helper.js b/src/assets/js/backend_customers_helper.js index 51cf8d1d..1fd2f59b 100644 --- a/src/assets/js/backend_customers_helper.js +++ b/src/assets/js/backend_customers_helper.js @@ -9,7 +9,7 @@ * @since v1.0.0 * ---------------------------------------------------------------------------- */ -(function() { +(function () { 'use strict'; @@ -27,13 +27,13 @@ /** * Binds the default event handlers of the backend customers page. */ - CustomersHelper.prototype.bindEventHandlers = function() { + CustomersHelper.prototype.bindEventHandlers = function () { var instance = this; /** * Event: Filter Customers Form "Submit" */ - $('#filter-customers form').submit(function(event) { + $('#filter-customers form').submit(function (event) { var key = $('#filter-customers .key').val(); $('#filter-customers .selected').removeClass('selected'); instance.resetForm(); @@ -44,7 +44,7 @@ /** * Event: Filter Customers Clear Button "Click" */ - $('#filter-customers .clear').click(function() { + $('#filter-customers .clear').click(function () { $('#filter-customers .key').val(''); instance.filter(''); instance.resetForm(); @@ -55,14 +55,14 @@ * * Display the customer data of the selected row. */ - $(document).on('click', '.entry', function() { + $(document).on('click', '.entry', function () { if ($('#filter-customers .filter').prop('disabled')) { return; // Do nothing when user edits a customer record. } var customerId = $(this).attr('data-id'); var customer = {}; - $.each(instance.filterResults, function(index, item) { + $.each(instance.filterResults, function (index, item) { if (item.id == customerId) { customer = item; return false; @@ -80,7 +80,7 @@ * * Display appointment data of the selected row. */ - $(document).on('click', '.appointment-row', function() { + $(document).on('click', '.appointment-row', function () { $('#customer-appointments .selected').removeClass('selected'); $(this).addClass('selected'); @@ -88,9 +88,9 @@ var appointmentId = $(this).attr('data-id'); var appointment = {}; - $.each(instance.filterResults, function(index, c) { + $.each(instance.filterResults, function (index, c) { if (c.id === customerId) { - $.each(c.appointments, function(index, a) { + $.each(c.appointments, function (index, a) { if (a.id == appointmentId) { appointment = a; return false; @@ -106,7 +106,7 @@ /** * Event: Add Customer Button "Click" */ - $('#add-customer').click(function() { + $('#add-customer').click(function () { instance.resetForm(); $('#add-edit-delete-group').hide(); $('#save-cancel-group').show(); @@ -119,7 +119,7 @@ /** * Event: Edit Customer Button "Click" */ - $('#edit-customer').click(function() { + $('#edit-customer').click(function () { $('.record-details').find('input, textarea').prop('readonly', false); $('#add-edit-delete-group').hide(); $('#save-cancel-group').show(); @@ -131,7 +131,7 @@ /** * Event: Cancel Customer Add/Edit Operation Button "Click" */ - $('#cancel-customer').click(function() { + $('#cancel-customer').click(function () { var id = $('#customer-id').val(); instance.resetForm(); if (id != '') { @@ -142,7 +142,7 @@ /** * Event: Save Add/Edit Customer Operation "Click" */ - $('#save-customer').click(function() { + $('#save-customer').click(function () { var customer = { first_name: $('#first-name').val(), last_name: $('#last-name').val(), @@ -168,26 +168,26 @@ /** * Event: Delete Customer Button "Click" */ - $('#delete-customer').click(function() { + $('#delete-customer').click(function () { var customerId = $('#customer-id').val(); var buttons = [ { text: EALang.delete, - click: function() { + click: function () { instance.delete(customerId); $('#message_box').dialog('close'); } }, { text: EALang.cancel, - click: function() { + click: function () { $('#message_box').dialog('close'); } } ]; GeneralFunctions.displayMessageBox(EALang.delete_customer, - EALang.delete_record_prompt, buttons); + EALang.delete_record_prompt, buttons); }); }; @@ -196,14 +196,14 @@ * * @param {Object} customer Contains the customer data. */ - CustomersHelper.prototype.save = function(customer) { + CustomersHelper.prototype.save = function (customer) { var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_customer'; var postData = { csrfToken: GlobalVariables.csrfToken, customer: JSON.stringify(customer) }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -220,14 +220,14 @@ * * @param {Number} id Record id to be deleted. */ - CustomersHelper.prototype.delete = function(id) { + CustomersHelper.prototype.delete = function (id) { var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_customer'; var postData = { csrfToken: GlobalVariables.csrfToken, customer_id: id }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -241,7 +241,7 @@ /** * Validate customer data before save (insert or update). */ - CustomersHelper.prototype.validate = function() { + CustomersHelper.prototype.validate = function () { $('#form-message') .removeClass('alert-danger') .hide(); @@ -251,7 +251,7 @@ // Validate required fields. var missingRequired = false; - $('.required').each(function() { + $('.required').each(function () { if ($(this).val() == '') { $(this).closest('.form-group').addClass('has-error'); missingRequired = true; @@ -269,7 +269,7 @@ } return true; - } catch(message) { + } catch (message) { $('#form-message') .addClass('alert-danger') .text(message) @@ -281,7 +281,7 @@ /** * Bring the customer form back to its initial state. */ - CustomersHelper.prototype.resetForm = function() { + CustomersHelper.prototype.resetForm = function () { $('.record-details').find('input, textarea').val(''); $('.record-details').find('input, textarea').prop('readonly', true); @@ -304,7 +304,7 @@ * * @param {Object} customer Contains the customer record data. */ - CustomersHelper.prototype.display = function(customer) { + CustomersHelper.prototype.display = function (customer) { $('#customer-id').val(customer.id); $('#first-name').val(customer.first_name); $('#last-name').val(customer.last_name); @@ -316,15 +316,15 @@ $('#notes').val(customer.notes); $('#customer-appointments').empty(); - $.each(customer.appointments, function(index, appointment) { + $.each(customer.appointments, function (index, appointment) { var start = GeneralFunctions.formatDate(Date.parse(appointment.start_datetime), GlobalVariables.dateFormat, true); var end = GeneralFunctions.formatDate(Date.parse(appointment.end_datetime), GlobalVariables.dateFormat, true); var html = - '
' + - start + ' - ' + end + '
' + - appointment.service.name + ', ' + - appointment.provider.first_name + ' ' + appointment.provider.last_name + - '
'; + '
' + + start + ' - ' + end + '
' + + appointment.service.name + ', ' + + appointment.provider.first_name + ' ' + appointment.provider.last_name + + '
'; $('#customer-appointments').append(html); }); @@ -339,7 +339,7 @@ * ID will be selected (but not displayed). * @param {Boolean} display Optional (false), if true then the selected record will be displayed on the form. */ - CustomersHelper.prototype.filter = function(key, selectId, display) { + CustomersHelper.prototype.filter = function (key, selectId, display) { display = display || false; var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_customers'; @@ -348,7 +348,7 @@ key: key }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -356,10 +356,10 @@ this.filterResults = response; $('#filter-customers .results').html(''); - $.each(response, function(index, customer) { - var html = this.getFilterHtml(customer); - $('#filter-customers .results').append(html); - }.bind(this)); + $.each(response, function (index, customer) { + var html = this.getFilterHtml(customer); + $('#filter-customers .results').append(html); + }.bind(this)); if (response.length == 0) { $('#filter-customers .results').html('' + EALang.no_records_found + ''); } @@ -378,19 +378,19 @@ * * @return {String} Returns the record HTML code. */ - CustomersHelper.prototype.getFilterHtml = function(customer) { + CustomersHelper.prototype.getFilterHtml = function (customer) { var name = customer.first_name + ' ' + customer.last_name; var info = customer.email; info = (customer.phone_number != '' && customer.phone_number != null) - ? info + ', ' + customer.phone_number : info; + ? info + ', ' + customer.phone_number : info; var html = - '
' + - '' + - name + - '
' + - info + - '

'; + '
' + + '' + + name + + '
' + + info + + '

'; return html; }; @@ -404,12 +404,12 @@ * @param {Boolean} display Optional (false), if true then the method will display the record * on the form. */ - CustomersHelper.prototype.select = function(id, display) { + CustomersHelper.prototype.select = function (id, display) { display = display || false; $('#filter-customers .selected').removeClass('selected'); - $('#filter-customers .entry').each(function() { + $('#filter-customers .entry').each(function () { if ($(this).attr('data-id') == id) { $(this).addClass('selected'); return false; @@ -417,7 +417,7 @@ }); if (display) { - $.each(this.filterResults, function(index, customer) { + $.each(this.filterResults, function (index, customer) { if (customer.id == id) { this.display(customer); $('#edit-customer, #delete-customer').prop('disabled', false); @@ -432,16 +432,16 @@ * * @param {Object} appointment Appointment data */ - CustomersHelper.prototype.displayAppointment = function(appointment) { + CustomersHelper.prototype.displayAppointment = function (appointment) { var start = GeneralFunctions.formatDate(Date.parse(appointment.start_datetime), GlobalVariables.dateFormat, true); var end = GeneralFunctions.formatDate(Date.parse(appointment.end_datetime), GlobalVariables.dateFormat, true); var html = - '
' + - '' + appointment.service.name + '
' + - appointment.provider.first_name + ' ' + appointment.provider.last_name + '
' + - start + ' - ' + end + '
' + - '
'; + '
' + + '' + appointment.service.name + '
' + + appointment.provider.first_name + ' ' + appointment.provider.last_name + '
' + + start + ' - ' + end + '
' + + '
'; $('#appointment-details').html(html).removeClass('hidden'); }; diff --git a/src/assets/js/backend_services.js b/src/assets/js/backend_services.js index ef912cb5..e62c3abb 100644 --- a/src/assets/js/backend_services.js +++ b/src/assets/js/backend_services.js @@ -18,7 +18,7 @@ window.BackendServices = window.BackendServices || {}; * * @module BackendServices */ -(function(exports) { +(function (exports) { 'use strict'; @@ -29,7 +29,7 @@ window.BackendServices = window.BackendServices || {}; */ var helper; - var servicesHelper = new ServicesHelper(); + var servicesHelper = new ServicesHelper(); var categoriesHelper = new CategoriesHelper(); /** @@ -37,11 +37,11 @@ window.BackendServices = window.BackendServices || {}; * * @param {Boolean} bindEventHandlers Optional (true), determines whether to bind the default event handlers. */ - exports.initialize = function(bindEventHandlers) { + exports.initialize = function (bindEventHandlers) { bindEventHandlers = bindEventHandlers || true; // Fill available service categories listbox. - $.each(GlobalVariables.categories, function(index, category) { + $.each(GlobalVariables.categories, function (index, category) { var option = new Option(category.name, category.id); $('#service-category').append(option); }); @@ -68,7 +68,7 @@ window.BackendServices = window.BackendServices || {}; * * Changes the displayed tab. */ - $('a[data-toggle="tab"]').on('shown.bs.tab', function() { + $('a[data-toggle="tab"]').on('shown.bs.tab', function () { if ($(this).attr('href') === '#services') { helper = servicesHelper; } else if ($(this).attr('href') === '#categories') { @@ -81,8 +81,8 @@ window.BackendServices = window.BackendServices || {}; Backend.placeFooterToBottom(); }); - servicesHelper.bindEventHandlers(); - categoriesHelper.bindEventHandlers(); + servicesHelper.bindEventHandlers(); + categoriesHelper.bindEventHandlers(); } /** @@ -90,14 +90,14 @@ window.BackendServices = window.BackendServices || {}; * * Use this method every time a change is made to the service categories db table. */ - exports.updateAvailableCategories = function() { + exports.updateAvailableCategories = function () { var url = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_service_categories'; var data = { csrfToken: GlobalVariables.csrfToken, key: '' }; - $.post(url, data, function(response) { + $.post(url, data, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -105,7 +105,7 @@ window.BackendServices = window.BackendServices || {}; GlobalVariables.categories = response; var $select = $('#service-category'); $select.empty(); - $.each(response, function(index, category) { + $.each(response, function (index, category) { var option = new Option(category.name, category.id); $select.append(option); }); diff --git a/src/assets/js/backend_services_helper.js b/src/assets/js/backend_services_helper.js index 1d8a847d..f971d7bf 100644 --- a/src/assets/js/backend_services_helper.js +++ b/src/assets/js/backend_services_helper.js @@ -9,7 +9,7 @@ * @since v1.0.0 * ---------------------------------------------------------------------------- */ -(function() { +(function () { 'use strict'; @@ -24,7 +24,7 @@ this.filterResults = {}; } - ServicesHelper.prototype.bindEventHandlers = function() { + ServicesHelper.prototype.bindEventHandlers = function () { var instance = this; /** @@ -32,7 +32,7 @@ * * @param {jQuery.Event} event */ - $('#filter-services form').submit(function(event) { + $('#filter-services form').submit(function (event) { var key = $('#filter-services .key').val(); $('#filter-services .selected').removeClass('selected'); instance.resetForm(); @@ -43,7 +43,7 @@ /** * Event: Filter Service Cancel Button "Click" */ - $('#filter-services .clear').click(function() { + $('#filter-services .clear').click(function () { $('#filter-services .key').val(''); instance.filter(''); instance.resetForm(); @@ -54,7 +54,7 @@ * * Display the selected service data to the user. */ - $(document).on('click', '.service-row', function() { + $(document).on('click', '.service-row', function () { if ($('#filter-services .filter').prop('disabled')) { $('#filter-services .results').css('color', '#AAA'); return; // exit because we are on edit mode @@ -62,7 +62,7 @@ var serviceId = $(this).attr('data-id'); var service = {}; - $.each(instance.filterResults, function(index, item) { + $.each(instance.filterResults, function (index, item) { if (item.id === serviceId) { service = item; return false; @@ -87,7 +87,7 @@ /** * Event: Add New Service Button "Click" */ - $('#add-service').click(function() { + $('#add-service').click(function () { instance.resetForm(); $('#services .add-edit-delete-group').hide(); $('#services .save-cancel-group').show(); @@ -103,7 +103,7 @@ * * Cancel add or edit of a service record. */ - $('#cancel-service').click(function() { + $('#cancel-service').click(function () { var id = $('#service-id').val(); instance.resetForm(); if (id !== '') { @@ -114,7 +114,7 @@ /** * Event: Save Service Button "Click" */ - $('#save-service').click(function() { + $('#save-service').click(function () { var service = { name: $('#service-name').val(), duration: $('#service-duration').val(), @@ -145,7 +145,7 @@ /** * Event: Edit Service Button "Click" */ - $('#edit-service').click(function() { + $('#edit-service').click(function () { $('#services .add-edit-delete-group').hide(); $('#services .save-cancel-group').show(); $('#services .record-details').find('input, textarea').prop('readonly', false); @@ -158,26 +158,26 @@ /** * Event: Delete Service Button "Click" */ - $('#delete-service').click(function() { + $('#delete-service').click(function () { var serviceId = $('#service-id').val(); var buttons = [ { text: EALang.delete, - click: function() { + click: function () { instance.delete(serviceId); $('#message_box').dialog('close'); } }, { text: EALang.cancel, - click: function() { + click: function () { $('#message_box').dialog('close'); } } ]; GeneralFunctions.displayMessageBox(EALang.delete_service, - EALang.delete_record_prompt, buttons); + EALang.delete_record_prompt, buttons); }); }; @@ -187,14 +187,14 @@ * @param {Object} service Contains the service record data. If an 'id' value is provided * then the update operation is going to be executed. */ - ServicesHelper.prototype.save = function(service) { + ServicesHelper.prototype.save = function (service) { var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_service'; var postData = { csrfToken: GlobalVariables.csrfToken, service: JSON.stringify(service) }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -211,14 +211,14 @@ * * @param {Number} id Record ID to be deleted. */ - ServicesHelper.prototype.delete = function(id) { + ServicesHelper.prototype.delete = function (id) { var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_service'; var postData = { csrfToken: GlobalVariables.csrfToken, service_id: id }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -235,14 +235,14 @@ * * @return {Boolean} Returns the validation result. */ - ServicesHelper.prototype.validate = function() { + ServicesHelper.prototype.validate = function () { $('#services .has-error').removeClass('has-error'); try { // validate required fields. var missingRequired = false; - $('#services .required').each(function() { + $('#services .required').each(function () { if ($(this).val() == '' || $(this).val() == undefined) { $(this).closest('.form-group').addClass('has-error'); missingRequired = true; @@ -254,7 +254,7 @@ } return true; - } catch(exc) { + } catch (exc) { return false; } }; @@ -262,7 +262,7 @@ /** * Resets the service tab form back to its initial state. */ - ServicesHelper.prototype.resetForm = function() { + ServicesHelper.prototype.resetForm = function () { $('#services .record-details').find('input, textarea').val(''); $('#service-category').val('null'); $('#services .add-edit-delete-group').show(); @@ -281,7 +281,7 @@ * * @param {Object} service Contains the service record data. */ - ServicesHelper.prototype.display = function(service) { + ServicesHelper.prototype.display = function (service) { $('#service-id').val(service.id); $('#service-name').val(service.name); $('#service-duration').val(service.duration); @@ -303,7 +303,7 @@ * ID will be selected (but not displayed). * @param {Boolean} display Optional (false), if true then the selected record will be displayed on the form. */ - ServicesHelper.prototype.filter = function(key, selectId, display) { + ServicesHelper.prototype.filter = function (key, selectId, display) { display = display || false; var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_services'; @@ -312,7 +312,7 @@ key: key }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -320,7 +320,7 @@ this.filterResults = response; $('#filter-services .results').html(''); - $.each(response, function(index, service) { + $.each(response, function (index, service) { var html = ServicesHelper.prototype.getFilterHtml(service); $('#filter-services .results').append(html); }); @@ -344,13 +344,13 @@ * * @return {String} The HTML code that represents the record on the filter results list. */ - ServicesHelper.prototype.getFilterHtml = function(service) { + ServicesHelper.prototype.getFilterHtml = function (service) { var html = - '
' + - '' + service.name + '
' + - service.duration + ' min - ' + - service.price + ' ' + service.currency + '
' + - '

'; + '
' + + '' + service.name + '
' + + service.duration + ' min - ' + + service.price + ' ' + service.currency + '
' + + '

'; return html; }; @@ -362,12 +362,12 @@ * @param {Number} id The record id to be selected from the filter results. * @param {Boolean} display Optional (false), if true then the method will display the record on the form. */ - ServicesHelper.prototype.select = function(id, display) { + ServicesHelper.prototype.select = function (id, display) { display = display || false; $('#filter-services .selected').removeClass('selected'); - $('#filter-services .service-row').each(function() { + $('#filter-services .service-row').each(function () { if ($(this).attr('data-id') == id) { $(this).addClass('selected'); return false; @@ -375,7 +375,7 @@ }); if (display) { - $.each(this.filterResults, function(index, service) { + $.each(this.filterResults, function (index, service) { if (service.id == id) { this.display(service); $('#edit-service, #delete-service').prop('disabled', false); diff --git a/src/assets/js/backend_settings.js b/src/assets/js/backend_settings.js index 7a6edd6f..53359cc1 100644 --- a/src/assets/js/backend_settings.js +++ b/src/assets/js/backend_settings.js @@ -19,7 +19,7 @@ window.BackendSettings = window.BackendSettings || {}; * * @module BackendSettings */ -(function(exports) { +(function (exports) { 'use strict'; @@ -46,17 +46,17 @@ window.BackendSettings = window.BackendSettings || {}; * * @param {bool} bindEventHandlers Optional (true), determines whether to bind the default event handlers. */ - exports.initialize = function(bindEventHandlers) { + exports.initialize = function (bindEventHandlers) { bindEventHandlers = bindEventHandlers || true; // Apply setting values from database. - $.each(GlobalVariables.settings.system, function(index, setting) { + $.each(GlobalVariables.settings.system, function (index, setting) { $('input[data-field="' + setting.name + '"]').val(setting.value); $('select[data-field="' + setting.name + '"]').val(setting.value); }); var workingPlan = {}; - $.each(GlobalVariables.settings.system, function(index, setting) { + $.each(GlobalVariables.settings.system, function (index, setting) { if (setting.name == 'company_working_plan') { workingPlan = $.parseJSON(setting.value); } @@ -163,7 +163,7 @@ window.BackendSettings = window.BackendSettings || {}; * * Store the setting changes into the database. */ - $('.save-settings').click(function() { + $('.save-settings').click(function () { var data = settings.get(); settings.save(data); }); @@ -174,7 +174,7 @@ window.BackendSettings = window.BackendSettings || {}; * 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() { + $('#username').focusout(function () { var $input = $(this); if ($input.prop('readonly') == true || $input.val() == '') { @@ -188,7 +188,7 @@ window.BackendSettings = window.BackendSettings || {}; user_id: $input.parents().eq(2).find('#user-id').val() }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } diff --git a/src/assets/js/backend_settings_system.js b/src/assets/js/backend_settings_system.js index 1ae6eb5c..68ee718a 100644 --- a/src/assets/js/backend_settings_system.js +++ b/src/assets/js/backend_settings_system.js @@ -9,7 +9,7 @@ * @since v1.0.0 * ---------------------------------------------------------------------------- */ -(function() { +(function () { 'use strict'; @@ -18,7 +18,8 @@ * * @class SystemSettings */ - var SystemSettings = function() {}; + var SystemSettings = function () { + }; /** * Save the system settings. @@ -27,7 +28,7 @@ * * @param {Array} settings Contains the system settings data. */ - SystemSettings.prototype.save = function(settings) { + SystemSettings.prototype.save = function (settings) { var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_settings'; var postData = { csrfToken: GlobalVariables.csrfToken, @@ -35,7 +36,7 @@ type: BackendSettings.SETTINGS_SYSTEM }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -60,11 +61,11 @@ * * @return {Array} Returns the system settings array. */ - SystemSettings.prototype.get = function() { + SystemSettings.prototype.get = function () { var settings = []; // General Settings Tab - $('#general').find('input, select').each(function() { + $('#general').find('input, select').each(function () { settings.push({ name: $(this).attr('data-field'), value: $(this).val() @@ -102,13 +103,13 @@ * * @return {Boolean} Returns the validation result. */ - SystemSettings.prototype.validate = function() { + SystemSettings.prototype.validate = function () { $('#general .has-error').removeClass('has-error'); try { // Validate required fields. var missingRequired = false; - $('#general .required').each(function() { + $('#general .required').each(function () { if ($(this).val() == '' || $(this).val() == undefined) { $(this).closest('.form-group').addClass('has-error'); missingRequired = true; @@ -126,7 +127,7 @@ } return true; - } catch(message) { + } catch (message) { Backend.displayNotification(message); return false; } diff --git a/src/assets/js/backend_settings_user.js b/src/assets/js/backend_settings_user.js index dbc8816a..f8c75a90 100644 --- a/src/assets/js/backend_settings_user.js +++ b/src/assets/js/backend_settings_user.js @@ -9,7 +9,7 @@ * @since v1.0.0 * ---------------------------------------------------------------------------- */ -(function() { +(function () { 'use strict'; @@ -18,14 +18,15 @@ * * @class UserSettings */ - var UserSettings = function() {}; + var UserSettings = function () { + }; /** * Get the settings data for the user settings. * * @returns {Object} Returns the user settings array. */ - UserSettings.prototype.get = function() { + UserSettings.prototype.get = function () { var user = { id: $('#user-id').val(), first_name: $('#first-name').val(), @@ -57,7 +58,7 @@ * * @param {Array} settings Contains the user settings. */ - UserSettings.prototype.save = function(settings) { + UserSettings.prototype.save = function (settings) { if (!this.validate(settings)) { Backend.displayNotification(EALang.user_settings_are_invalid); return; // Validation failed, do not proceed. @@ -70,7 +71,7 @@ settings: JSON.stringify(settings) }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -90,13 +91,13 @@ * * @return {Boolean} Returns the validation result. */ - UserSettings.prototype.validate = function() { + UserSettings.prototype.validate = function () { $('#user .has-error').removeClass('has-error'); try { // Validate required fields. var missingRequired = false; - $('#user .required').each(function() { + $('#user .required').each(function () { if ($(this).val() === '' || $(this).val() === undefined) { $(this).closest('.form-group').addClass('has-error'); missingRequired = true; @@ -125,7 +126,7 @@ } return true; - } catch(exc) { + } catch (exc) { Backend.displayNotification(exc); return false; } diff --git a/src/assets/js/backend_users.js b/src/assets/js/backend_users.js index 83e18dbe..19600b66 100644 --- a/src/assets/js/backend_users.js +++ b/src/assets/js/backend_users.js @@ -19,7 +19,7 @@ window.BackendUsers = window.BackendUsers || {}; * * @module BackendUsers */ -(function(exports){ +(function (exports) { 'use strict'; @@ -49,7 +49,7 @@ window.BackendUsers = window.BackendUsers || {}; * * @param {Boolean} defaultEventHandlers (OPTIONAL) Whether to bind the default event handlers. */ - exports.initialize = function(defaultEventHandlers) { + exports.initialize = function (defaultEventHandlers) { defaultEventHandlers = defaultEventHandlers || true; exports.wp = new WorkingPlan(); @@ -63,13 +63,13 @@ window.BackendUsers = window.BackendUsers || {}; // Fill the services and providers list boxes. var html = '
'; - $.each(GlobalVariables.services, function(index, service) { + $.each(GlobalVariables.services, function (index, service) { html += '
' + - '' + + '' + '
'; }); @@ -77,13 +77,13 @@ window.BackendUsers = window.BackendUsers || {}; $('#provider-services').html(html); html = '
'; - $.each(GlobalVariables.providers, function(index, provider) { - html += + $.each(GlobalVariables.providers, function (index, provider) { + html += '
' + - '' + + '' + '
'; }); @@ -116,7 +116,7 @@ window.BackendUsers = window.BackendUsers || {}; * * Changes the displayed tab. */ - $('a[data-toggle="tab"]').on('shown.bs.tab', function() { + $('a[data-toggle="tab"]').on('shown.bs.tab', function () { if ($(this).attr('href') === '#admins') { helper = new AdminsHelper(); } else if ($(this).attr('href') === '#providers') { @@ -130,7 +130,7 @@ window.BackendUsers = window.BackendUsers || {}; csrfToken: GlobalVariables.csrfToken, key: '' }; - $.post(url, data, function(response) { + $.post(url, data, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -138,13 +138,13 @@ window.BackendUsers = window.BackendUsers || {}; GlobalVariables.providers = response; var html = '
'; - $.each(GlobalVariables.providers, function(index, provider) { - html += + $.each(GlobalVariables.providers, function (index, provider) { + html += '
' + - '' + + '' + '
'; }); html += '
'; @@ -165,7 +165,7 @@ window.BackendUsers = window.BackendUsers || {}; * 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. */ - $('#admin-username, #provider-username, #secretary-username').focusout(function() { + $('#admin-username, #provider-username, #secretary-username').focusout(function () { var $input = $(this); if ($input.prop('readonly') == true || $input.val() == '') { @@ -185,7 +185,7 @@ window.BackendUsers = window.BackendUsers || {}; user_id: userId }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } diff --git a/src/assets/js/backend_users_admins.js b/src/assets/js/backend_users_admins.js index 76586148..b3324c4f 100644 --- a/src/assets/js/backend_users_admins.js +++ b/src/assets/js/backend_users_admins.js @@ -9,7 +9,7 @@ * @since v1.0.0 * ---------------------------------------------------------------------------- */ -(function() { +(function () { 'use strict'; @@ -20,20 +20,20 @@ * * @class AdminsHelper */ - var AdminsHelper = function() { + var AdminsHelper = function () { this.filterResults = []; // Store the results for later use. }; /** * Bind the event handlers for the backend/users "Admins" tab. */ - AdminsHelper.prototype.bindEventHandlers = function() { + AdminsHelper.prototype.bindEventHandlers = function () { /** * Event: Filter Admins Form "Submit" * * Filter the admin records with the given key string. */ - $('#admins').on('submit', '#filter-admins form', function() { + $('#admins').on('submit', '#filter-admins form', function () { var key = $('#filter-admins .key').val(); $('#filter-admins .selected').removeClass('selected'); this.resetForm(); @@ -44,7 +44,7 @@ /** * Event: Clear Filter Results Button "Click" */ - $('#admins').on('click', '#filter-admins .clear', function() { + $('#admins').on('click', '#filter-admins .clear', function () { this.filter(''); $('#filter-admins .key').val(''); this.resetForm(); @@ -55,7 +55,7 @@ * * Display the selected admin data to the user. */ - $('#admins').on('click', '.admin-row', function(e) { + $('#admins').on('click', '.admin-row', function (e) { if ($('#filter-admins .filter').prop('disabled')) { $('#filter-admins .results').css('color', '#AAA'); return; // exit because we are currently on edit mode @@ -64,7 +64,7 @@ var adminId = $(e.currentTarget).attr('data-id'); var admin = {}; - $.each(this.filterResults, function(index, item) { + $.each(this.filterResults, function (index, item) { if (item.id === adminId) { admin = item; return false; @@ -80,7 +80,7 @@ /** * Event: Add New Admin Button "Click" */ - $('#admins').on('click', '#add-admin', function() { + $('#admins').on('click', '#add-admin', function () { this.resetForm(); $('#admins .add-edit-delete-group').hide(); $('#admins .save-cancel-group').show(); @@ -95,7 +95,7 @@ /** * Event: Edit Admin Button "Click" */ - $('#admins').on('click', '#edit-admin', function() { + $('#admins').on('click', '#edit-admin', function () { $('#admins .add-edit-delete-group').hide(); $('#admins .save-cancel-group').show(); $('#admins .record-details').find('input, textarea').prop('readonly', false); @@ -110,33 +110,33 @@ /** * Event: Delete Admin Button "Click" */ - $('#admins').on('click', '#delete-admin', function() { + $('#admins').on('click', '#delete-admin', function () { var adminId = $('#admin-id').val(); var buttons = [ { text: EALang.delete, - click: function() { + click: function () { this.delete(adminId); $('#message_box').dialog('close'); }.bind(this) }, { text: EALang.cancel, - click: function() { + click: function () { $('#message_box').dialog('close'); } } ]; GeneralFunctions.displayMessageBox(EALang.delete_admin, - EALang.delete_record_prompt, buttons); + EALang.delete_record_prompt, buttons); }.bind(this)); /** * Event: Save Admin Button "Click" */ - $('#admins').on('click', '#save-admin', function() { + $('#admins').on('click', '#save-admin', function () { var admin = { first_name: $('#admin-first-name').val(), last_name: $('#admin-last-name').val(), @@ -177,7 +177,7 @@ * * Cancel add or edit of an admin record. */ - $('#admins').on('click', '#cancel-admin', function() { + $('#admins').on('click', '#cancel-admin', function () { var id = $('#admin-id').val(); this.resetForm(); if (id != '') { @@ -192,14 +192,14 @@ * @param {Object} admin Contains the admin record data. If an 'id' value is provided * then the update operation is going to be executed. */ - AdminsHelper.prototype.save = function(admin) { + AdminsHelper.prototype.save = function (admin) { var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_admin'; var postData = { csrfToken: GlobalVariables.csrfToken, admin: JSON.stringify(admin) }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -215,14 +215,14 @@ * * @param {Number} id Record id to be deleted. */ - AdminsHelper.prototype.delete = function(id) { + AdminsHelper.prototype.delete = function (id) { var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_admin'; var postData = { csrfToken: GlobalVariables.csrfToken, admin_id: id }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -237,14 +237,14 @@ * * @return {Boolean} Returns the validation result. */ - AdminsHelper.prototype.validate = function() { + AdminsHelper.prototype.validate = function () { $('#admins .has-error').removeClass('has-error'); try { // Validate required fields. var missingRequired = false; - $('#admins .required').each(function() { + $('#admins .required').each(function () { if ($(this).val() == '' || $(this).val() == undefined) { $(this).closest('.form-group').addClass('has-error'); missingRequired = true; @@ -262,7 +262,7 @@ } if ($('#admin-password').val().length < BackendUsers.MIN_PASSWORD_LENGTH - && $('#admin-password').val() != '') { + && $('#admin-password').val() != '') { $('#admin-password, #admin-password-confirm').closest('.form-group').addClass('has-error'); throw EALang.password_length_notice.replace('$number', BackendUsers.MIN_PASSWORD_LENGTH); } @@ -274,13 +274,13 @@ } // Check if username exists - if ($('#admin-username').attr('already-exists') == 'true') { + if ($('#admin-username').attr('already-exists') == 'true') { $('#admin-username').closest('.form-group').addClass('has-error'); throw EALang.username_already_exists; } return true; - } catch(message) { + } catch (message) { $('#admins .form-message') .addClass('alert-danger') .text(message) @@ -292,7 +292,7 @@ /** * Resets the admin form back to its initial state. */ - AdminsHelper.prototype.resetForm = function() { + AdminsHelper.prototype.resetForm = function () { $('#admins .add-edit-delete-group').show(); $('#admins .save-cancel-group').hide(); $('#admins .record-details').find('input, textarea').prop('readonly', true); @@ -313,7 +313,7 @@ * * @param {Object} admin Contains the admin record data. */ - AdminsHelper.prototype.display = function(admin) { + AdminsHelper.prototype.display = function (admin) { $('#admin-id').val(admin.id); $('#admin-first-name').val(admin.first_name); $('#admin-last-name').val(admin.last_name); @@ -344,7 +344,7 @@ * @param {Boolean} display (OPTIONAL = false) If true the selected record data are going * to be displayed on the details column (requires a selected record though). */ - AdminsHelper.prototype.filter = function(key, selectId, display) { + AdminsHelper.prototype.filter = function (key, selectId, display) { display = display || false; var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_admins'; @@ -353,7 +353,7 @@ key: key }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -361,7 +361,7 @@ this.filterResults = response; $('#filter-admins .results').html(''); - $.each(response, function(index, admin) { + $.each(response, function (index, admin) { var html = this.getFilterHtml(admin); $('#filter-admins .results').append(html); }.bind(this)); @@ -383,21 +383,21 @@ * * @return {String} The html code that represents the record on the filter results list. */ - AdminsHelper.prototype.getFilterHtml = function(admin) { + AdminsHelper.prototype.getFilterHtml = function (admin) { var name = admin.first_name + ' ' + admin.last_name; var info = admin.email; info = (admin.mobile_number != '' && admin.mobile_number != null) - ? info + ', ' + admin.mobile_number : info; + ? info + ', ' + admin.mobile_number : info; info = (admin.phone_number != '' && admin.phone_number != null) - ? info + ', ' + admin.phone_number : info; + ? info + ', ' + admin.phone_number : info; var html = - '
' + - '' + name + '
' + - info + '
' + - '

'; + '
' + + '' + name + '
' + + info + '
' + + '

'; return html; }; @@ -410,12 +410,12 @@ * @param {Boolean} display Optional (false), if true then the method will display the record * on the form. */ - AdminsHelper.prototype.select = function(id, display) { + AdminsHelper.prototype.select = function (id, display) { display = display || false; $('#filter-admins .selected').removeClass('selected'); - $('.admin-row').each(function() { + $('.admin-row').each(function () { if ($(this).attr('data-id') == id) { $(this).addClass('selected'); return false; @@ -423,7 +423,7 @@ }); if (display) { - $.each(this.filterResults, function(index, admin) { + $.each(this.filterResults, function (index, admin) { if (admin.id == id) { this.display(admin); $('#edit-admin, #delete-admin').prop('disabled', false); diff --git a/src/assets/js/backend_users_providers.js b/src/assets/js/backend_users_providers.js index 731e6841..13f47df8 100644 --- a/src/assets/js/backend_users_providers.js +++ b/src/assets/js/backend_users_providers.js @@ -9,7 +9,7 @@ * @since v1.0.0 * ---------------------------------------------------------------------------- */ -(function() { +(function () { 'use strict'; @@ -22,20 +22,20 @@ * * @class ProvidersHelper */ - var ProvidersHelper = function() { + var ProvidersHelper = function () { this.filterResults = {}; // Store the results for later use. }; /** * Bind the event handlers for the backend/users "Providers" tab. */ - ProvidersHelper.prototype.bindEventHandlers = function() { + ProvidersHelper.prototype.bindEventHandlers = function () { /** * Event: Filter Providers Form "Submit" * * Filter the provider records with the given key string. */ - $('#providers').on('submit', '#filter-providers form', function() { + $('#providers').on('submit', '#filter-providers form', function () { var key = $('#filter-providers .key').val(); $('.selected').removeClass('selected'); this.resetForm(); @@ -46,7 +46,7 @@ /** * Event: Clear Filter Button "Click" */ - $('#providers').on('click', '#filter-providers .clear', function() { + $('#providers').on('click', '#filter-providers .clear', function () { this.filter(''); $('#filter-providers .key').val(''); this.resetForm(); @@ -57,7 +57,7 @@ * * Display the selected provider data to the user. */ - $('#providers').on('click', '.provider-row', function(e) { + $('#providers').on('click', '.provider-row', function (e) { if ($('#filter-providers .filter').prop('disabled')) { $('#filter-providers .results').css('color', '#AAA'); return; // Exit because we are currently on edit mode. @@ -66,7 +66,7 @@ var providerId = $(e.currentTarget).attr('data-id'); var provider = {}; - $.each(this.filterResults, function(index, item) { + $.each(this.filterResults, function (index, item) { if (item.id === providerId) { provider = item; return false; @@ -82,7 +82,7 @@ /** * Event: Add New Provider Button "Click" */ - $('#providers').on('click', '#add-provider', function() { + $('#providers').on('click', '#add-provider', function () { this.resetForm(); $('#filter-providers button').prop('disabled', true); $('#filter-providers .results').css('color', '#AAA'); @@ -104,7 +104,7 @@ /** * Event: Edit Provider Button "Click" */ - $('#providers').on('click', '#edit-provider', function() { + $('#providers').on('click', '#edit-provider', function () { $('#providers .add-edit-delete-group').hide(); $('#providers .save-cancel-group').show(); $('#filter-providers button').prop('disabled', true); @@ -122,33 +122,33 @@ /** * Event: Delete Provider Button "Click" */ - $('#providers').on('click', '#delete-provider', function() { + $('#providers').on('click', '#delete-provider', function () { var providerId = $('#provider-id').val(); var buttons = [ { text: EALang.delete, - click: function() { + click: function () { this.delete(providerId); $('#message_box').dialog('close'); }.bind(this) }, { text: EALang.cancel, - click: function() { + click: function () { $('#message_box').dialog('close'); } } ]; GeneralFunctions.displayMessageBox(EALang.delete_provider, - EALang.delete_record_prompt, buttons); + EALang.delete_record_prompt, buttons); }.bind(this)); /** * Event: Save Provider Button "Click" */ - $('#providers').on('click', '#save-provider', function() { + $('#providers').on('click', '#save-provider', function () { var provider = { first_name: $('#provider-first-name').val(), last_name: $('#provider-last-name').val(), @@ -170,7 +170,7 @@ // Include provider services. provider.services = []; - $('#provider-services input:checkbox').each(function() { + $('#provider-services input:checkbox').each(function () { if ($(this).prop('checked')) { provider.services.push($(this).attr('data-id')); } @@ -198,7 +198,7 @@ * * Cancel add or edit of an provider record. */ - $('#providers').on('click', '#cancel-provider', function() { + $('#providers').on('click', '#cancel-provider', function () { var id = $('#filter-providers .selected').attr('data-id'); this.resetForm(); if (id != '') { @@ -209,10 +209,10 @@ /** * Event: Display Provider Details "Click" */ - $('#providers').on('click', '.display-details', function() { + $('#providers').on('click', '.display-details', function () { $('#providers .switch-view .current').removeClass('current'); $(this).addClass('current'); - $('.working-plan-view').hide('fade', function() { + $('.working-plan-view').hide('fade', function () { $('.details-view').show('fade'); }); }); @@ -220,10 +220,10 @@ /** * Event: Display Provider Working Plan "Click" */ - $('#providers').on('click', '.display-working-plan', function() { + $('#providers').on('click', '.display-working-plan', function () { $('#providers .switch-view .current').removeClass('current'); $(this).addClass('current'); - $('.details-view').hide('fade', function() { + $('.details-view').hide('fade', function () { $('.working-plan-view').show('fade'); }); }); @@ -231,7 +231,7 @@ /** * Event: Reset Working Plan Button "Click". */ - $('#providers').on('click', '#reset-working-plan', function() { + $('#providers').on('click', '#reset-working-plan', function () { $('.breaks tbody').empty(); $('.work-start, .work-end').val(''); BackendUsers.wp.setup(GlobalVariables.workingPlan); @@ -245,14 +245,14 @@ * @param {Object} provider Contains the admin record data. If an 'id' value is provided * then the update operation is going to be executed. */ - ProvidersHelper.prototype.save = function(provider) { + ProvidersHelper.prototype.save = function (provider) { var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_provider'; var postData = { csrfToken: GlobalVariables.csrfToken, provider: JSON.stringify(provider) }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -268,14 +268,14 @@ * * @param {Number} id Record id to be deleted. */ - ProvidersHelper.prototype.delete = function(id) { + ProvidersHelper.prototype.delete = function (id) { var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_provider'; var postData = { csrfToken: GlobalVariables.csrfToken, provider_id: id }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -290,13 +290,13 @@ * * @return {Boolean} Returns the validation result. */ - ProvidersHelper.prototype.validate = function() { + ProvidersHelper.prototype.validate = function () { $('#providers .has-error').removeClass('has-error'); try { // Validate required fields. var missingRequired = false; - $('#providers .required').each(function() { + $('#providers .required').each(function () { if ($(this).val() == '' || $(this).val() == undefined) { $(this).closest('.form-group').addClass('has-error'); missingRequired = true; @@ -313,7 +313,7 @@ } if ($('#provider-password').val().length < BackendUsers.MIN_PASSWORD_LENGTH - && $('#provider-password').val() != '') { + && $('#provider-password').val() != '') { $('#provider-password, #provider-password-confirm').closest('.form-group').addClass('has-error'); throw EALang.password_length_notice.replace('$number', BackendUsers.MIN_PASSWORD_LENGTH); } @@ -325,13 +325,13 @@ } // Check if username exists - if ($('#provider-username').attr('already-exists') == 'true') { + if ($('#provider-username').attr('already-exists') == 'true') { $('#provider-username').closest('.form-group').addClass('has-error'); throw EALang.username_already_exists; } return true; - } catch(message) { + } catch (message) { $('#providers .form-message') .addClass('alert-danger') .text(message) @@ -343,7 +343,7 @@ /** * Resets the admin tab form back to its initial state. */ - ProvidersHelper.prototype.resetForm = function() { + ProvidersHelper.prototype.resetForm = function () { $('#filter-providers .selected').removeClass('selected'); $('#filter-providers button').prop('disabled', false); $('#filter-providers .results').css('color', ''); @@ -376,7 +376,7 @@ * * @param {Object} provider Contains the provider record data. */ - ProvidersHelper.prototype.display = function(provider) { + ProvidersHelper.prototype.display = function (provider) { $('#provider-id').val(provider.id); $('#provider-first-name').val(provider.first_name); $('#provider-last-name').val(provider.last_name); @@ -398,7 +398,7 @@ } // Add dedicated provider link. - var dedicatedUrl = GlobalVariables.baseUrl + '/index.php?provider=' + encodeURIComponent(provider.id); + var dedicatedUrl = GlobalVariables.baseUrl + '/index.php?provider=' + encodeURIComponent(provider.id); var linkHtml = ''; $('#providers .details-view h3') .find('a') @@ -408,13 +408,13 @@ $('#provider-services a').remove(); $('#provider-services input:checkbox').prop('checked', false); - $.each(provider.services, function(index, serviceId) { - $('#provider-services input:checkbox').each(function() { + $.each(provider.services, function (index, serviceId) { + $('#provider-services input:checkbox').each(function () { if ($(this).attr('data-id') == serviceId) { $(this).prop('checked', true); // Add dedicated service-provider link. - dedicatedUrl = GlobalVariables.baseUrl + '/index.php?provider=' + encodeURIComponent(provider.id) - + '&service=' + encodeURIComponent(serviceId); + dedicatedUrl = GlobalVariables.baseUrl + '/index.php?provider=' + encodeURIComponent(provider.id) + + '&service=' + encodeURIComponent(serviceId); linkHtml = ''; $(this).parent().append(linkHtml); } @@ -435,7 +435,7 @@ * @param {numeric} selectId Optional, if set, when the function is complete a result row can be set as selected. * @param {bool} display Optional (false), if true the selected record will be also displayed. */ - ProvidersHelper.prototype.filter = function(key, selectId, display) { + ProvidersHelper.prototype.filter = function (key, selectId, display) { display = display || false; var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_providers'; @@ -444,7 +444,7 @@ key: key }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -452,7 +452,7 @@ this.filterResults = response; $('#filter-providers .results').html(''); - $.each(response, function(index, provider) { + $.each(response, function (index, provider) { var html = this.getFilterHtml(provider); $('#filter-providers .results').append(html); }.bind(this)); @@ -474,21 +474,21 @@ * * @return {String} The html code that represents the record on the filter results list. */ - ProvidersHelper.prototype.getFilterHtml = function(provider) { + ProvidersHelper.prototype.getFilterHtml = function (provider) { var name = provider.first_name + ' ' + provider.last_name, - info = provider.email; + info = provider.email; info = (provider.mobile_number != '' && provider.mobile_number != null) - ? info + ', ' + provider.mobile_number : info; + ? info + ', ' + provider.mobile_number : info; info = (provider.phone_number != '' && provider.phone_number != null) - ? info + ', ' + provider.phone_number : info; + ? info + ', ' + provider.phone_number : info; var html = - '
' + - '' + name + '
' + - info + '
' + - '

'; + '
' + + '' + name + '
' + + info + '
' + + '

'; return html; }; @@ -498,7 +498,7 @@ * * @param {Object} $selector The cells to be initialized. */ - ProvidersHelper.prototype.editableBreakDay = function($selector) { + ProvidersHelper.prototype.editableBreakDay = function ($selector) { var weekDays = {}; weekDays[EALang.monday] = 'Monday'; weekDays[EALang.tuesday] = 'Tuesday'; @@ -509,7 +509,7 @@ weekDays[EALang.sunday] = 'Sunday'; - $selector.editable(function(value, settings) { + $selector.editable(function (value, settings) { return value; }, { type: 'select', @@ -519,12 +519,12 @@ submit: '', cancel: '', onblur: 'ignore', - onreset: function(settings, td) { + onreset: function (settings, td) { if (!BackendUsers.enableCancel) { return false; // disable ESC button } }, - onsubmit: function(settings, td) { + onsubmit: function (settings, td) { if (!BackendUsers.enableSubmit) { return false; // disable Enter button } @@ -537,8 +537,8 @@ * * @param {jQuery} $selector The cells to be initialized. */ - ProvidersHelper.prototype.editableBreakTime = function($selector) { - $selector.editable(function(value, settings) { + ProvidersHelper.prototype.editableBreakTime = function ($selector) { + $selector.editable(function (value, settings) { // Do not return the value because the user needs to press the "Save" button. return value; }, { @@ -547,12 +547,12 @@ submit: '', cancel: '', onblur: 'ignore', - onreset: function(settings, td) { + onreset: function (settings, td) { if (!BackendUsers.enableCancel) { return false; // disable ESC button } }, - onsubmit: function(settings, td) { + onsubmit: function (settings, td) { if (!BackendUsers.enableSubmit) { return false; // disable Enter button } @@ -566,11 +566,11 @@ * @param {Number} id Record id to be selected. * @param {Boolean} display Optional (false), if true the record will be displayed on the form. */ - ProvidersHelper.prototype.select = function(id, display) { + ProvidersHelper.prototype.select = function (id, display) { display = display || false; // Select record in filter results. - $('#filter-providers .provider-row').each(function() { + $('#filter-providers .provider-row').each(function () { if ($(this).attr('data-id') == id) { $(this).addClass('selected'); return false; @@ -579,7 +579,7 @@ // Display record in form (if display = true). if (display) { - $.each(this.filterResults, function(index, provider) { + $.each(this.filterResults, function (index, provider) { if (provider.id == id) { this.display(provider); $('#edit-provider, #delete-provider').prop('disabled', false); diff --git a/src/assets/js/backend_users_secretaries.js b/src/assets/js/backend_users_secretaries.js index 99d09673..d51bb327 100644 --- a/src/assets/js/backend_users_secretaries.js +++ b/src/assets/js/backend_users_secretaries.js @@ -9,7 +9,7 @@ * @since v1.0.0 * ---------------------------------------------------------------------------- */ -(function() { +(function () { 'use strict'; @@ -22,20 +22,20 @@ * * @class SecretariesHelper */ - var SecretariesHelper = function() { + var SecretariesHelper = function () { this.filterResults = {}; // Store the results for later use. }; /** * Bind the event handlers for the backend/users "Secretaries" tab. */ - SecretariesHelper.prototype.bindEventHandlers = function() { + SecretariesHelper.prototype.bindEventHandlers = function () { /** * Event: Filter Secretaries Form "Submit" * * Filter the secretary records with the given key string. */ - $('#secretaries').on('submit', '#filter-secretaries form', function() { + $('#secretaries').on('submit', '#filter-secretaries form', function () { var key = $('#filter-secretaries .key').val(); $('#filter-secretaries .selected').removeClass('selected'); this.resetForm(); @@ -46,7 +46,7 @@ /** * Event: Clear Filter Results Button "Click" */ - $('#secretaries').on('click', '#filter-secretaries .clear', function() { + $('#secretaries').on('click', '#filter-secretaries .clear', function () { this.filter(''); $('#filter-secretaries .key').val(''); this.resetForm(); @@ -57,7 +57,7 @@ * * Display the selected secretary data to the user. */ - $('#secretaries').on('click', '.secretary-row', function(e) { + $('#secretaries').on('click', '.secretary-row', function (e) { if ($('#filter-secretaries .filter').prop('disabled')) { $('#filter-secretaries .results').css('color', '#AAA'); return; // exit because we are currently on edit mode @@ -66,7 +66,7 @@ var secretaryId = $(e.currentTarget).attr('data-id'); var secretary = {}; - $.each(this.filterResults, function(index, item) { + $.each(this.filterResults, function (index, item) { if (item.id === secretaryId) { secretary = item; return false; @@ -83,7 +83,7 @@ /** * Event: Add New Secretary Button "Click" */ - $('#secretaries').on('click', '#add-secretary', function() { + $('#secretaries').on('click', '#add-secretary', function () { this.resetForm(); $('#filter-secretaries button').prop('disabled', true); $('#filter-secretaries .results').css('color', '#AAA'); @@ -100,7 +100,7 @@ /** * Event: Edit Secretary Button "Click" */ - $('#secretaries').on('click', '#edit-secretary', function() { + $('#secretaries').on('click', '#edit-secretary', function () { $('#filter-secretaries button').prop('disabled', true); $('#filter-secretaries .results').css('color', '#AAA'); $('#secretaries .add-edit-delete-group').hide(); @@ -115,32 +115,32 @@ /** * Event: Delete Secretary Button "Click" */ - $('#secretaries').on('click', '#delete-secretary', function() { + $('#secretaries').on('click', '#delete-secretary', function () { var secretaryId = $('#secretary-id').val(); var buttons = [ { text: EALang.delete, - click: function() { + click: function () { this.delete(secretaryId); $('#message_box').dialog('close'); }.bind(this) }, { text: EALang.cancel, - click: function() { + click: function () { $('#message_box').dialog('close'); } } ]; GeneralFunctions.displayMessageBox(EALang.delete_secretary, - EALang.delete_record_prompt, buttons); + EALang.delete_record_prompt, buttons); }.bind(this)); /** * Event: Save Secretary Button "Click" */ - $('#secretaries').on('click', '#save-secretary', function() { + $('#secretaries').on('click', '#save-secretary', function () { var secretary = { first_name: $('#secretary-first-name').val(), last_name: $('#secretary-last-name').val(), @@ -161,7 +161,7 @@ // Include secretary services. secretary.providers = []; - $('#secretary-providers input:checkbox').each(function() { + $('#secretary-providers input:checkbox').each(function () { if ($(this).prop('checked')) { secretary.providers.push($(this).attr('data-id')); } @@ -189,7 +189,7 @@ * * Cancel add or edit of an secretary record. */ - $('#secretaries').on('click', '#cancel-secretary', function() { + $('#secretaries').on('click', '#cancel-secretary', function () { var id = $('#secretary-id').val(); this.resetForm(); if (id != '') { @@ -204,14 +204,14 @@ * @param {Object} secretary Contains the admin record data. If an 'id' value is provided * then the update operation is going to be executed. */ - SecretariesHelper.prototype.save = function(secretary) { + SecretariesHelper.prototype.save = function (secretary) { var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_secretary'; var postData = { csrfToken: GlobalVariables.csrfToken, secretary: JSON.stringify(secretary) }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -227,14 +227,14 @@ * * @param {Number} id Record id to be deleted. */ - SecretariesHelper.prototype.delete = function(id) { + SecretariesHelper.prototype.delete = function (id) { var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_secretary'; var postData = { csrfToken: GlobalVariables.csrfToken, secretary_id: id }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -249,14 +249,14 @@ * * @return {Boolean} Returns the validation result. */ - SecretariesHelper.prototype.validate = function() { + SecretariesHelper.prototype.validate = function () { $('#secretaries .has-error').removeClass('has-error'); $('#secretaries .form-message').removeClass('alert-danger'); try { // Validate required fields. var missingRequired = false; - $('#secretaries .required').each(function() { + $('#secretaries .required').each(function () { if ($(this).val() == '' || $(this).val() == undefined) { $(this).closest('.form-group').addClass('has-error'); missingRequired = true; @@ -273,10 +273,10 @@ } if ($('#secretary-password').val().length < BackendUsers.MIN_PASSWORD_LENGTH - && $('#secretary-password').val() != '') { + && $('#secretary-password').val() != '') { $('#secretary-password, #secretary-password-confirm').closest('.form-group').addClass('has-error'); throw 'Password must be at least ' + BackendUsers.MIN_PASSWORD_LENGTH - + ' characters long.'; + + ' characters long.'; } // Validate user email. @@ -286,13 +286,13 @@ } // Check if username exists - if ($('#secretary-username').attr('already-exists') == 'true') { + if ($('#secretary-username').attr('already-exists') == 'true') { $('#secretary-username').closest('.form-group').addClass('has-error'); throw 'Username already exists.'; } return true; - } catch(message) { + } catch (message) { $('#secretaries .form-message') .addClass('alert-danger') .text(message) @@ -304,7 +304,7 @@ /** * Resets the admin tab form back to its initial state. */ - SecretariesHelper.prototype.resetForm = function() { + SecretariesHelper.prototype.resetForm = function () { $('#secretaries .record-details').find('input, textarea').val(''); $('#secretaries .add-edit-delete-group').show(); $('#secretaries .save-cancel-group').hide(); @@ -328,7 +328,7 @@ * * @param {Object} secretary Contains the secretary record data. */ - SecretariesHelper.prototype.display = function(secretary) { + SecretariesHelper.prototype.display = function (secretary) { $('#secretary-id').val(secretary.id); $('#secretary-first-name').val(secretary.first_name); $('#secretary-last-name').val(secretary.last_name); @@ -350,8 +350,8 @@ } $('#secretary-providers input:checkbox').prop('checked', false); - $.each(secretary.providers, function(index, providerId) { - $('#secretary-providers input:checkbox').each(function() { + $.each(secretary.providers, function (index, providerId) { + $('#secretary-providers input:checkbox').each(function () { if ($(this).attr('data-id') == providerId) { $(this).prop('checked', true); } @@ -367,7 +367,7 @@ * (only selected, not displayed). * @param {Bool} display Optional (false). */ - SecretariesHelper.prototype.filter = function(key, selectId, display) { + SecretariesHelper.prototype.filter = function (key, selectId, display) { display = display || false; var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_secretaries'; @@ -376,7 +376,7 @@ key: key }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -384,7 +384,7 @@ this.filterResults = response; $('#filter-secretaries .results').html(''); - $.each(response, function(index, secretary) { + $.each(response, function (index, secretary) { var html = this.getFilterHtml(secretary); $('#filter-secretaries .results').append(html); }.bind(this)); @@ -406,21 +406,21 @@ * * @return {String} The html code that represents the record on the filter results list. */ - SecretariesHelper.prototype.getFilterHtml = function(secretary) { + SecretariesHelper.prototype.getFilterHtml = function (secretary) { var name = secretary.first_name + ' ' + secretary.last_name; var info = secretary.email; info = (secretary.mobile_number != '' && secretary.mobile_number != null) - ? info + ', ' + secretary.mobile_number : info; + ? info + ', ' + secretary.mobile_number : info; info = (secretary.phone_number != '' && secretary.phone_number != null) - ? info + ', ' + secretary.phone_number : info; + ? info + ', ' + secretary.phone_number : info; var html = - '
' + - '' + name + '
' + - info + '
' + - '

'; + '
' + + '' + name + '
' + + info + '
' + + '

'; return html; }; @@ -432,12 +432,12 @@ * @param {Number} id The record id to be selected from the filter results. * @param {Boolean} display Optional (false), if true the method will display the record in the form. */ - SecretariesHelper.prototype.select = function(id, display) { + SecretariesHelper.prototype.select = function (id, display) { display = display || false; $('#filter-secretaries .selected').removeClass('selected'); - $('#filter-secretaries .secretary-row').each(function() { + $('#filter-secretaries .secretary-row').each(function () { if ($(this).attr('data-id') == id) { $(this).addClass('selected'); return false; @@ -445,7 +445,7 @@ }); if (display) { - $.each(this.filterResults, function(index, admin) { + $.each(this.filterResults, function (index, admin) { if (admin.id == id) { this.display(admin); $('#edit-secretary, #delete-secretary').prop('disabled', false); diff --git a/src/assets/js/frontend_book.js b/src/assets/js/frontend_book.js index 80fa8c29..7e06d6cb 100644 --- a/src/assets/js/frontend_book.js +++ b/src/assets/js/frontend_book.js @@ -20,7 +20,7 @@ window.FrontendBook = window.FrontendBook || {}; * * @module FrontendBook */ -(function(exports) { +(function (exports) { 'use strict'; @@ -39,12 +39,13 @@ window.FrontendBook = window.FrontendBook || {}; * @param {Boolean} manageMode (OPTIONAL) Determines whether the customer is going * to make changes to an existing appointment rather than booking a new one. */ - exports.initialize = function(bindEventHandlers, manageMode) { + exports.initialize = function (bindEventHandlers, manageMode) { bindEventHandlers = bindEventHandlers || true; manageMode = manageMode || false; if (window.console === undefined) { - window.console = function() {}; // IE compatibility + window.console = function () { + }; // IE compatibility } FrontendBook.manageMode = manageMode; @@ -67,33 +68,33 @@ window.FrontendBook = window.FrontendBook || {}; defaultDate: Date.today(), dayNames: [ - EALang.sunday, EALang.monday, EALang.tuesday, EALang.wednesday, - EALang.thursday, EALang.friday, EALang.saturday], - dayNamesShort: [EALang.sunday.substr(0,3), EALang.monday.substr(0,3), - EALang.tuesday.substr(0,3), EALang.wednesday.substr(0,3), - EALang.thursday.substr(0,3), EALang.friday.substr(0,3), - EALang.saturday.substr(0,3)], - dayNamesMin: [EALang.sunday.substr(0,2), EALang.monday.substr(0,2), - EALang.tuesday.substr(0,2), EALang.wednesday.substr(0,2), - EALang.thursday.substr(0,2), EALang.friday.substr(0,2), - EALang.saturday.substr(0,2)], + EALang.sunday, EALang.monday, EALang.tuesday, EALang.wednesday, + EALang.thursday, EALang.friday, EALang.saturday], + dayNamesShort: [EALang.sunday.substr(0, 3), EALang.monday.substr(0, 3), + EALang.tuesday.substr(0, 3), EALang.wednesday.substr(0, 3), + EALang.thursday.substr(0, 3), EALang.friday.substr(0, 3), + EALang.saturday.substr(0, 3)], + dayNamesMin: [EALang.sunday.substr(0, 2), EALang.monday.substr(0, 2), + EALang.tuesday.substr(0, 2), EALang.wednesday.substr(0, 2), + EALang.thursday.substr(0, 2), EALang.friday.substr(0, 2), + EALang.saturday.substr(0, 2)], monthNames: [EALang.january, EALang.february, EALang.march, EALang.april, - EALang.may, EALang.june, EALang.july, EALang.august, EALang.september, - EALang.october, EALang.november, EALang.december], + EALang.may, EALang.june, EALang.july, EALang.august, EALang.september, + EALang.october, EALang.november, EALang.december], prevText: EALang.previous, nextText: EALang.next, currentText: EALang.now, closeText: EALang.close, - onSelect: function(dateText, instance) { + onSelect: function (dateText, instance) { FrontendBookApi.getAvailableHours($(this).datepicker('getDate').toString('yyyy-MM-dd')); FrontendBook.updateConfirmFrame(); }, - onChangeMonthYear: function(year, month, instance) { + onChangeMonthYear: function (year, month, instance) { var currentDate = new Date(year, month - 1, 1); FrontendBookApi.getUnavailableDates($('#select-provider').val(), $('#select-service').val(), - currentDate.toString('yyyy-MM-dd')); + currentDate.toString('yyyy-MM-dd')); } }); @@ -105,10 +106,10 @@ window.FrontendBook = window.FrontendBook || {}; // If the manage mode is true, the appointments data should be loaded by default. if (FrontendBook.manageMode) { _applyAppointmentData(GlobalVariables.appointmentData, - GlobalVariables.providerData, GlobalVariables.customerData); + GlobalVariables.providerData, GlobalVariables.customerData); } else { var $selectProvider = $('#select-provider'); - var $selectService = $('#select-service'); + var $selectService = $('#select-service'); // Check if a specific service was selected (via URL parameter). var selectedServiceId = GeneralFunctions.getUrlParameter(location.href, 'service'); @@ -121,11 +122,11 @@ window.FrontendBook = window.FrontendBook || {}; // Check if a specific provider was selected. var selectedProviderId = GeneralFunctions.getUrlParameter(location.href, 'provider'); - + if (selectedProviderId && $selectProvider.find('option[value="' + selectedProviderId + '"]').length === 0) { // Select a service of this provider in order to make the provider available in the select box. for (var index in GlobalVariables.availableProviders) { - var provider = GlobalVariables.availableProviders[index]; + var provider = GlobalVariables.availableProviders[index]; if (provider.id === selectedProviderId && provider.services.length > 0) { $selectService @@ -153,9 +154,9 @@ window.FrontendBook = window.FrontendBook || {}; * * Whenever the provider changes the available appointment date - time periods must be updated. */ - $('#select-provider').change(function() { + $('#select-provider').change(function () { FrontendBookApi.getUnavailableDates($(this).val(), $('#select-service').val(), - $('#select-date').datepicker('getDate').toString('yyyy-MM-dd')); + $('#select-date').datepicker('getDate').toString('yyyy-MM-dd')); FrontendBook.updateConfirmFrame(); }); @@ -165,18 +166,18 @@ window.FrontendBook = window.FrontendBook || {}; * When the user clicks on a service, its available providers should * become visible. */ - $('#select-service').change(function() { + $('#select-service').change(function () { var currServiceId = $('#select-service').val(); $('#select-provider').empty(); - $.each(GlobalVariables.availableProviders, function(indexProvider, provider) { - $.each(provider.services, function(indexService, serviceId) { + $.each(GlobalVariables.availableProviders, function (indexProvider, provider) { + $.each(provider.services, function (indexService, serviceId) { // If the current provider is able to provide the selected service, // add him to the listbox. if (serviceId == currServiceId) { var optionHtml = ''; + + provider.first_name + ' ' + provider.last_name + + ''; $('#select-provider').append(optionHtml); } }); @@ -188,9 +189,9 @@ window.FrontendBook = window.FrontendBook || {}; } FrontendBookApi.getUnavailableDates($('#select-provider').val(), $(this).val(), - $('#select-date').datepicker('getDate').toString('yyyy-MM-dd')); + $('#select-date').datepicker('getDate').toString('yyyy-MM-dd')); FrontendBook.updateConfirmFrame(); - _updateServiceDescription($('#select-service').val(), $('#service-description')); + _updateServiceDescription($('#select-service').val(), $('#service-description')); }); /** @@ -199,7 +200,7 @@ window.FrontendBook = window.FrontendBook || {}; * This handler is triggered every time the user pressed the "next" button on the book wizard. * Some special tasks might be performed, depending the current wizard step. */ - $('.button-next').click(function() { + $('.button-next').click(function () { // If we are on the first step and there is not provider selected do not continue // with the next step. if ($(this).attr('data-step_index') === '1' && $('#select-provider').val() == null) { @@ -212,9 +213,9 @@ window.FrontendBook = window.FrontendBook || {}; if ($('.selected-hour').length == 0) { if ($('#select-hour-prompt').length == 0) { $('#available-hours').append('

' - + '' - + EALang.appointment_hour_missing - + ''); + + '' + + EALang.appointment_hour_missing + + ''); } return; } @@ -233,7 +234,7 @@ window.FrontendBook = window.FrontendBook || {}; // Display the next step tab (uses jquery animation effect). var nextTabIndex = parseInt($(this).attr('data-step_index')) + 1; - $(this).parents().eq(1).hide('fade', function() { + $(this).parents().eq(1).hide('fade', function () { $('.active-step').removeClass('active-step'); $('#step-' + nextTabIndex).addClass('active-step'); $('#wizard-frame-' + nextTabIndex).show('fade'); @@ -246,10 +247,10 @@ window.FrontendBook = window.FrontendBook || {}; * This handler is triggered every time the user pressed the "back" button on the * book wizard. */ - $('.button-back').click(function() { + $('.button-back').click(function () { var prevTabIndex = parseInt($(this).attr('data-step_index')) - 1; - $(this).parents().eq(1).hide('fade', function() { + $(this).parents().eq(1).hide('fade', function () { $('.active-step').removeClass('active-step'); $('#step-' + prevTabIndex).addClass('active-step'); $('#wizard-frame-' + prevTabIndex).show('fade'); @@ -262,7 +263,7 @@ window.FrontendBook = window.FrontendBook || {}; * Triggered whenever the user clicks on an available hour * for his appointment. */ - $('#available-hours').on('click', '.available-hour', function() { + $('#available-hours').on('click', '.available-hour', function () { $('.selected-hour').removeClass('selected-hour'); $(this).addClass('selected-hour'); FrontendBook.updateConfirmFrame(); @@ -278,11 +279,11 @@ window.FrontendBook = window.FrontendBook || {}; * * @param {jQuery.Event} event */ - $('#cancel-appointment').click(function(event) { + $('#cancel-appointment').click(function (event) { var buttons = [ { text: 'OK', - click: function() { + click: function () { if ($('#cancel-reason').val() === '') { $('#cancel-reason').css('border', '2px solid red'); return; @@ -293,14 +294,14 @@ window.FrontendBook = window.FrontendBook || {}; }, { text: EALang.cancel, - click: function() { + click: function () { $('#message_box').dialog('close'); } } ]; GeneralFunctions.displayMessageBox(EALang.cancel_appointment_title, - EALang.write_appointment_removal_reason, buttons); + EALang.write_appointment_removal_reason, buttons); $('#message_box').append(''); $('#cancel-reason').css('width', '100%'); @@ -317,7 +318,7 @@ window.FrontendBook = window.FrontendBook || {}; * * @param {jQuery.Event} event */ - $('#book-appointment-submit').click(function(event) { + $('#book-appointment-submit').click(function (event) { FrontendBookApi.registerAppointment(); }); @@ -326,13 +327,13 @@ window.FrontendBook = window.FrontendBook || {}; * * @param {jQuery.Event} event */ - $('.captcha-title small').click(function(event) { + $('.captcha-title small').click(function (event) { $('.captcha-image').attr('src', GlobalVariables.baseUrl + '/index.php/captcha?' + Date.now()); }); - $('#select-date').on('mousedown', '.ui-datepicker-calendar td', function(event) { - setTimeout(function() { + $('#select-date').on('mousedown', '.ui-datepicker-calendar td', function (event) { + setTimeout(function () { FrontendBookApi.applyPreviousUnavailableDates(); // New jQuery UI version will replace the td elements. }, 300); // There is no draw event unfortunately. }) @@ -350,7 +351,7 @@ window.FrontendBook = window.FrontendBook || {}; try { // Validate required fields. var missingRequiredField = false; - $('.required').each(function() { + $('.required').each(function () { if ($(this).val() == '') { $(this).parents('.form-group').addClass('has-error'); missingRequiredField = true; @@ -367,7 +368,7 @@ window.FrontendBook = window.FrontendBook || {}; } return true; - } catch(exc) { + } catch (exc) { $('#form-message').text(exc); return false; } @@ -377,7 +378,7 @@ window.FrontendBook = window.FrontendBook || {}; * Every time this function is executed, it updates the confirmation page with the latest * customer settings and input for the appointment booking. */ - exports.updateConfirmFrame = function() { + exports.updateConfirmFrame = function () { if ($('.selected-hour').text() === '') { return; } @@ -393,7 +394,7 @@ window.FrontendBook = window.FrontendBook || {}; var servicePrice; var serviceCurrency; - $.each(GlobalVariables.availableServices, function(index, service) { + $.each(GlobalVariables.availableServices, function (index, service) { if (service.id == selServiceId) { servicePrice = '
' + service.price; serviceCurrency = service.currency; @@ -404,11 +405,11 @@ window.FrontendBook = window.FrontendBook || {}; var html = '

' + $('#select-service option:selected').text() + '

' + '

' - + '' - + $('#select-provider option:selected').text() + '
' - + selectedDate + ' ' + $('.selected-hour').text() - + servicePrice + ' ' + serviceCurrency - + '
' + + + '' + + $('#select-provider option:selected').text() + '
' + + selectedDate + ' ' + $('.selected-hour').text() + + servicePrice + ' ' + serviceCurrency + + '
' + '

'; $('#appointment-details').html(html); @@ -425,15 +426,15 @@ window.FrontendBook = window.FrontendBook || {}; html = '

' + firstName + ' ' + lastName + '

' + '

' + - EALang.phone + ': ' + phoneNumber + - '
' + - EALang.email + ': ' + email + - '
' + - EALang.address + ': ' + address + - '
' + - EALang.city + ': ' + city + - '
' + - EALang.zip_code + ': ' + zipCode + + EALang.phone + ': ' + phoneNumber + + '
' + + EALang.email + ': ' + email + + '
' + + EALang.address + ': ' + address + + '
' + + EALang.city + ': ' + city + + '
' + + EALang.zip_code + ': ' + zipCode + '

'; $('#customer-details').html(html); @@ -454,7 +455,7 @@ window.FrontendBook = window.FrontendBook || {}; postData.appointment = { start_datetime: $('#select-date').datepicker('getDate').toString('yyyy-MM-dd') - + ' ' + Date.parse($('.selected-hour').text()).toString('HH:mm') + ':00', + + ' ' + Date.parse($('.selected-hour').text()).toString('HH:mm') + ':00', end_datetime: _calcEndDatetime(), notes: $('#notes').val(), is_unavailable: false, @@ -482,7 +483,7 @@ window.FrontendBook = window.FrontendBook || {}; // Find selected service duration. var selServiceDuration = undefined; - $.each(GlobalVariables.availableServices, function(index, service) { + $.each(GlobalVariables.availableServices, function (index, service) { if (service.id == $('#select-service').val()) { selServiceDuration = service.duration; return false; // Stop searching ... @@ -491,12 +492,12 @@ window.FrontendBook = window.FrontendBook || {}; // Add the duration to the start datetime. var startDatetime = $('#select-date').datepicker('getDate').toString('dd-MM-yyyy') - + ' ' + Date.parse($('.selected-hour').text()).toString('HH:mm'); + + ' ' + Date.parse($('.selected-hour').text()).toString('HH:mm'); startDatetime = Date.parseExact(startDatetime, 'dd-MM-yyyy HH:mm'); var endDatetime = undefined; if (selServiceDuration !== undefined && startDatetime !== null) { - endDatetime = startDatetime.add({ 'minutes' : parseInt(selServiceDuration) }); + endDatetime = startDatetime.add({'minutes': parseInt(selServiceDuration)}); } else { endDatetime = new Date(); } @@ -522,7 +523,7 @@ window.FrontendBook = window.FrontendBook || {}; // Set Appointment Date $('#select-date').datepicker('setDate', - Date.parseExact(appointment.start_datetime, 'yyyy-MM-dd HH:mm:ss')); + Date.parseExact(appointment.start_datetime, 'yyyy-MM-dd HH:mm:ss')); FrontendBookApi.getAvailableHours($('#select-date').val()); // Apply Customer's Data @@ -534,13 +535,13 @@ window.FrontendBook = window.FrontendBook || {}; $('#city').val(customer.city); $('#zip-code').val(customer.zip_code); var appointmentNotes = (appointment.notes !== null) - ? appointment.notes : ''; + ? appointment.notes : ''; $('#notes').val(appointmentNotes); FrontendBook.updateConfirmFrame(); return true; - } catch(exc) { + } catch (exc) { return false; } } @@ -557,7 +558,7 @@ window.FrontendBook = window.FrontendBook || {}; function _updateServiceDescription(serviceId, $div) { var html = ''; - $.each(GlobalVariables.availableServices, function(index, service) { + $.each(GlobalVariables.availableServices, function (index, service) { if (service.id == serviceId) { // Just found the service. html = '' + service.name + ' '; @@ -570,7 +571,7 @@ window.FrontendBook = window.FrontendBook || {}; } if (service.price != '' && service.price != null) { - html += '[' + EALang.price + ' ' + service.price + ' ' + service.currency + ']'; + html += '[' + EALang.price + ' ' + service.price + ' ' + service.currency + ']'; } html += '
'; diff --git a/src/assets/js/frontend_book_api.js b/src/assets/js/frontend_book_api.js index 51bf0fb9..63542f3f 100644 --- a/src/assets/js/frontend_book_api.js +++ b/src/assets/js/frontend_book_api.js @@ -18,7 +18,7 @@ window.FrontendBookApi = window.FrontendBookApi || {}; * * @module FrontendBookApi */ -(function(exports) { +(function (exports) { 'use strict'; @@ -34,12 +34,12 @@ window.FrontendBookApi = window.FrontendBookApi || {}; * * @param {String} selDate The selected date of which the available hours we need to receive. */ - exports.getAvailableHours = function(selDate) { + exports.getAvailableHours = function (selDate) { $('#available-hours').empty(); // Find the selected service duration (it is going to be send within the "postData" object). var selServiceDuration = 15; // Default value of duration (in minutes). - $.each(GlobalVariables.availableServices, function(index, service) { + $.each(GlobalVariables.availableServices, function (index, service) { if (service.id == $('#select-service').val()) { selServiceDuration = service.duration; } @@ -60,7 +60,7 @@ window.FrontendBookApi = window.FrontendBookApi || {}; appointment_id: appointmentId }; - $.post(postUrl, postData, function(response) { + $.post(postUrl, postData, function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -71,23 +71,23 @@ window.FrontendBookApi = window.FrontendBookApi || {}; var currColumn = 1; $('#available-hours').html('
'); - $.each(response, function(index, availableHour) { + $.each(response, function (index, availableHour) { if ((currColumn * 10) < (index + 1)) { currColumn++; $('#available-hours').append('
'); } $('#available-hours div:eq(' + (currColumn - 1) + ')').append( - '' + Date.parse(availableHour).toString('h:mm tt') + '
'); + '' + Date.parse(availableHour).toString('h:mm tt') + '
'); }); if (FrontendBook.manageMode) { // Set the appointment's start time as the default selection. $('.available-hour').removeClass('selected-hour'); - $('.available-hour').filter(function() { + $('.available-hour').filter(function () { return $(this).text() === Date.parseExact( - GlobalVariables.appointmentData.start_datetime, - 'yyyy-MM-dd HH:mm:ss').toString('h:mm tt'); + GlobalVariables.appointmentData.start_datetime, + 'yyyy-MM-dd HH:mm:ss').toString('h:mm tt'); }).addClass('selected-hour'); } else { // Set the first available hour as the default selection. @@ -108,7 +108,7 @@ window.FrontendBookApi = window.FrontendBookApi || {}; * This method will make an ajax call to the appointments controller that will register * the appointment to the database. */ - exports.registerAppointment = function() { + exports.registerAppointment = function () { var $captchaText = $('.captcha-text'); if ($captchaText.length > 0) { @@ -141,7 +141,7 @@ window.FrontendBookApi = window.FrontendBookApi || {}; method: 'post', data: postData, dataType: 'json', - beforeSend: function(jqxhr, settings) { + beforeSend: function (jqxhr, settings) { $layer .appendTo('body') .css({ @@ -155,7 +155,7 @@ window.FrontendBookApi = window.FrontendBookApi || {}; }); } }) - .done(function(response) { + .done(function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { $('.captcha-title small').trigger('click'); return false; @@ -166,7 +166,7 @@ window.FrontendBookApi = window.FrontendBookApi || {}; .text(EALang.captcha_is_wrong + '(' + response.expected_phrase + ')') .fadeTo(400, 1); - setTimeout(function() { + setTimeout(function () { $('#captcha-hint').fadeTo(400, 0); }, 3000); @@ -180,11 +180,11 @@ window.FrontendBookApi = window.FrontendBookApi || {}; window.location.href = GlobalVariables.baseUrl + '/index.php/appointments/book_success/' + response.appointment_id; }) - .fail(function(jqxhr, textStatus, errorThrown) { + .fail(function (jqxhr, textStatus, errorThrown) { $('.captcha-title small').trigger('click'); GeneralFunctions.ajaxFailureHandler(jqxhr, textStatus, errorThrown); }) - .always(function() { + .always(function () { $layer.remove(); }); }; @@ -200,7 +200,7 @@ window.FrontendBookApi = window.FrontendBookApi || {}; * @param {Number} serviceId The selected service ID. * @param {String} selectedDateString Y-m-d value of the selected date. */ - exports.getUnavailableDates = function(providerId, serviceId, selectedDateString) { + exports.getUnavailableDates = function (providerId, serviceId, selectedDateString) { if (processingUnavailabilities) { return; } @@ -219,15 +219,15 @@ window.FrontendBookApi = window.FrontendBookApi || {}; data: data, dataType: 'json' }) - .done(function(response) { + .done(function (response) { unavailableDatesBackup = response; selectedDateStringBackup = selectedDateString; - _applyUnavailableDates(response, selectedDateString, true); + _applyUnavailableDates(response, selectedDateString, true); }) .fail(GeneralFunctions.ajaxFailureHandler); }; - exports.applyPreviousUnavailableDates = function() { + exports.applyPreviousUnavailableDates = function () { _applyUnavailableDates(unavailableDatesBackup, selectedDateStringBackup); }; @@ -241,7 +241,7 @@ window.FrontendBookApi = window.FrontendBookApi || {}; var numberOfDays = new Date(selectedDate.getFullYear(), selectedDate.getMonth() + 1, 0).getDate(); if (setDate) { - for (var i=1; i<=numberOfDays; i++) { + for (var i = 1; i <= numberOfDays; i++) { var currentDate = new Date(selectedDate.getFullYear(), selectedDate.getMonth(), i); if (unavailableDates.indexOf(currentDate.toString('yyyy-MM-dd')) === -1) { $('#select-date').datepicker('setDate', currentDate); @@ -257,7 +257,7 @@ window.FrontendBookApi = window.FrontendBookApi || {}; } // Grey out unavailable dates. - $('#select-date .ui-datepicker-calendar td:not(.ui-datepicker-other-month)').each(function(index, td) { + $('#select-date .ui-datepicker-calendar td:not(.ui-datepicker-other-month)').each(function (index, td) { selectedDate.set({day: index + 1}); if ($.inArray(selectedDate.toString('yyyy-MM-dd'), unavailableDates) != -1) { $(td).addClass('ui-datepicker-unselectable ui-state-disabled'); diff --git a/src/assets/js/frontend_book_success.js b/src/assets/js/frontend_book_success.js index 1671efc4..1b9cad03 100644 --- a/src/assets/js/frontend_book_success.js +++ b/src/assets/js/frontend_book_success.js @@ -9,7 +9,7 @@ * @since v1.0.0 * ---------------------------------------------------------------------------- */ -$(document).ready(function() { +$(document).ready(function () { /** * Event: Add Appointment to Google Calendar "Click" * @@ -17,7 +17,7 @@ $(document).ready(function() { * be added to the "primary" calendar. In order to use the API the javascript client library provided by * Google is necessary. */ - $('#add-to-google-calendar').click(function() { + $('#add-to-google-calendar').click(function () { gapi.client.setApiKey(GlobalVariables.googleApiKey); gapi.auth.authorize({ client_id: GlobalVariables.googleClientId, @@ -46,10 +46,10 @@ $(document).ready(function() { var appointmentData = GlobalVariables.appointmentData; appointmentData.start_datetime = GeneralFunctions.ISODateString( - Date.parseExact(appointmentData.start_datetime, + Date.parseExact(appointmentData.start_datetime, 'yyyy-MM-dd HH:mm:ss')); appointmentData.end_datetime = GeneralFunctions.ISODateString( - Date.parseExact(appointmentData.end_datetime, + Date.parseExact(appointmentData.end_datetime, 'yyyy-MM-dd HH:mm:ss')); // Create a valid Google Calendar API resource for the new event. @@ -66,18 +66,18 @@ $(document).ready(function() { { email: GlobalVariables.providerData.email, displayName: GlobalVariables.providerData.first_name + ' ' - + GlobalVariables.providerData.last_name + + GlobalVariables.providerData.last_name } ] }; - gapi.client.load('calendar', 'v3', function() { + gapi.client.load('calendar', 'v3', function () { var request = gapi.client.calendar.events.insert({ calendarId: 'primary', resource: resource }); - request.execute(function(response) { + request.execute(function (response) { if (response.error) { throw 'Could not add the event to Google Calendar.'; } @@ -85,28 +85,28 @@ $(document).ready(function() { $('#success-frame').append( '

' + '
' + - '

' + EALang.success + '

' + - '

' + - EALang.appointment_added_to_google_calendar + - '
' + - '' + - EALang.view_appointment_in_google_calendar + - '' + - '

' + + '

' + EALang.success + '

' + + '

' + + EALang.appointment_added_to_google_calendar + + '
' + + '' + + EALang.view_appointment_in_google_calendar + + '' + + '

' + '
' ); $('#add-to-google-calendar').hide(); }); }); - } catch(exc) { + } catch (exc) { // The user denied access or something else happened, display corresponding message on the screen. $('#success-frame').append( '
' + - '

' + EALang.oops_something_went_wrong + '

' + - '

' + - EALang.could_not_add_to_google_calendar + - '

' + exc + '
' + - '

' + + '

' + EALang.oops_something_went_wrong + '

' + + '

' + + EALang.could_not_add_to_google_calendar + + '

' + exc + '
' + + '

' + '
'); } } diff --git a/src/assets/js/general_functions.js b/src/assets/js/general_functions.js index 07bfd0ef..869543f7 100644 --- a/src/assets/js/general_functions.js +++ b/src/assets/js/general_functions.js @@ -18,7 +18,7 @@ window.GeneralFunctions = window.GeneralFunctions || {}; * * @module GeneralFunctions */ -(function(exports) { +(function (exports) { 'use strict'; @@ -38,7 +38,7 @@ window.GeneralFunctions = window.GeneralFunctions || {}; * @param {String} message The message of the dialog. * @param {Array} buttons Contains the dialog buttons along with their functions. */ - exports.displayMessageBox = function(title, message, buttons) { + exports.displayMessageBox = function (title, message, buttons) { // Check arguments integrity. if (title == undefined || title == '') { title = ''; @@ -92,12 +92,12 @@ window.GeneralFunctions = window.GeneralFunctions || {}; * * @param {Object} elementHandle The object that is going to be centered. */ - exports.centerElementOnPage = function(elementHandle) { + exports.centerElementOnPage = function (elementHandle) { // Center main frame vertical middle - $(window).resize(function() { + $(window).resize(function () { var elementLeft = ($(window).width() - elementHandle.outerWidth()) / 2; var elementTop = ($(window).height() - elementHandle.outerHeight()) / 2; - elementTop = (elementTop > 0 ) ? elementTop : 20; + elementTop = (elementTop > 0) ? elementTop : 20; elementHandle.css({ position: 'absolute', @@ -118,18 +118,18 @@ window.GeneralFunctions = window.GeneralFunctions || {}; * @return {String} Returns the parameter value. */ - exports.getUrlParameter = function(url, parameterName) { + exports.getUrlParameter = function (url, parameterName) { var parsedUrl = url.substr(url.indexOf('?')).slice(1).split('&'); for (var index in parsedUrl) { - var parsedValue = parsedUrl[index].split('='); + var parsedValue = parsedUrl[index].split('='); if (parsedValue.length === 1 && parsedValue[0] === parameterName) { - return ''; + return ''; } if (parsedValue.length === 2 && parsedValue[0] === parameterName) { - return decodeURIComponent(parsedValue[1]); + return decodeURIComponent(parsedValue[1]); } } @@ -146,17 +146,17 @@ window.GeneralFunctions = window.GeneralFunctions || {}; * @return {String} Returns the transformed string. */ - exports.ISODateString = function(date) { + exports.ISODateString = function (date) { function pad(n) { return n < 10 ? '0' + n : n; } - return date.getUTCFullYear()+'-' - + pad(date.getUTCMonth()+1)+'-' - + pad(date.getUTCDate())+'T' - + pad(date.getUTCHours())+':' - + pad(date.getUTCMinutes())+':' - + pad(date.getUTCSeconds())+'Z'; + return date.getUTCFullYear() + '-' + + pad(date.getUTCMonth() + 1) + '-' + + pad(date.getUTCDate()) + 'T' + + pad(date.getUTCHours()) + ':' + + pad(date.getUTCMinutes()) + ':' + + pad(date.getUTCSeconds()) + 'Z'; }; /** @@ -171,7 +171,7 @@ window.GeneralFunctions = window.GeneralFunctions || {}; * @return {Object} Returns an exact copy of the provided element. */ - exports.clone = function(originalObject) { + exports.clone = function (originalObject) { // Handle the 3 simple types, and null or undefined if (null == originalObject || 'object' != typeof originalObject) return originalObject; @@ -232,24 +232,24 @@ window.GeneralFunctions = window.GeneralFunctions || {}; * * @return {String} Returns the html markup for the exceptions. */ - exports.exceptionsToHtml = function(exceptions) { + exports.exceptionsToHtml = function (exceptions) { var html = - '
' + - '
' + - ''; + '
' + + '
' + + ''; - $.each(exceptions, function(index, exception) { + $.each(exceptions, function (index, exception) { html += - '
' + - '
' + - '
' + exception.message + '
' + - '
' + - '
'; + '
' + + '
' + + '
' + exception.message + '
' + + '
' + + '
'; }); html += '
'; @@ -266,10 +266,10 @@ window.GeneralFunctions = window.GeneralFunctions || {}; * * @return {Array} Returns the parsed js objects. */ - exports.parseExceptions = function(exceptions) { + exports.parseExceptions = function (exceptions) { var parsedExceptions = new Array(); - $.each(exceptions, function(index, exception) { + $.each(exceptions, function (index, exception) { parsedExceptions.push($.parseJSON(exception)); }); @@ -283,7 +283,7 @@ window.GeneralFunctions = window.GeneralFunctions || {}; * * @return {String} Returns the capitalized string. */ - exports.ucaseFirstLetter = function(str){ + exports.ucaseFirstLetter = function (str) { return str.charAt(0).toUpperCase() + str.slice(1); }; @@ -299,7 +299,7 @@ window.GeneralFunctions = window.GeneralFunctions || {}; * @return {Boolean} Returns whether the the ajax callback should continue the execution or * stop, due to critical server exceptions. */ - exports.handleAjaxExceptions = function(response) { + exports.handleAjaxExceptions = function (response) { if (response.exceptions) { response.exceptions = GeneralFunctions.parseExceptions(response.exceptions); GeneralFunctions.displayMessageBox(GeneralFunctions.EXCEPTIONS_TITLE, GeneralFunctions.EXCEPTIONS_MESSAGE); @@ -325,12 +325,12 @@ window.GeneralFunctions = window.GeneralFunctions || {}; * * @param {Object} $element Selected element button for the language selection. */ - exports.enableLanguageSelection = function($element) { - // Select Language + exports.enableLanguageSelection = function ($element) { + // Select Language var html = '
    '; - $.each(availableLanguages, function() { - html += '
  • ' - + GeneralFunctions.ucaseFirstLetter(this) + '
  • '; + $.each(availableLanguages, function () { + html += '
  • ' + + GeneralFunctions.ucaseFirstLetter(this) + '
  • '; }); html += '
'; @@ -343,30 +343,30 @@ window.GeneralFunctions = window.GeneralFunctions || {}; trigger: 'manual' }); - $element.click(function() { - if ($('#language-list').length === 0) { - $(this).popover('show'); - } else { - $(this).popover('hide'); - } + $element.click(function () { + if ($('#language-list').length === 0) { + $(this).popover('show'); + } else { + $(this).popover('hide'); + } $(this).toggleClass('active'); }); - $(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'; + $(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 = { csrfToken: GlobalVariables.csrfToken, - language: $(this).attr('data-language'), + language: $(this).attr('data-language') }; - $.post(postUrl, postData, function(response) { - if (!GeneralFunctions.handleAjaxExceptions(response)) { + $.post(postUrl, postData, function (response) { + if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } - document.location.reload(true); + document.location.reload(true); - }, 'json').fail(GeneralFunctions.ajaxFailureHandler); + }, 'json').fail(GeneralFunctions.ajaxFailureHandler); }); }; @@ -377,10 +377,10 @@ window.GeneralFunctions = window.GeneralFunctions || {}; * @param {String} textStatus * @param {Object} errorThrown */ - exports.ajaxFailureHandler = function(jqxhr, textStatus, errorThrown) { + exports.ajaxFailureHandler = function (jqxhr, textStatus, errorThrown) { var exceptions = [ { - message: 'AJAX Error: ' + errorThrown + $(jqxhr.responseText).text() + message: 'AJAX Error: ' + errorThrown + $(jqxhr.responseText).text() } ]; GeneralFunctions.displayMessageBox(GeneralFunctions.EXCEPTIONS_TITLE, GeneralFunctions.EXCEPTIONS_MESSAGE); @@ -394,7 +394,7 @@ window.GeneralFunctions = window.GeneralFunctions || {}; * * @return {String} Returns the escaped string. */ - exports.escapeHtml = function(str) { + exports.escapeHtml = function (str) { return $('
').text(str).html(); }; @@ -408,11 +408,11 @@ window.GeneralFunctions = window.GeneralFunctions || {}; * @return {String} Returns the formatted date string. */ - exports.formatDate = function(date, dateFormatSetting, addHours) { + exports.formatDate = function (date, dateFormatSetting, addHours) { var format, result; var hours = addHours ? ' h:mm tt' : ''; - switch(dateFormatSetting) { + switch (dateFormatSetting) { case 'DMY': result = Date.parse(date).toString('dd/MM/yyyy' + hours); break; diff --git a/src/assets/js/index.html b/src/assets/js/index.html index c942a79c..423d9d58 100644 --- a/src/assets/js/index.html +++ b/src/assets/js/index.html @@ -1,10 +1,10 @@ - 403 Forbidden + 403 Forbidden

Directory access is forbidden.

- \ No newline at end of file + diff --git a/src/assets/js/installation.js b/src/assets/js/installation.js index 9ec2c8d7..a46751a5 100644 --- a/src/assets/js/installation.js +++ b/src/assets/js/installation.js @@ -9,25 +9,25 @@ * @since v1.0.0 * ---------------------------------------------------------------------------- */ -$(document).ready(function() { +$(document).ready(function () { 'use strict'; var MIN_PASSWORD_LENGTH = 7; var AJAX_SUCCESS = 'SUCCESS'; var AJAX_FAILURE = 'FAILURE'; - $(document).ajaxStart(function() { + $(document).ajaxStart(function () { $('#loading').removeClass('hidden'); }); - $(document).ajaxStop(function() { + $(document).ajaxStop(function () { $('#loading').addClass('hidden'); }); /** * Event: Install Easy!Appointments Button "Click" */ - $('#install').click(function() { + $('#install').click(function () { if (!validate()) { return; } @@ -44,7 +44,7 @@ $(document).ready(function() { type: 'POST', data: postData, dataType: 'json', - success: function(response) { + success: function (response) { if (!GeneralFunctions.handleAjaxExceptions(response)) { return; } @@ -52,18 +52,18 @@ $(document).ready(function() { $('.alert').text('Easy!Appointments has been successfully installed!'); $('.alert').addClass('alert-success'); $('.alert').show(); - setTimeout(function() { + setTimeout(function () { window.location.href = GlobalVariables.baseUrl + '/index.php/backend'; }, 1000); }, - error: function(jqXHR, textStatus, errorThrown) { + error: function (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.' + 'unexpected issue. Please check the browser\'s console for ' + + 'more information.' }) ] }; @@ -87,7 +87,7 @@ $(document).ready(function() { // Check for empty fields. var missingRequired = false; - $('input').each(function() { + $('input').each(function () { if ($(this).val() == '') { $(this).closest('.form-group').addClass('has-error'); missingRequired = true; @@ -166,7 +166,7 @@ $(document).ready(function() { // Validate the base URL setting (must not contain any trailing slash). if (GlobalVariables.baseUrl.slice(-1) === '/') { GeneralFunctions.displayMessageBox('Misconfiguration Detected', 'Please remove any trailing slashes from your ' - + 'BASE_URL setting of the root config.php file and try again.' ); + + 'BASE_URL setting of the root config.php file and try again.'); $('#install') .prop('disabled', true) .fadeTo('0.4'); diff --git a/src/assets/js/working_plan.js b/src/assets/js/working_plan.js index 6fd05007..d0826bc5 100644 --- a/src/assets/js/working_plan.js +++ b/src/assets/js/working_plan.js @@ -9,7 +9,7 @@ * @since v1.0.0 * ---------------------------------------------------------------------------- */ -(function() { +(function () { 'use strict'; @@ -21,7 +21,7 @@ * * @class WorkingPlan */ - var WorkingPlan = function() { + var WorkingPlan = function () { /** * This flag is used when trying to cancel row editing. It is * true only whenever the user presses the cancel button. @@ -44,37 +44,37 @@ * * @param {Object} workingPlan Contains the working hours and breaks for each day of the week. */ - WorkingPlan.prototype.setup = function(workingPlan) { - $.each(workingPlan, function(index, workingDay) { + WorkingPlan.prototype.setup = function (workingPlan) { + $.each(workingPlan, function (index, workingDay) { if (workingDay != null) { $('#' + index).prop('checked', true); $('#' + index + '-start').val(Date.parse(workingDay.start).toString('h:mm tt').toUpperCase()); $('#' + index + '-end').val(Date.parse(workingDay.end).toString('h:mm tt').toUpperCase()); // Add the day's breaks on the breaks table. - $.each(workingDay.breaks, function(i, brk) { + $.each(workingDay.breaks, function (i, brk) { var day = this.convertValueToDay(index); var tr = - '' + - '' + GeneralFunctions.ucaseFirstLetter(day) + '' + - '' + Date.parse(brk.start).toString('h:mm tt').toUpperCase() + '' + - '' + Date.parse(brk.end).toString('h:mm tt').toUpperCase() + '' + - '' + - '' + - '' + - '' + - '' + - '' + - ''; + '' + + '' + GeneralFunctions.ucaseFirstLetter(day) + '' + + '' + Date.parse(brk.start).toString('h:mm tt').toUpperCase() + '' + + '' + Date.parse(brk.end).toString('h:mm tt').toUpperCase() + '' + + '' + + '' + + '' + + '' + + '' + + '' + + ''; $('.breaks tbody').append(tr); }.bind(this)); } else { @@ -96,7 +96,7 @@ * * @param {Object} $selector The jquery selector ready for use. */ - WorkingPlan.prototype.editableBreakDay = function($selector) { + WorkingPlan.prototype.editableBreakDay = function ($selector) { var weekDays = {}; weekDays[EALang.sunday] = EALang.sunday; //'Sunday'; weekDays[EALang.monday] = EALang.monday; //'Monday'; @@ -106,7 +106,7 @@ weekDays[EALang.friday] = EALang.friday; //'Friday'; weekDays[EALang.saturday] = EALang.saturday; //'Saturday'; - $selector.editable(function(value, settings) { + $selector.editable(function (value, settings) { return value; }, { type: 'select', @@ -116,12 +116,12 @@ submit: '', cancel: '', onblur: 'ignore', - onreset: function(settings, td) { + onreset: function (settings, td) { if (!this.enableCancel) { return false; // disable ESC button } }.bind(this), - onsubmit: function(settings, td) { + onsubmit: function (settings, td) { if (!this.enableSubmit) { return false; // disable Enter button } @@ -136,8 +136,8 @@ * * @param {Object} $selector The jquery selector ready for use. */ - WorkingPlan.prototype.editableBreakTime = function($selector) { - $selector.editable(function(value, settings) { + WorkingPlan.prototype.editableBreakTime = function ($selector) { + $selector.editable(function (value, settings) { // Do not return the value because the user needs to press the "Save" button. return value; }, { @@ -146,12 +146,12 @@ submit: '', cancel: '', onblur: 'ignore', - onreset: function(settings, td) { + onreset: function (settings, td) { if (!this.enableCancel) { return false; // disable ESC button } }.bind(this), - onsubmit: function(settings, td) { + onsubmit: function (settings, td) { if (!this.enableSubmit) { return false; // disable Enter button } @@ -162,13 +162,13 @@ /** * Binds the event handlers for the working plan dom elements. */ - WorkingPlan.prototype.bindEventHandlers = function() { + WorkingPlan.prototype.bindEventHandlers = function () { /** * Event: Day Checkbox "Click" * * Enable or disable the time selection for each day. */ - $('.working-plan input:checkbox').click(function() { + $('.working-plan input:checkbox').click(function () { var id = $(this).attr('id'); if ($(this).prop('checked') == true) { @@ -186,27 +186,27 @@ * A new row is added on the table and the user can enter the new break * data. After that he can either press the save or cancel button. */ - $('.add-break').click(function() { + $('.add-break').click(function () { var tr = - '' + - '' + EALang.sunday + '' + - '9:00 AM' + - '10:00 AM' + - '' + - '' + - '' + - '' + - '' + - '' + - ''; + '' + + '' + EALang.sunday + '' + + '9:00 AM' + + '10:00 AM' + + '' + + '' + + '' + + '' + + '' + + '' + + ''; $('.breaks').prepend(tr); // Bind editable and event handlers. @@ -222,10 +222,10 @@ * * Enables the row editing for the "Breaks" table rows. */ - $(document).on('click', '.edit-break', function() { + $(document).on('click', '.edit-break', function () { // Reset previous editable tds var $previousEdt = $(this).closest('table').find('.editable').get(); - $.each($previousEdt, function(index, editable) { + $.each($previousEdt, function (index, editable) { if (editable.reset !== undefined) { editable.reset(); } @@ -257,8 +257,8 @@ * * Removes the current line from the "Breaks" table. */ - $(document).on('click', '.delete-break', function() { - $(this).parent().parent().remove(); + $(document).on('click', '.delete-break', function () { + $(this).parent().parent().remove(); }); /** @@ -268,7 +268,7 @@ * * @param {jQuery.Event} e */ - $(document).on('click', '.cancel-break', function(e) { + $(document).on('click', '.cancel-break', function (e) { var element = e.target; var $modifiedRow = $(element).closest('tr'); this.enableCancel = true; @@ -287,7 +287,7 @@ * * @param {jQuery.Event} e */ - $(document).on('click', '.save-break', function(e) { + $(document).on('click', '.save-break', function (e) { // Break's start time must always be prior to break's end. var element = e.target, $modifiedRow = $(element).closest('tr'), @@ -313,9 +313,9 @@ * * @return {Object} Returns the working plan settings object. */ - WorkingPlan.prototype.get = function() { + WorkingPlan.prototype.get = function () { var workingPlan = {}; - $('.working-plan input:checkbox').each(function(index, checkbox) { + $('.working-plan input:checkbox').each(function (index, checkbox) { var id = $(checkbox).attr('id'); if ($(checkbox).prop('checked') == true) { workingPlan[id] = { @@ -324,7 +324,7 @@ breaks: [] }; - $('.breaks tr').each(function(index, tr) { + $('.breaks tr').each(function (index, tr) { var day = this.convertDayToValue($(tr).find('.break-day').text()); if (day == id) { @@ -337,7 +337,7 @@ }); } - workingPlan[id].breaks.sort(function(break1, break2) { + workingPlan[id].breaks.sort(function (break1, break2) { // We can do a direct string comparison since we have time based on 24 hours clock. return break1.start - break2.start; }); @@ -355,7 +355,7 @@ * * @param {Boolean} disabled (OPTIONAL = false) If true then the timepickers will be disabled. */ - WorkingPlan.prototype.timepickers = function(disabled) { + WorkingPlan.prototype.timepickers = function (disabled) { disabled = disabled || false; if (disabled == false) { @@ -369,7 +369,7 @@ hourText: EALang.hour, minuteText: EALang.minutes, - onSelect: function(datetime, inst) { + onSelect: function (datetime, inst) { // Start time must be earlier than end time. var start = Date.parse($(this).parent().parent().find('.work-start').val()), end = Date.parse($(this).parent().parent().find('.work-end').val()); @@ -387,7 +387,7 @@ /** * Reset the current plan back to the company's default working plan. */ - WorkingPlan.prototype.reset = function() { + WorkingPlan.prototype.reset = function () { }; @@ -396,7 +396,7 @@ * * @param {String} value Day value could be like "monday", "tuesday" etc. */ - WorkingPlan.prototype.convertValueToDay = function(value) { + WorkingPlan.prototype.convertValueToDay = function (value) { switch (value) { case 'sunday': return EALang.sunday; @@ -420,7 +420,7 @@ * * @param {String} value Day value could be like "Monday", "Tuesday" etc. */ - WorkingPlan.prototype.convertDayToValue = function(day) { + WorkingPlan.prototype.convertDayToValue = function (day) { switch (day) { case EALang.sunday: return 'sunday'; diff --git a/src/engine/Api/V1/Parsers/Appointments.php b/src/engine/Api/V1/Parsers/Appointments.php index 10452ea6..fc5352ca 100644 --- a/src/engine/Api/V1/Parsers/Appointments.php +++ b/src/engine/Api/V1/Parsers/Appointments.php @@ -39,22 +39,25 @@ class Appointments implements ParsersInterface { 'googleCalendarId' => $response['id_google_calendar'] !== NULL ? (int)$response['id_google_calendar'] : NULL ]; - if (array_key_exists('provider', $response)) { + if (array_key_exists('provider', $response)) + { $providerParser = new Providers(); $providerParser->encode($response['provider']); - $encodedResponse['provider'] = $response['provider']; + $encodedResponse['provider'] = $response['provider']; } - if (array_key_exists('customer', $response)) { + if (array_key_exists('customer', $response)) + { $customerParser = new Customers(); $customerParser->encode($response['customer']); - $encodedResponse['customer'] = $response['customer']; + $encodedResponse['customer'] = $response['customer']; } - if (array_key_exists('service', $response)) { + if (array_key_exists('service', $response)) + { $serviceParser = new Services(); $serviceParser->encode($response['service']); - $encodedResponse['service'] = $response['service']; + $encodedResponse['service'] = $response['service']; } $response = $encodedResponse; diff --git a/src/engine/Api/V1/Parsers/Providers.php b/src/engine/Api/V1/Parsers/Providers.php index 4510534a..fe967019 100644 --- a/src/engine/Api/V1/Parsers/Providers.php +++ b/src/engine/Api/V1/Parsers/Providers.php @@ -40,11 +40,13 @@ class Providers implements ParsersInterface { 'notes' => $response['notes'], ]; - if (array_key_exists('services', $response)) { + if (array_key_exists('services', $response)) + { $encodedResponse['services'] = $response['services']; } - if (array_key_exists('settings', $response)) { + if (array_key_exists('settings', $response)) + { $encodedResponse['settings'] = [ 'username' => $response['settings']['username'], 'notifications' => filter_var($response['settings']['notifications'], FILTER_VALIDATE_BOOLEAN), diff --git a/src/engine/Api/V1/Processors/Sort.php b/src/engine/Api/V1/Processors/Sort.php index e5d086b7..f303ebcc 100644 --- a/src/engine/Api/V1/Processors/Sort.php +++ b/src/engine/Api/V1/Processors/Sort.php @@ -43,7 +43,8 @@ class Sort implements ProcessorsInterface { if (isset($sort[1])) { $sortDirection2 = substr($sort[1], 0, 1) === '-' ? SORT_DESC : SORT_ASC; - } else + } + else { $sortDirection2 = NULL; } @@ -51,7 +52,8 @@ class Sort implements ProcessorsInterface { if (isset($sort[2])) { $sortDirection3 = substr($sort[2], 0, 1) === '-' ? SORT_DESC : SORT_ASC; - } else + } + else { $sortDirection3 = NULL; }