diff --git a/src/application/views/backend/calendar.php b/src/application/views/backend/calendar.php index d52cfabb..e928f6c8 100644 --- a/src/application/views/backend/calendar.php +++ b/src/application/views/backend/calendar.php @@ -187,6 +187,13 @@ + +
+ +
+ +
+
@@ -253,11 +260,11 @@ - +
- +
diff --git a/src/assets/js/backend_calendar.js b/src/assets/js/backend_calendar.js index b608193e..0b6bdce0 100644 --- a/src/assets/js/backend_calendar.js +++ b/src/assets/js/backend_calendar.js @@ -165,7 +165,8 @@ var BackendCalendar = { $dialog.find('#address').val(customer['address']); $dialog.find('#city').val(customer['city']); $dialog.find('#zip-code').val(customer['zip_code']); - $dialog.find('#notes').val(appointment['notes']); + $dialog.find('#appointment-notes').val(appointment['notes']); + $dialog.find('#customer-notes').val(customer['notes']); $dialog.modal('show'); } @@ -344,7 +345,8 @@ var BackendCalendar = { $dialog.find('#address').val(customer['address']); $dialog.find('#city').val(customer['city']); $dialog.find('#zip-code').val(customer['zip_code']); - $dialog.find('#notes').val(appointment['notes']); + $dialog.find('#appointment-notes').val(appointment['notes']); + $dialog.find('#customer-notes').val(customer['notes']); } else { var unavailable = BackendCalendar.lastFocusedEventData.data; @@ -491,7 +493,7 @@ var BackendCalendar = { 'id_users_provider': $dialog.find('#select-provider').val(), 'start_datetime': startDatetime, 'end_datetime': endDatetime, - 'notes': $dialog.find('#notes').val(), + 'notes': $dialog.find('#appointment-notes').val(), 'is_unavailable': false }; @@ -507,7 +509,8 @@ var BackendCalendar = { 'phone_number': $dialog.find('#phone-number').val(), 'address': $dialog.find('#address').val(), 'city': $dialog.find('#city').val(), - 'zip_code': $dialog.find('#zip-code').val() + 'zip_code': $dialog.find('#zip-code').val(), + 'notes': $dialog.find('#customer-notes').val() }; if ($dialog.find('#customer-id').val() !== '') { @@ -837,6 +840,7 @@ var BackendCalendar = { $('#address').val(c.address); $('#city').val(c.city); $('#zip-code').val(c.zip_code); + $('#customer-code').val(c.notes); return false; } }); @@ -894,7 +898,7 @@ var BackendCalendar = { */ $('#new-customer').click(function() { $('#manage-appointment').find('#customer-id, #first-name, #last-name, #email, ' - + '#phone-number, #address, #city, #zip-code').val(''); + + '#phone-number, #address, #city, #zip-code, #customer-notes').val(''); }); }, diff --git a/src/assets/js/backend_settings.js b/src/assets/js/backend_settings.js index 4c183c6e..69097b4b 100644 --- a/src/assets/js/backend_settings.js +++ b/src/assets/js/backend_settings.js @@ -171,7 +171,7 @@ var BackendSettings = { var postUrl = GlobalVariables.baseUrl + 'backend_api/ajax_validate_username'; var postData = { 'username': $input.val(), - 'record_exists': ($input.parents().eq(2).find('#user-id').val() != '') ? true : false + 'user_id': $input.parents().eq(2).find('#user-id').val() }; $.post(postUrl, postData, function(response) { @@ -182,8 +182,10 @@ var BackendSettings = { if (response == false) { $input.css('border', '2px solid red'); Backend.displayNotification('Username already exists.'); + $input.attr('already-exists', 'true'); } else { $input.css('border', ''); + $input.attr('already-exists', 'false'); } }, 'json'); }); @@ -400,6 +402,11 @@ UserSettings.prototype.validate = function() { throw 'Invalid email address!'; } + if ($('#username').attr('already-exists') === 'true') { + $('#username').css('border', '2px solid red'); + throw 'Username already exists.'; + } + return true; } catch(exc) { Backend.displayNotification(exc);