diff --git a/assets/css/general.css b/assets/css/general.css
index b4c65a6a..d5e0e39a 100644
--- a/assets/css/general.css
+++ b/assets/css/general.css
@@ -395,3 +395,11 @@ li.language:hover {
#message_box pre {
max-height: 250px;
}
+
+body .popover-content strong {
+ min-width: 80px; display:inline-block;
+}
+
+body .popover-content button {
+ margin-right: 10px;
+}
diff --git a/assets/js/backend_calendar_appointments_modal.js b/assets/js/backend_calendar_appointments_modal.js
index 81e8e593..a7e1f632 100755
--- a/assets/js/backend_calendar_appointments_modal.js
+++ b/assets/js/backend_calendar_appointments_modal.js
@@ -187,9 +187,12 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
$list.slideDown('slow');
$('#filter-existing-customers').fadeIn('slow');
$('#filter-existing-customers').val('');
- $.each(GlobalVariables.customers, function (index, c) {
- $list.append('
'
- + c.first_name + ' ' + c.last_name + '
');
+ GlobalVariables.customers.forEach(function (customer) {
+ $('
', {
+ 'data-id': customer.id,
+ 'text': customer.first_name + ' ' + customer.last_name
+ })
+ .appendTo($list);
});
} else {
$list.slideUp('slow');
@@ -241,9 +244,12 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
.done(function (response) {
$list.empty();
- response.forEach(function (customer, index) {
- $list.append(''
- + customer.first_name + ' ' + customer.last_name + '
');
+ response.forEach(function (customer) {
+ $('
', {
+ 'data-id': customer.id,
+ 'text': customer.first_name + ' ' + customer.last_name
+ })
+ .appendTo($list);
// Verify if this customer is on the old customer list.
var result = GlobalVariables.customers.filter(function(globalVariablesCustomer) {
@@ -269,8 +275,11 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
|| customer.city.toLowerCase().indexOf(key) !== -1
|| customer.zip_code.toLowerCase().indexOf(key) !== -1
|| customer.notes.toLowerCase().indexOf(key) !== -1) {
- $list.append(''
- + customer.first_name + ' ' + customer.last_name + '
');
+ $('
', {
+ 'data-id': customer.id,
+ 'text': customer.first_name + ' ' + customer.last_name
+ })
+ .appendTo($list);
}
});
});
@@ -308,10 +317,8 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
// If the current provider is able to provide the selected service, add him to the listbox.
if (Number(providerServiceId) === Number(serviceId)) {
- var optionHtml = ''
- + provider.first_name + ' ' + provider.last_name
- + ' ';
- $('#select-provider').append(optionHtml);
+ $('#select-provider')
+ .append(new Option(provider.first_name + ' ' + provider.last_name, provider.id));
}
});
});
diff --git a/assets/js/backend_calendar_default_view.js b/assets/js/backend_calendar_default_view.js
index e8b43883..fae70db8 100755
--- a/assets/js/backend_calendar_default_view.js
+++ b/assets/js/backend_calendar_default_view.js
@@ -279,7 +279,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
function calendarEventClick(event, jsEvent, view) {
$('.popover').remove(); // Close all open popovers.
- var html;
+ var $html;
var displayEdit;
var displayDelete;
@@ -301,109 +301,217 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
notes = 'Notes ' + event.data.notes;
}
- html =
- '' +
- '' + EALang.start + ' '
- + GeneralFunctions.formatDate(event.start.format('YYYY-MM-DD HH:mm:ss'), GlobalVariables.dateFormat, true)
- + ' ' +
- '' + EALang.end + ' '
- + GeneralFunctions.formatDate(event.end.format('YYYY-MM-DD HH:mm:ss'), GlobalVariables.dateFormat, true)
- + ' '
- + notes
- + ' ' +
- '' +
- '' + EALang.edit + ' ' +
- '' + EALang.delete + ' ' +
- '' + EALang.close + ' ' +
- ' ';
+ $html = $('
', {
+ 'html': [
+ $(' ', {
+ 'text': EALang.start
+ }),
+ $(' ', {
+ 'text': GeneralFunctions.formatDate(event.start.format('YYYY-MM-DD HH:mm:ss'), GlobalVariables.dateFormat, true)
+ }),
+ $(' '),
+
+ $(' ', {
+ 'text': EALang.end
+ }),
+ $(' ', {
+ 'text': GeneralFunctions.formatDate(event.end.format('YYYY-MM-DD HH:mm:ss'), GlobalVariables.dateFormat, true)
+ }),
+ $(' '),
+
+ $(' ', {
+ 'text': notes
+ }),
+ $(' '),
+
+ $(' '),
+
+ $('
', {
+ 'class': 'text-center',
+ 'html': [
+ $(' ', {
+ 'class': 'edit-popover btn btn-primary ' + displayEdit,
+ 'text': EALang.edit
+ }),
+ $(' ', {
+ 'class': 'delete-popover btn btn-danger ' + displayDelete,
+ 'text': EALang.delete
+ }),
+ $(' ', {
+ 'class': 'close-popover btn btn-default',
+ 'text': EALang.close
+ })
+ ]
+ })
+ ]
+ });
} else if ($(this).hasClass('fc-extra') || $parent.hasClass('fc-extra') || $altParent.hasClass('fc-extra')) {
displayDelete = (($parent.hasClass('fc-custom') || $altParent.hasClass('fc-custom'))
&& GlobalVariables.user.privileges.appointments.delete === true)
? '' : 'hide'; // Same value at the time.
var provider = '';
+
if (event.data) { // Only custom unavailable periods have notes.
provider = '' + EALang.provider + ' ' + event.data.first_name + ' ' + event.data.last_name;
}
var extraPeriod = jQuery.parseJSON(event.data.settings.extra_working_plan)[event.start.format()];
- html =
- '' +
- '' + EALang.start + ' '
- + GeneralFunctions.formatDate(event.start.format() + ' ' + extraPeriod.start, GlobalVariables.dateFormat, true)
- + ' ' +
- '' + EALang.end + ' '
- + GeneralFunctions.formatDate(event.start.format() + ' ' + extraPeriod.end, GlobalVariables.dateFormat, true)
- + ' ' +
- '' + EALang.timezone + ' '
- + GlobalVariables.timezones[event.data.provider.timezone]
- + ' ' +
- + provider
- + ' ' +
- '' +
- '' + EALang.delete + ' ' +
- '' + EALang.close + ' ' +
- ' ';
+ $html = $('
', {
+ 'html': [
+ $(' ', {
+ 'text': EALang.provider
+ }),
+ $(' ', {
+ 'text': event.data ? event.data.first_name + ' ' + event.data.last_name : '-'
+ }),
+ $(' '),
+ $(' ', {
+ 'text': EALang.start
+ }),
+ $(' ', {
+ 'text': GeneralFunctions.formatDate(event.start.format('YYYY-MM-DD HH:mm:ss'), GlobalVariables.dateFormat, true)
+ }),
+ $(' '),
+
+ $(' ', {
+ 'text': EALang.end
+ }),
+ $(' ', {
+ 'text': GeneralFunctions.formatDate(event.end.format('YYYY-MM-DD HH:mm:ss'), GlobalVariables.dateFormat, true)
+ }),
+ $(' '),
+
+ $(' ', {
+ 'text': EALang.timezone
+ }),
+ $(' ', {
+ 'text': GlobalVariables.timezones[event.data.provider.timezone]
+ }),
+ $(' '),
+
+ $(' '),
+
+ $('
', {
+ 'class': 'text-center',
+ 'html': [
+ $(' ', {
+ 'class': 'delete-popover btn btn-danger ' + displayDelete,
+ 'text': EALang.delete
+ }),
+ $(' ', {
+ 'class': 'close-popover btn btn-default',
+ 'text': EALang.close
+ })
+ ]
+ })
+ ]
+ });
} else {
displayEdit = (GlobalVariables.user.privileges.appointments.edit === true)
? '' : 'hide';
displayDelete = (GlobalVariables.user.privileges.appointments.delete === true)
? '' : 'hide';
- html =
- '' +
- '' + EALang.start + ' '
- + GeneralFunctions.formatDate(event.start.format('YYYY-MM-DD HH:mm:ss'), GlobalVariables.dateFormat, true)
- + ' ' +
- '' + EALang.end + ' '
- + GeneralFunctions.formatDate(event.end.format('YYYY-MM-DD HH:mm:ss'), GlobalVariables.dateFormat, true)
- + ' ' +
- '' + EALang.timezone + ' '
- + GlobalVariables.timezones[event.data.provider.timezone]
- + ' ' +
- '' + EALang.service + ' '
- + event.data.service.name
- + ' ' +
- '' + EALang.provider + ' '
- + GeneralFunctions.renderMapIcon(event.data.customer) + ' '
- + event.data.provider.first_name + ' '
- + event.data.provider.last_name
- + ' ' +
- '' + EALang.customer + ' '
- + GeneralFunctions.renderMapIcon(event.data.customer) + ' '
- + event.data.customer.first_name + ' '
- + event.data.customer.last_name
- + ' ' +
- '' + EALang.email + ' '
- + GeneralFunctions.renderMailIcon(event.data.customer.email) + ' '
- + event.data.customer.email
- + ' ' +
- '' + EALang.phone_number + ' '
- + GeneralFunctions.renderPhoneIcon(event.data.customer.phone_number) + ' '
- + event.data.customer.phone_number
- + ' ' +
- '' +
- '' + EALang.edit + ' ' +
- '' + EALang.delete + ' ' +
- '' + EALang.close + ' ' +
- '
';
+ $html = $('
', {
+ 'html': [
+ $(' ', {
+ 'text': EALang.start
+ }),
+ $(' ', {
+ 'text': GeneralFunctions.formatDate(event.start.format('YYYY-MM-DD HH:mm:ss'), GlobalVariables.dateFormat, true)
+ }),
+ $(' '),
+
+ $(' ', {
+ 'text': EALang.end
+ }),
+ $(' ', {
+ 'text': GeneralFunctions.formatDate(event.end.format('YYYY-MM-DD HH:mm:ss'), GlobalVariables.dateFormat, true)
+ }),
+ $(' '),
+
+ $(' ', {
+ 'text': EALang.timezone
+ }),
+ $(' ', {
+ 'text': GlobalVariables.timezones[event.data.provider.timezone]
+ }),
+ $(' '),
+
+ $(' ', {
+ 'text': EALang.service
+ }),
+ $(' ', {
+ 'text': event.data.service.name
+ }),
+ $(' '),
+
+ $(' ', {
+ 'text': EALang.provider
+ }),
+ GeneralFunctions.renderMapIcon(event.data.provider),
+ $(' ', {
+ 'text': event.data.provider.first_name + ' ' + event.data.provider.last_name
+ }),
+ $(' '),
+
+ $(' ', {
+ 'text': EALang.customer
+ }),
+ GeneralFunctions.renderMapIcon(event.data.customer),
+ $(' ', {
+ 'text': event.data.customer.first_name + ' ' + event.data.customer.last_name
+ }),
+ $(' '),
+
+ $(' ', {
+ 'text': EALang.email
+ }),
+ GeneralFunctions.renderMailIcon(event.data.customer.email),
+ $(' ', {
+ 'text': event.data.customer.email
+ }),
+ $(' '),
+
+ $(' ', {
+ 'text': EALang.phone_number
+ }),
+ GeneralFunctions.renderPhoneIcon(event.data.customer.phone_number),
+ $(' ', {
+ 'text': event.data.customer.phone_number
+ }),
+ $(' '),
+
+ $(' '),
+
+ $('
', {
+ 'class': 'text-center',
+ 'html': [
+ $(' ', {
+ 'class': 'edit-popover btn btn-primary ' + displayEdit,
+ 'text': EALang.edit
+ }),
+ $(' ', {
+ 'class': 'delete-popover btn btn-danger ' + displayDelete,
+ 'text': EALang.delete
+ }),
+ $(' ', {
+ 'class': 'close-popover btn btn-default',
+ 'text': EALang.close
+ })
+ ]
+ })
+ ]
+ });
}
$(jsEvent.target).popover({
placement: 'top',
title: event.title,
- content: html,
+ content: $html,
html: true,
container: '#calendar',
trigger: 'manual'
@@ -1262,34 +1370,36 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
// Fill the select list boxes of the page.
if (GlobalVariables.availableProviders.length > 0) {
- var optgroupHtml = '';
+ $(' ', {
+ 'label': EALang.providers,
+ 'type': 'providers-group',
+ 'html': GlobalVariables.availableProviders.map(function (availableProvider) {
+ var hasGoogleSync = availableProvider.settings.google_sync === '1' ? 'true' : 'false';
- $.each(GlobalVariables.availableProviders, function (index, provider) {
- var hasGoogleSync = provider.settings.google_sync === '1' ? 'true' : 'false';
-
- optgroupHtml +=
- ''
- + provider.first_name + ' ' + provider.last_name
- + ' ';
- });
-
- optgroupHtml += ' ';
-
- $('#select-filter-item').append(optgroupHtml);
+ return $(' ', {
+ 'value': availableProvider.id,
+ 'type': FILTER_TYPE_PROVIDER,
+ 'google-sync': hasGoogleSync,
+ 'text': availableProvider.first_name + ' ' + availableProvider.last_name
+ })
+ })
+ })
+ .appendTo('#select-filter-item');
}
if (GlobalVariables.availableServices.length > 0) {
- optgroupHtml = '';
-
- $.each(GlobalVariables.availableServices, function (index, service) {
- optgroupHtml += '' +
- service.name + ' ';
- });
-
- optgroupHtml += ' ';
-
- $('#select-filter-item').append(optgroupHtml);
+ $(' ', {
+ 'label': EALang.services,
+ 'type': 'services-group',
+ 'html': GlobalVariables.availableServices.map(function (availableService) {
+ return $(' ', {
+ 'value': availableService.id,
+ 'type': FILTER_TYPE_SERVICE,
+ 'text': availableService.name
+ })
+ })
+ })
+ .appendTo('#select-filter-item');
}
// Check permissions.
diff --git a/assets/js/backend_calendar_table_view.js b/assets/js/backend_calendar_table_view.js
index df9a39ae..d88c308f 100755
--- a/assets/js/backend_calendar_table_view.js
+++ b/assets/js/backend_calendar_table_view.js
@@ -308,18 +308,37 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
.append(new Option('1 ' + EALang.day, 1))
.append(new Option('3 ' + EALang.days, 3));
- var $calendarHeader = $('').appendTo('#calendar');
+ var $calendarHeader = $('
', {
+ 'class': 'calendar-header'
+ })
+ .appendTo('#calendar');
- $calendarHeader
- .html(
- '' +
- ' ' +
- ' ' +
- ' ' +
- '' +
- ' ' +
- ' '
- );
+ $(' ', {
+ 'class': 'btn btn-xs btn-default previous',
+ 'html': [
+ $(' ', {
+ 'class': 'glyphicon glyphicon-chevron-left'
+ })
+ ]
+ })
+ .appendTo($calendarHeader);
+
+ $(' ', {
+ 'type': 'text',
+ 'class': 'select-date',
+ 'value': GeneralFunctions.formatDate(new Date(), GlobalVariables.dateFormat)
+ })
+ .appendTo($calendarHeader);
+
+ $(' ', {
+ 'class': 'btn btn-xs btn-default next',
+ 'html': [
+ $(' ', {
+ 'class': 'glyphicon glyphicon-chevron-right'
+ })
+ ]
+ })
+ .appendTo($calendarHeader);
var dateFormat;
@@ -943,7 +962,9 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
var endHour = entry.end.split(':');
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 = $('
', {
+ 'class': 'event unavailability break'
+ });
$event.html(
EALang.break +
@@ -983,7 +1004,7 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
function onEventClick(event, jsEvent) {
$('.popover').remove(); // Close all open popovers.
- var html;
+ var $html;
var displayEdit;
var displayDelete;
@@ -1005,109 +1026,217 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
notes = 'Notes ' + event.data.notes;
}
- html =
- '' +
- '' + EALang.start + ' '
- + GeneralFunctions.formatDate(event.start.format('YYYY-MM-DD HH:mm:ss'), GlobalVariables.dateFormat, true)
- + ' ' +
- '' + EALang.end + ' '
- + GeneralFunctions.formatDate(event.end.format('YYYY-MM-DD HH:mm:ss'), GlobalVariables.dateFormat, true)
- + ' '
- + notes
- + ' ' +
- '' +
- '' + EALang.edit + ' ' +
- '' + EALang.delete + ' ' +
- '' + EALang.close + ' ' +
- ' ';
+ $html = $('
', {
+ 'html': [
+ $(' ', {
+ 'text': EALang.start
+ }),
+ $(' ', {
+ 'text': GeneralFunctions.formatDate(event.start.format('YYYY-MM-DD HH:mm:ss'), GlobalVariables.dateFormat, true)
+ }),
+ $(' '),
+
+ $(' ', {
+ 'text': EALang.end
+ }),
+ $(' ', {
+ 'text': GeneralFunctions.formatDate(event.end.format('YYYY-MM-DD HH:mm:ss'), GlobalVariables.dateFormat, true)
+ }),
+ $(' '),
+
+ $(' ', {
+ 'text': notes
+ }),
+ $(' '),
+
+ $(' '),
+
+ $('
', {
+ 'class': 'text-center',
+ 'html': [
+ $(' ', {
+ 'class': 'edit-popover btn btn-primary ' + displayEdit,
+ 'text': EALang.edit
+ }),
+ $(' ', {
+ 'class': 'delete-popover btn btn-danger ' + displayDelete,
+ 'text': EALang.delete
+ }),
+ $(' ', {
+ 'class': 'close-popover btn btn-default',
+ 'text': EALang.close
+ })
+ ]
+ })
+ ]
+ });
} else if ($(this).hasClass('fc-extra') || $parent.hasClass('fc-extra') || $altParent.hasClass('fc-extra')) {
displayDelete = (($parent.hasClass('fc-custom') || $altParent.hasClass('fc-custom'))
&& GlobalVariables.user.privileges.appointments.delete === true)
? '' : 'hide'; // Same value at the time.
var provider = '';
+
if (event.data) { // Only custom unavailable periods have notes.
provider = '' + EALang.provider + ' ' + event.data.first_name + ' ' + event.data.last_name;
}
var extraPeriod = jQuery.parseJSON(event.data.settings.extra_working_plan)[event.start.format()];
- html =
- '' +
- '' + EALang.start + ' '
- + GeneralFunctions.formatDate(event.start.format() + ' ' + extraPeriod.start, GlobalVariables.dateFormat, true)
- + ' ' +
- '' + EALang.end + ' '
- + GeneralFunctions.formatDate(event.start.format() + ' ' + extraPeriod.end, GlobalVariables.dateFormat, true)
- + ' ' +
- '' + EALang.timezone + ' '
- + GlobalVariables.timezones[event.data.provider.timezone]
- + ' ' +
- +provider
- + ' ' +
- '' +
- '' + EALang.delete + ' ' +
- '' + EALang.close + ' ' +
- ' ';
+ $html = $('
', {
+ 'html': [
+ $(' ', {
+ 'text': EALang.provider
+ }),
+ $(' ', {
+ 'text': event.data ? event.data.first_name + ' ' + event.data.last_name : '-'
+ }),
+ $(' '),
+ $(' ', {
+ 'text': EALang.start
+ }),
+ $(' ', {
+ 'text': GeneralFunctions.formatDate(event.start.format('YYYY-MM-DD HH:mm:ss'), GlobalVariables.dateFormat, true)
+ }),
+ $(' '),
+
+ $(' ', {
+ 'text': EALang.end
+ }),
+ $(' ', {
+ 'text': GeneralFunctions.formatDate(event.end.format('YYYY-MM-DD HH:mm:ss'), GlobalVariables.dateFormat, true)
+ }),
+ $(' '),
+
+ $(' ', {
+ 'text': EALang.timezone
+ }),
+ $(' ', {
+ 'text': GlobalVariables.timezones[event.data.provider.timezone]
+ }),
+ $(' '),
+
+ $(' '),
+
+ $('
', {
+ 'class': 'text-center',
+ 'html': [
+ $(' ', {
+ 'class': 'delete-popover btn btn-danger ' + displayDelete,
+ 'text': EALang.delete
+ }),
+ $(' ', {
+ 'class': 'close-popover btn btn-default',
+ 'text': EALang.close
+ })
+ ]
+ })
+ ]
+ });
} else {
displayEdit = (GlobalVariables.user.privileges.appointments.edit === true)
? '' : 'hide';
displayDelete = (GlobalVariables.user.privileges.appointments.delete === true)
? '' : 'hide';
- html =
- '' +
- '' + EALang.start + ' '
- + GeneralFunctions.formatDate(event.start.format('YYYY-MM-DD HH:mm:ss'), GlobalVariables.dateFormat, true)
- + ' ' +
- '' + EALang.end + ' '
- + GeneralFunctions.formatDate(event.end.format('YYYY-MM-DD HH:mm:ss'), GlobalVariables.dateFormat, true)
- + ' ' +
- '' + EALang.timezone + ' '
- + GlobalVariables.timezones[event.data.provider.timezone]
- + ' ' +
- '' + EALang.service + ' '
- + event.data.service.name
- + ' ' +
- '' + EALang.provider + ' '
- + GeneralFunctions.renderMapIcon(event.data.customer) + ' '
- + event.data.provider.first_name + ' '
- + event.data.provider.last_name
- + ' ' +
- '' + EALang.customer + ' '
- + GeneralFunctions.renderMapIcon(event.data.customer) + ' '
- + event.data.customer.first_name + ' '
- + event.data.customer.last_name
- + ' ' +
- '' + EALang.email + ' '
- + GeneralFunctions.renderMailIcon(event.data.customer.email) + ' '
- + event.data.customer.email
- + ' ' +
- '' + EALang.phone_number + ' '
- + GeneralFunctions.renderPhoneIcon(event.data.customer.phone_number) + ' '
- + event.data.customer.phone_number
- + ' ' +
- '' +
- '' + EALang.edit + ' ' +
- '' + EALang.delete + ' ' +
- '' + EALang.close + ' ' +
- '
';
+ $html = $('
', {
+ 'html': [
+ $(' ', {
+ 'text': EALang.start
+ }),
+ $(' ', {
+ 'text': GeneralFunctions.formatDate(event.start.format('YYYY-MM-DD HH:mm:ss'), GlobalVariables.dateFormat, true)
+ }),
+ $(' '),
+
+ $(' ', {
+ 'text': EALang.end
+ }),
+ $(' ', {
+ 'text': GeneralFunctions.formatDate(event.end.format('YYYY-MM-DD HH:mm:ss'), GlobalVariables.dateFormat, true)
+ }),
+ $(' '),
+
+ $(' ', {
+ 'text': EALang.timezone
+ }),
+ $(' ', {
+ 'text': GlobalVariables.timezones[event.data.provider.timezone]
+ }),
+ $(' '),
+
+ $(' ', {
+ 'text': EALang.service
+ }),
+ $(' ', {
+ 'text': event.data.service.name
+ }),
+ $(' '),
+
+ $(' ', {
+ 'text': EALang.provider
+ }),
+ GeneralFunctions.renderMapIcon(event.data.provider),
+ $(' ', {
+ 'text': event.data.provider.first_name + ' ' + event.data.provider.last_name
+ }),
+ $(' '),
+
+ $(' ', {
+ 'text': EALang.customer
+ }),
+ GeneralFunctions.renderMapIcon(event.data.customer),
+ $(' ', {
+ 'text': event.data.customer.first_name + ' ' + event.data.customer.last_name
+ }),
+ $(' '),
+
+ $(' ', {
+ 'text': EALang.email
+ }),
+ GeneralFunctions.renderMailIcon(event.data.customer.email),
+ $(' ', {
+ 'text': event.data.customer.email
+ }),
+ $(' '),
+
+ $(' ', {
+ 'text': EALang.phone_number
+ }),
+ GeneralFunctions.renderPhoneIcon(event.data.customer.phone_number),
+ $(' ', {
+ 'text': event.data.customer.phone_number
+ }),
+ $(' '),
+
+ $(' '),
+
+ $('
', {
+ 'class': 'text-center',
+ 'html': [
+ $(' ', {
+ 'class': 'edit-popover btn btn-primary ' + displayEdit,
+ 'text': EALang.edit
+ }),
+ $(' ', {
+ 'class': 'delete-popover btn btn-danger ' + displayDelete,
+ 'text': EALang.delete
+ }),
+ $(' ', {
+ 'class': 'close-popover btn btn-default',
+ 'text': EALang.close
+ })
+ ]
+ })
+ ]
+ });
}
$(jsEvent.target).popover({
placement: 'top',
title: event.title,
- content: html,
+ content: $html,
html: true,
container: '#calendar',
trigger: 'manual'
diff --git a/assets/js/backend_categories_helper.js b/assets/js/backend_categories_helper.js
index 7666ceb5..0daeabc5 100644
--- a/assets/js/backend_categories_helper.js
+++ b/assets/js/backend_categories_helper.js
@@ -181,14 +181,19 @@
.done(function (response) {
this.filterResults = response;
- $('#filter-categories .results').html('');
+ $('#filter-categories .results').empty();
$.each(response, function (index, category) {
- var html = this.getFilterHtml(category);
- $('#filter-categories .results').append(html);
+ $('#filter-categories .results')
+ .append(this.getFilterHtml(category))
+ .append($(' '));
}.bind(this));
if (response.length === 0) {
- $('#filter-categories .results').html('' + EALang.no_records_found + ' ');
+ $('#filter-categories .results').append(
+ $(' ', {
+ 'text': EALang.no_records_found
+ })
+ );
} else if (response.length === this.filterLimit) {
$(' ', {
'type': 'button',
@@ -319,12 +324,16 @@
* @return {String} Returns the record HTML code.
*/
CategoriesHelper.prototype.getFilterHtml = function (category) {
- var html =
- '' +
- '' + category.name + ' ' +
- '
';
-
- return html;
+ return $('
', {
+ 'class': 'category-row entry',
+ 'data-id': category.id,
+ 'html': [
+ $(' ', {
+ 'text': category.name
+ }),
+ $(' '),
+ ]
+ });
};
/**
diff --git a/assets/js/backend_customers_helper.js b/assets/js/backend_customers_helper.js
index 6b694ba9..e4b56213 100644
--- a/assets/js/backend_customers_helper.js
+++ b/assets/js/backend_customers_helper.js
@@ -330,13 +330,24 @@
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 +
- '
';
- $('#customer-appointments').append(html);
+
+ $('
', {
+ 'class': 'appointment-row',
+ 'data-id': appointment.id,
+ 'html': [
+ $(' ', {
+ 'text': start + ' - ' + end
+ }),
+ $(' '),
+ $(' ', {
+ 'text': appointment.service.name
+ }),
+ $(' ', {
+ 'text': appointment.provider.first_name + ' ' + appointment.provider.last_name
+ })
+ ]
+ })
+ .appendTo('#customer-appointments');
});
$('#appointment-details').empty();
@@ -365,14 +376,19 @@
.done(function (response) {
this.filterResults = response;
- $('#filter-customers .results').html('');
+ $('#filter-customers .results').empty();
$.each(response, function (index, customer) {
- var html = this.getFilterHtml(customer);
- $('#filter-customers .results').append(html);
+ $('#filter-customers .results')
+ .append(this.getFilterHtml(customer))
+ .append($(' '));
}.bind(this));
if (!response.length) {
- $('#filter-customers .results').html('' + EALang.no_records_found + ' ');
+ $('#filter-customers .results').append(
+ $(' ', {
+ 'text': EALang.no_records_found
+ })
+ );
} else if (response.length === this.filterLimit) {
$(' ', {
'type': 'button',
@@ -403,18 +419,25 @@
*/
CustomersHelper.prototype.getFilterHtml = function (customer) {
var name = customer.first_name + ' ' + customer.last_name;
+
var info = customer.email;
+
info = customer.phone_number ? info + ', ' + customer.phone_number : info;
- var html =
- '' +
- '' +
- name +
- ' ' +
- info +
- '
';
-
- return html;
+ return $('
', {
+ 'class': 'customer-row entry',
+ 'data-id': customer.id,
+ 'html': [
+ $(' ', {
+ 'text': name
+ }),
+ $(' '),
+ $(' ', {
+ 'text': info
+ }),
+ $(' '),
+ ]
+ });
};
/**
@@ -459,15 +482,29 @@
var end = GeneralFunctions.formatDate(Date.parse(appointment.end_datetime), GlobalVariables.dateFormat, true);
var timezone = GlobalVariables.timezones[GlobalVariables.user.timezone];
- var html =
- '' +
- '' + appointment.service.name + ' ' +
- appointment.provider.first_name + ' ' + appointment.provider.last_name + ' ' +
- start + ' - ' + end + ' ' +
- EALang.timezone + ': ' + timezone + ' ' +
- '
';
+ $('
', {
+ 'html': [
+ $(' ', {
+ 'text': appointment.service.name
+ }),
+ $(' '),
+ $(' ', {
+ 'text': appointment.provider.first_name + ' ' + appointment.provider.last_name
+ }),
+ $(' '),
+ $(' ', {
+ 'text': appointment.provider.first_name + ' ' + appointment.provider.last_name
+ }),
+ $(' '),
+ $(' ', {
+ 'text': EALang.timezone + ': ' + timezone
+ }),
+ $(' ')
+ ]
+ })
+ .appendTo('#appointment-details');
- $('#appointment-details').html(html).removeClass('hidden');
+ $('#appointment-details').removeClass('hidden');
};
window.CustomersHelper = CustomersHelper;
diff --git a/assets/js/backend_services_helper.js b/assets/js/backend_services_helper.js
index ba2d3c6d..beaa24e0 100644
--- a/assets/js/backend_services_helper.js
+++ b/assets/js/backend_services_helper.js
@@ -72,12 +72,21 @@
// Add dedicated provider link.
var dedicatedUrl = GlobalVariables.baseUrl + '/index.php?service=' + encodeURIComponent(service.id);
- var linkHtml = ' ';
+
+ var $link = $(' ', {
+ 'href': dedicatedUrl,
+ 'html': [
+ $(' ', {
+ 'class': 'glyphicon glyphicon-link'
+ })
+ ]
+ });
+
$('#services .record-details h3')
.find('a')
.remove()
.end()
- .append(linkHtml);
+ .append($link);
instance.display(service);
$('#filter-services .selected').removeClass('selected');
@@ -319,14 +328,19 @@
.done(function (response) {
this.filterResults = response;
- $('#filter-services .results').html('');
+ $('#filter-services .results').empty();
$.each(response, function (index, service) {
- var html = ServicesHelper.prototype.getFilterHtml(service);
- $('#filter-services .results').append(html);
+ $('#filter-services .results')
+ .append(ServicesHelper.prototype.getFilterHtml(service))
+ .append( $(' '))
});
if (response.length === 0) {
- $('#filter-services .results').html('' + EALang.no_records_found + ' ');
+ $('#filter-services .results').append(
+ $(' ', {
+ 'text': EALang.no_records_found
+ })
+ );
} else if (response.length === this.filterLimit) {
$(' ', {
'type': 'button',
@@ -357,14 +371,24 @@
* @return {String} The HTML code that represents the record on the filter results list.
*/
ServicesHelper.prototype.getFilterHtml = function (service) {
- var html =
- '' +
- '' + service.name + ' ' +
- service.duration + ' min - ' +
- service.price + ' ' + service.currency + ' ' +
- '
';
+ var name = service.name;
- return html;
+ var info = service.duration + ' min - ' + service.price + ' ' + service.currency;
+
+ return $('
', {
+ 'class': 'service-row entry',
+ 'data-id': service.id,
+ 'html': [
+ $(' ', {
+ 'text': name
+ }),
+ $(' '),
+ $(' ', {
+ 'text': info
+ }),
+ $(' ')
+ ]
+ });
};
/**
diff --git a/assets/js/backend_users.js b/assets/js/backend_users.js
index 7772f328..e8fbcc54 100644
--- a/assets/js/backend_users.js
+++ b/assets/js/backend_users.js
@@ -62,33 +62,47 @@ window.BackendUsers = window.BackendUsers || {};
helper.bindEventHandlers();
// Fill the services and providers list boxes.
- var html = '';
- $.each(GlobalVariables.services, function (index, service) {
- html +=
- '
' +
- '' +
- ' ' +
- service.name +
- ' ' +
- '
';
-
+ GlobalVariables.services.forEach(function(service) {
+ $('
', {
+ 'class': 'checkbox',
+ 'html': [
+ $('
', {
+ 'class': 'checkbox',
+ 'html': [
+ $('
', {
+ 'type': 'checkbox',
+ 'data-id': service.id
+ }),
+ $('
', {
+ 'text': service.name
+ })
+ ]
+ })
+ ]
+ })
+ .appendTo('#provider-services');
});
- html += '
';
- $('#provider-services').html(html);
-
- html = '';
- $.each(GlobalVariables.providers, function (index, provider) {
- html +=
- '
' +
- '' +
- ' ' +
- provider.first_name + ' ' + provider.last_name +
- ' ' +
- '
';
+ GlobalVariables.providers.forEach(function(provider) {
+ $('
', {
+ 'class': 'checkbox',
+ 'html': [
+ $('
', {
+ 'class': 'checkbox',
+ 'html': [
+ $('
', {
+ 'type': 'checkbox',
+ 'data-id': provider.id
+ }),
+ $('
', {
+ 'text': provider.first_name + ' ' + provider.last_name
+ })
+ ]
+ })
+ ]
+ })
+ .appendTo('#secretary-providers');
});
- html += '
';
- $('#secretary-providers').html(html);
$('#reset-working-plan').qtip({
position: {
@@ -136,19 +150,29 @@ window.BackendUsers = window.BackendUsers || {};
.done(function (response) {
GlobalVariables.providers = response;
- var html = '';
- $.each(GlobalVariables.providers, function (index, provider) {
- html +=
- '
' +
- '' +
- ' ' +
- provider.first_name + ' ' + provider.last_name +
- ' ' +
- '
';
+ GlobalVariables.providers.forEach(function(provider) {
+ $('
', {
+ 'class': 'checkbox',
+ 'html': [
+ $('
', {
+ 'class': 'checkbox',
+ 'html': [
+ $('
', {
+ 'type': 'checkbox',
+ 'data-id': provider.id,
+ 'prop': {
+ 'disabled': true
+ }
+ }),
+ $('
', {
+ 'text': provider.first_name + ' ' + provider.last_name
+ })
+ ]
+ })
+ ]
+ })
+ .appendTo('#secretary-providers');
});
- html += '
';
- $('#secretary-providers').html(html);
- $('#secretary-providers input:checkbox').prop('disabled', true);
})
.fail(GeneralFunctions.ajaxFailureHandler);
}
diff --git a/assets/js/backend_users_admins.js b/assets/js/backend_users_admins.js
index 84ee7a88..64f44323 100644
--- a/assets/js/backend_users_admins.js
+++ b/assets/js/backend_users_admins.js
@@ -361,14 +361,19 @@
.done(function (response) {
this.filterResults = response;
- $('#filter-admins .results').html('');
+ $('#filter-admins .results').empty();
$.each(response, function (index, admin) {
- var html = this.getFilterHtml(admin);
- $('#filter-admins .results').append(html);
+ $('#filter-admins .results')
+ .append(this.getFilterHtml(admin))
+ .append($(' '));
}.bind(this));
if (!response.length) {
- $('#filter-admins .results').html('' + EALang.no_records_found + ' ')
+ $('#filter-admins .results').append(
+ $(' ', {
+ 'text': EALang.no_records_found
+ })
+ );
} else if (response.length === this.filterLimit) {
$(' ', {
'type': 'button',
@@ -398,19 +403,27 @@
*/
AdminsHelper.prototype.getFilterHtml = function (admin) {
var name = admin.first_name + ' ' + admin.last_name;
+
var info = admin.email;
info = admin.mobile_number ? info + ', ' + admin.mobile_number : info;
info = admin.phone_number ? info + ', ' + admin.phone_number : info;
- var html =
- '' +
- '' + name + ' ' +
- info + ' ' +
- '
';
-
- return html;
+ return $('
', {
+ 'class': 'admin-row entry',
+ 'data-id': admin.id,
+ 'html': [
+ $(' ', {
+ 'text': name
+ }),
+ $(' '),
+ $(' ', {
+ 'text': info
+ }),
+ $(' '),
+ ]
+ });
};
/**
diff --git a/assets/js/backend_users_providers.js b/assets/js/backend_users_providers.js
index 4b7e1057..e34dc253 100755
--- a/assets/js/backend_users_providers.js
+++ b/assets/js/backend_users_providers.js
@@ -403,12 +403,21 @@
// Add dedicated provider link.
var dedicatedUrl = GlobalVariables.baseUrl + '/index.php?provider=' + encodeURIComponent(provider.id);
- var linkHtml = ' ';
+
+ var $link = $(' ', {
+ 'href': dedicatedUrl,
+ 'html': [
+ $(' ', {
+ 'class': 'glyphicon glyphicon-link'
+ })
+ ]
+ });
+
$('#providers .details-view h3')
.find('a')
.remove()
.end()
- .append(linkHtml);
+ .append($link);
$('#provider-services a').remove();
$('#provider-services input:checkbox').prop('checked', false);
@@ -419,8 +428,17 @@
// Add dedicated service-provider link.
dedicatedUrl = GlobalVariables.baseUrl + '/index.php?provider=' + encodeURIComponent(provider.id)
+ '&service=' + encodeURIComponent(serviceId);
- linkHtml = ' ';
- $(this).parent().append(linkHtml);
+
+ $link = $(' ', {
+ 'href': dedicatedUrl,
+ 'html': [
+ $(' ', {
+ 'class': 'glyphicon glyphicon-link'
+ })
+ ]
+ });
+
+ $(this).parent().append($link);
}
});
});
@@ -457,14 +475,19 @@
.done(function (response) {
this.filterResults = response;
- $('#filter-providers .results').html('');
+ $('#filter-providers .results').empty();
$.each(response, function (index, provider) {
- var html = this.getFilterHtml(provider);
- $('#filter-providers .results').append(html);
+ $('#filter-providers .results')
+ .append(this.getFilterHtml(provider))
+ .append($(' '));
}.bind(this));
if (!response.length) {
- $('#filter-providers .results').html('' + EALang.no_records_found + ' ')
+ $('#filter-providers .results').append(
+ $(' ', {
+ 'text': EALang.no_records_found
+ })
+ );
} else if (response.length === this.filterLimit) {
$(' ', {
'type': 'button',
@@ -493,20 +516,28 @@
* @return {String} The html code that represents the record on the filter results list.
*/
ProvidersHelper.prototype.getFilterHtml = function (provider) {
- var name = provider.first_name + ' ' + provider.last_name,
- info = provider.email;
+ var name = provider.first_name + ' ' + provider.last_name;
+
+ var info = provider.email;
info = provider.mobile_number ? info + ', ' + provider.mobile_number : info;
info = provider.phone_number ? info + ', ' + provider.phone_number : info;
- var html =
- '' +
- '' + name + ' ' +
- info + ' ' +
- '
';
-
- return html;
+ return $('
', {
+ 'class': 'provider-row entry',
+ 'data-id': provider.id,
+ 'html': [
+ $(' ', {
+ 'text': name
+ }),
+ $(' '),
+ $(' ', {
+ 'text': info
+ }),
+ $(' '),
+ ]
+ });
};
/**
diff --git a/assets/js/backend_users_secretaries.js b/assets/js/backend_users_secretaries.js
index be1d9e34..e42d2e67 100644
--- a/assets/js/backend_users_secretaries.js
+++ b/assets/js/backend_users_secretaries.js
@@ -203,7 +203,7 @@
/**
* Save secretary record to database.
*
- * @param {Object} secretary Contains the admin record data. If an 'id' value is provided
+ * @param {Object} secretary Contains the secretary record data. If an 'id' value is provided
* then the update operation is going to be executed.
*/
SecretariesHelper.prototype.save = function (secretary) {
@@ -304,7 +304,7 @@
};
/**
- * Resets the admin tab form back to its initial state.
+ * Resets the secretary tab form back to its initial state.
*/
SecretariesHelper.prototype.resetForm = function () {
$('#secretaries .record-details').find('input, textarea').val('');
@@ -326,7 +326,7 @@
};
/**
- * Display a secretary record into the admin form.
+ * Display a secretary record into the secretary form.
*
* @param {Object} secretary Contains the secretary record data.
*/
@@ -385,14 +385,19 @@
.done(function (response) {
this.filterResults = response;
- $('#filter-secretaries .results').html('');
+ $('#filter-secretaries .results').empty();
$.each(response, function (index, secretary) {
- var html = this.getFilterHtml(secretary);
- $('#filter-secretaries .results').append(html);
+ $('#filter-secretaries .results')
+ .append(this.getFilterHtml(secretary))
+ .append($(' '));
}.bind(this));
if (!response.length) {
- $('#filter-secretaries .results').html('' + EALang.no_records_found + ' ')
+ $('#filter-secretaries .results').append(
+ $(' ', {
+ 'text': EALang.no_records_found
+ })
+ );
} else if (response.length === this.filterLimit) {
$(' ', {
'type': 'button',
@@ -422,19 +427,27 @@
*/
SecretariesHelper.prototype.getFilterHtml = function (secretary) {
var name = secretary.first_name + ' ' + secretary.last_name;
+
var info = secretary.email;
info = secretary.mobile_number ? info + ', ' + secretary.mobile_number : info;
info = secretary.phone_number ? info + ', ' + secretary.phone_number : info;
- var html =
- '' +
- '' + name + ' ' +
- info + ' ' +
- '
';
-
- return html;
+ return $('
', {
+ 'class': 'secretary-row entry',
+ 'data-id': secretary.id,
+ 'html': [
+ $(' ', {
+ 'text': name
+ }),
+ $(' '),
+ $(' ', {
+ 'text': info
+ }),
+ $(' '),
+ ]
+ });
};
/**
@@ -457,9 +470,9 @@
});
if (display) {
- $.each(this.filterResults, function (index, admin) {
- if (Number(admin.id) === Number(id)) {
- this.display(admin);
+ $.each(this.filterResults, function (index, secretary) {
+ if (Number(secretary.id) === Number(id)) {
+ this.display(secretary);
$('#edit-secretary, #delete-secretary').prop('disabled', false);
return false;
}
diff --git a/assets/js/frontend_book.js b/assets/js/frontend_book.js
index 3f8d9876..13c2e3ed 100644
--- a/assets/js/frontend_book.js
+++ b/assets/js/frontend_book.js
@@ -253,7 +253,7 @@ window.FrontendBook = window.FrontendBook || {};
FrontendBookApi.getUnavailableDates($('#select-provider').val(), $(this).val(),
$('#select-date').datepicker('getDate').toString('yyyy-MM-dd'));
FrontendBook.updateConfirmFrame();
- updateServiceDescription($('#select-service').val(), $('#service-description'));
+ updateServiceDescription(serviceId);
});
/**
@@ -520,25 +520,43 @@ window.FrontendBook = window.FrontendBook || {};
var servicePrice = '';
var serviceCurrency = '';
- $.each(GlobalVariables.availableServices, function (index, service) {
+ GlobalVariables.availableServices.forEach(function (service, index) {
if (Number(service.id) === Number(serviceId) && Number(service.price) > 0) {
- servicePrice = ' ' + service.price;
+ servicePrice = service.price;
serviceCurrency = service.currency;
return false; // break loop
}
});
- var html =
- '' + $('#select-service option:selected').text() + ' ' +
- ''
- + ''
- + $('#select-provider option:selected').text() + ' '
- + selectedDate + ' ' + $('.selected-hour').text() + ' ' + $('#select-timezone option:selected').text()
- + servicePrice + ' ' + serviceCurrency
- + ' ' +
- '
';
-
- $('#appointment-details').html(html);
+ $('
', {
+ 'html': [
+ $(' ', {
+ 'text': $('#select-service option:selected').text()
+ }),
+ $('
', {
+ 'html': [
+ $(' ', {
+ 'class': 'text-primary',
+ 'html': [
+ $(' ', {
+ 'text': $('#select-provider option:selected').text()
+ }),
+ $(' '),
+ $(' ', {
+ 'text': selectedDate + ' ' + $('.selected-hour').text()
+ }),
+ $(' '),
+ $(' ', {
+ 'text': $('#select-timezone option:selected').text()
+ + servicePrice + ' ' + serviceCurrency
+ })
+ ]
+ })
+ ]
+ })
+ ]
+ })
+ .appendTo('#appointment-details');
// Customer Details
var firstName = GeneralFunctions.escapeHtml($('#first-name').val());
@@ -549,24 +567,41 @@ window.FrontendBook = window.FrontendBook || {};
var city = GeneralFunctions.escapeHtml($('#city').val());
var zipCode = GeneralFunctions.escapeHtml($('#zip-code').val());
- html =
- '' + firstName + ' ' + lastName + ' ' +
- '' +
- EALang.phone_number + ': ' + phoneNumber +
- ' ' +
- EALang.email + ': ' + email +
- ' ' +
- EALang.address + ': ' + address +
- ' ' +
- EALang.city + ': ' + city +
- ' ' +
- EALang.zip_code + ': ' + zipCode +
- '
';
+ $('
', {
+ 'html': [
+ $(' )', {
+ 'text': firstName + ' ' + lastName
+ }),
+ $('
', {
+ 'html': [
+ $(' ', {
+ 'text': EALang.phone_number + ': ' + phoneNumber
+ }),
+ $(' '),
+ $(' ', {
+ 'text': EALang.email + ': ' + email
+ }),
+ $(' '),
+ $(' ', {
+ 'text': EALang.address + ': ' + address
+ }),
+ $(' '),
+ $(' ', {
+ 'text': EALang.city + ': ' + city
+ }),
+ $(' '),
+ $(' ', {
+ 'text': EALang.zip_code + ': ' + zipCode
+ }),
+ $(' '),
+ ]
+ })
+ ]
+ })
+ .appendTo('#customer-details');
- $('#customer-details').html(html);
- // Update appointment form data for submission to server when the user confirms
- // the appointment.
+ // Update appointment form data for submission to server when the user confirms the appointment.
var data = {};
data.customer = {
@@ -680,41 +715,58 @@ window.FrontendBook = window.FrontendBook || {};
* customers upon selecting the correct service.
*
* @param {Number} serviceId The selected service record id.
- * @param {Object} $div The destination div jquery object (e.g. provide $('#div-id')
- * object as value).
*/
- function updateServiceDescription(serviceId, $div) {
- var html = '';
+ function updateServiceDescription(serviceId) {
+ var $serviceDescription = $('#service-description');
- $.each(GlobalVariables.availableServices, function (index, service) {
- if (Number(service.id) === Number(serviceId)) {
- html = '' + service.name + ' ';
+ $serviceDescription.empty();
- if (service.description) {
- html += ' ' + service.description + ' ';
- }
+ var service = GlobalVariables.availableServices.filter(function(availableService) {
+ return Number(availableService.id) === Number(serviceId);
+ }).shift();
- if (service.duration) {
- html += '[' + EALang.duration + ' ' + service.duration + ' ' + EALang.minutes + ']';
- }
+ if (!service) {
+ return;
+ }
- if (Number(service.price) > 0) {
- html += '[' + EALang.price + ' ' + service.price + ' ' + service.currency + ']';
- }
+ $(' ', {
+ 'text': service.name
+ })
+ .appendTo($serviceDescription);
- if (service.location) {
- html += '[' + EALang.location + ' ' + service.location + ']';
- }
+ if (service.description) {
+ $(' ')
+ .appendTo($serviceDescription);
- html += ' ';
+ $(' ', {
+ 'text': service.description
+ })
+ .appendTo($serviceDescription);
- return false;
- }
- });
+ $(' ')
+ .appendTo($serviceDescription);
+ }
- $div
- .html(html)
- .toggle(html);
+ if (service.duration) {
+ $(' ', {
+ 'text': '[' + EALang.duration + ' ' + service.duration + ' ' + EALang.minutes + ']'
+ })
+ .appendTo($serviceDescription);
+ }
+
+ if (Number(service.price) > 0) {
+ $(' ', {
+ 'text': '[' + EALang.price + ' ' + service.price + ' ' + service.currency + ']'
+ })
+ .appendTo($serviceDescription);
+ }
+
+ if (service.location) {
+ $(' ', {
+ 'text': '[' + EALang.location + ' ' + service.location + ']'
+ })
+ .appendTo($serviceDescription);
+ }
}
})(window.FrontendBook);
diff --git a/assets/js/frontend_book_api.js b/assets/js/frontend_book_api.js
index bd7ce4ce..f606cce4 100755
--- a/assets/js/frontend_book_api.js
+++ b/assets/js/frontend_book_api.js
@@ -90,24 +90,43 @@ window.FrontendBookApi = window.FrontendBookApi || {};
var selectedTimezone = $('#select-timezone').val();
- var currColumn = 1;
+ var currentColumn = 1;
- $('#available-hours').html('
');
+ $('#available-hours').html(
+ $('
', {
+ 'css': {
+ 'width': '80px',
+ 'float': 'left'
+ }
+ })
+ );
var timeFormat = GlobalVariables.timeFormat === 'regular' ? 'h:mm a' : 'HH:mm';
response.forEach(function (availableHour, index) {
- if ((currColumn * 10) < (index + 1)) {
- currColumn++;
- $('#available-hours').append('
');
+ if ((currentColumn * 10) < (index + 1)) {
+ currentColumn++;
+ $('#available-hours').append(
+ $('
', {
+ 'css': {
+ 'width': '80px',
+ 'float': 'left'
+ }
+ })
+ );
}
var availableHourMoment = moment
.tz(selDate + ' ' + availableHour + ':00', providerTimezone)
.tz(selectedTimezone);
- $('#available-hours div:eq(' + (currColumn - 1) + ')').append(
- '' + availableHourMoment.format(timeFormat) + ' ');
+ $('#available-hours div:eq(' + (currentColumn - 1) + ')').append(
+ $(' ', {
+ 'class': 'available-hour',
+ 'text': availableHourMoment.format(timeFormat)
+ }),
+ $(' ')
+ );
});
if (FrontendBook.manageMode) {
diff --git a/assets/js/frontend_book_success.js b/assets/js/frontend_book_success.js
index e2a82c81..14c9cf7a 100644
--- a/assets/js/frontend_book_success.js
+++ b/assets/js/frontend_book_success.js
@@ -83,17 +83,22 @@ $(document).ready(function () {
}
$('#success-frame').append(
- ' ' +
- ''
+ $(' '),
+ $('
', {
+ 'class': 'alert alert-success col-xs-12',
+ 'html': [
+ $(' ', {
+ 'text': EALang.success
+ }),
+ $('
', {
+ 'text': EALang.appointment_added_to_google_calendar
+ }),
+ $(' ', {
+ 'href': response.htmlLink,
+ 'text': EALang.view_appointment_in_google_calendar
+ })
+ ]
+ })
);
$('#add-to-google-calendar').hide();
});
@@ -101,13 +106,22 @@ $(document).ready(function () {
} catch (error) {
// 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 +
- '
' + error.message + ' ' +
- '' +
- '
');
+ $(' '),
+ $('
', {
+ 'class': 'alert alert-danger col-xs-12',
+ 'html': [
+ $(' ', {
+ 'text': EALang.oops_something_went_wrong
+ }),
+ $('
', {
+ 'text': EALang.could_not_add_to_google_calendar
+ }),
+ $(' ', {
+ 'text': error.message
+ }),
+ ]
+ })
+ );
}
}
});
diff --git a/assets/js/general_functions.js b/assets/js/general_functions.js
index b1ce8c43..bba87c8b 100755
--- a/assets/js/general_functions.js
+++ b/assets/js/general_functions.js
@@ -222,41 +222,6 @@ window.GeneralFunctions = window.GeneralFunctions || {};
return re.test(email);
};
- /**
- * Convert AJAX exceptions to HTML.
- *
- * This method returns the exception HTML display for javascript ajax calls. It uses the Bootstrap collapse
- * module to show exception messages when the user opens the "Details" collapse component.
- *
- * @param {Array} exceptions Contains the exceptions to be displayed.
- *
- * @return {String} Returns the html markup for the exceptions.
- */
- exports.exceptionsToHtml = function (exceptions) {
- var html =
- '' +
- '
' +
- '
' +
- '' +
- EALang.details +
- ' ' +
- '
' +
- '
';
-
- $.each(exceptions, function (index, exception) {
- html +=
- '
' +
- '
' +
- '
' + exception.message + ' ' +
- '
' +
- '
';
- });
-
- html += '
';
-
- return html;
- };
/**
* Makes the first letter of the string upper case.
diff --git a/assets/js/working_plan.js b/assets/js/working_plan.js
index 896e79f5..2ad7adca 100755
--- a/assets/js/working_plan.js
+++ b/assets/js/working_plan.js
@@ -52,28 +52,59 @@
$('.breaks tbody').empty();
// Build working plan day list starting with the first weekday as set in the General settings
- $.each(workingPlanSorted, function (index, workingDay) {
+ var timeFormat = GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm';
+ $.each(workingPlanSorted, function (index, workingDay) {
var day = this.convertValueToDay(index);
+
var dayTranslatedName = GeneralFunctions.upperCaseFirstLetter(day)
- var tr =
- '' +
- '' +
- '' +
- ' ' + dayTranslatedName + ' ' +
- '
' +
- ' ' +
- ' ' +
- ' ' +
- ' ';
-
- $('.working-plan tbody').append(tr);
+ $(' ', {
+ 'html': [
+ $(' ', {
+ 'html': [
+ $('
', {
+ 'class': 'checkbox',
+ 'html': [
+ $(' ', {
+ 'html': [
+ $(' ', {
+ 'type': 'checkbox',
+ 'id': index,
+ }),
+ $(' ', {
+ 'text': dayTranslatedName
+ })
+ ]
+ })
+ ]
+ })
+ ]
+ }),
+ $(' ', {
+ 'html': [
+ $(' ', {
+ 'id': index + '-start',
+ 'class': 'work-start form-control input-sm'
+ })
+ ]
+ }),
+ $(' ', {
+ 'html': [
+ $(' ', {
+ 'id': index + '-end',
+ 'class': 'work-start form-control input-sm'
+ })
+ ]
+ })
+ ]
+ })
+ .appendTo('.working-plan tbody');
if (workingDay) {
$('#' + index).prop('checked', true);
- $('#' + index + '-start').val(Date.parse(workingDay.start).toString(GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm').toUpperCase());
- $('#' + index + '-end').val(Date.parse(workingDay.end).toString(GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm').toUpperCase());
+ $('#' + index + '-start').val(Date.parse(workingDay.start).toString(timeFormat).toUpperCase());
+ $('#' + index + '-end').val(Date.parse(workingDay.end).toString(timeFormat).toUpperCase());
// Sort day's breaks according to the starting hour
workingDay.breaks.sort(function (break1, break2) {
@@ -82,30 +113,83 @@
});
// Add the day's breaks on the breaks table.
- $.each(workingDay.breaks, function (i, brk) {
+ var timeFormat = GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm';
- tr =
- '' +
- '' + dayTranslatedName + ' ' +
- '' + Date.parse(brk.start).toString(GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm').toUpperCase() + ' ' +
- '' + Date.parse(brk.end).toString(GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm').toUpperCase() + ' ' +
- '' +
- '' +
- ' ' +
- ' ' +
- '' +
- ' ' +
- ' ' +
- '' +
- ' ' +
- ' ' +
- '' +
- ' ' +
- ' ' +
- ' ' +
- ' ';
- $('.breaks tbody').append(tr);
- }.bind(this));
+ workingDay.breaks.forEach(function(workingDayBreak, index) {
+ $(' ', {
+ 'html': [
+ $(' ', {
+ 'class': 'break-day editable',
+ 'text': dayTranslatedName
+ }),
+ $(' ', {
+ 'class': 'break-start editable',
+ 'text': Date.parse(workingDayBreak.start).toString(timeFormat).toUpperCase()
+ }),
+ $(' ', {
+ 'class': 'break-end editable',
+ 'text': Date.parse(workingDayBreak.end).toString(timeFormat).toUpperCase()
+ }),
+ $(' ', {
+ 'html': [
+ $(' ', {
+ 'type': 'button',
+ 'class': 'btn btn-default btn-sm edit-break',
+ 'title': EALang.edit,
+ 'html': [
+ $(' ', {
+ 'class': 'glyphicon glyphicon-pencil'
+ })
+ ]
+ })
+ ]
+ }),
+ $(' ', {
+ 'html': [
+ $(' ', {
+ 'type': 'button',
+ 'class': 'btn btn-default btn-sm delete-break',
+ 'title': EALang.delete,
+ 'html': [
+ $(' ', {
+ 'class': 'glyphicon glyphicon-trash'
+ })
+ ]
+ })
+ ]
+ }),
+ $(' ', {
+ 'html': [
+ $(' ', {
+ 'type': 'button',
+ 'class': 'btn btn-default btn-sm save-break hidden',
+ 'title': EALang.save,
+ 'html': [
+ $(' ', {
+ 'class': 'glyphicon glyphicon-ok'
+ })
+ ]
+ })
+ ]
+ }),
+ $(' ', {
+ 'html': [
+ $(' ', {
+ 'type': 'button',
+ 'class': 'btn btn-default btn-sm cancel-break hidden',
+ 'title': EALang.cancel,
+ 'html': [
+ $(' ', {
+ 'class': 'glyphicon glyphicon-ban-circle'
+ })
+ ]
+ })
+ ]
+ })
+ ]
+ })
+ .appendTo('.breaks tbody');
+ });
} else {
$('#' + index).prop('checked', false);
$('#' + index + '-start').prop('disabled', true);
@@ -133,27 +217,81 @@
var day = GeneralFunctions.formatDate(Date.parse(index), GlobalVariables.dateFormat, false);
- var tr =
- '' +
- '' +
- '' +
- '' +
- '' +
- '' +
- '' +
- '' +
- '' +
- ' ' +
- ' ';
- $('.extra-periods tbody').append(tr);
+ var timeFormat = GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm';
+
+ $(' ', {
+ 'html': [
+ $(' ', {
+ 'class': 'extra-day editable',
+ 'text': day
+ }),
+ $(' ', {
+ 'class': 'extra-start editable',
+ 'text': Date.parse(extraWorkingDay.start).toString(timeFormat).toUpperCase()
+ }),
+ $(' ', {
+ 'class': 'extra-end editable',
+ 'text': Date.parse(extraWorkingDay.end).toString(timeFormat).toUpperCase()
+ }),
+ $(' ', {
+ 'html': [
+ $(' ', {
+ 'type': 'button',
+ 'class': 'btn btn-default btn-sm edit-extra',
+ 'title': EALang.edit,
+ 'html': [
+ $(' ', {
+ 'class': 'glyphicon glyphicon-pencil'
+ })
+ ]
+ })
+ ]
+ }),
+ $(' ', {
+ 'html': [
+ $(' ', {
+ 'type': 'button',
+ 'class': 'btn btn-default btn-sm delete-extra',
+ 'title': EALang.delete,
+ 'html': [
+ $(' ', {
+ 'class': 'glyphicon glyphicon-trash'
+ })
+ ]
+ })
+ ]
+ }),
+ $(' ', {
+ 'html': [
+ $(' ', {
+ 'type': 'button',
+ 'class': 'btn btn-default btn-sm save-extra hidden',
+ 'title': EALang.save,
+ 'html': [
+ $(' ', {
+ 'class': 'glyphicon glyphicon-ok'
+ })
+ ]
+ })
+ ]
+ }),
+ $(' ', {
+ 'html': [
+ $(' ', {
+ 'type': 'button',
+ 'class': 'btn btn-default btn-sm cancel-extra hidden',
+ 'title': EALang.cancel,
+ 'html': [
+ $(' ', {
+ 'class': 'glyphicon glyphicon-ban-circle'
+ })
+ ]
+ })
+ ]
+ })
+ ]
+ })
+ .appendTo('.extra-periods tbody');
} else {
$('#' + index).prop('checked', false);
$('#' + index + '-start').prop('disabled', true);
@@ -220,8 +358,20 @@
}, {
event: 'edit',
height: '30px',
- submit: 'Submit ',
- cancel: 'Cancel ',
+ submit: $(' ', {
+ 'type': 'button',
+ 'class': 'hidden submit-editable',
+ 'text': EALang.save
+ })
+ .get(0)
+ .outerHTML,
+ cancel: $(' ', {
+ 'type': 'button',
+ 'class': 'hidden cancek-editable',
+ 'text': EALang.cancel
+ })
+ .get(0)
+ .outerHTML,
onblur: 'ignore',
onreset: function (settings, td) {
if (!this.enableCancel) {
@@ -264,33 +414,86 @@
* data. After that he can either press the save or cancel button.
*/
$('.add-break').click(function () {
- var tr =
- '' +
- '' + EALang.sunday + ' ' +
- '9:00 AM ' +
- '10:00 AM ' +
- '' +
- '' +
- ' ' +
- ' ' +
- '' +
- ' ' +
- ' ' +
- '' +
- ' ' +
- ' ' +
- '' +
- ' ' +
- ' ' +
- ' ' +
- ' ';
- $('.breaks').prepend(tr);
+ var timeFormat = GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm';
+
+ var $newBreak = $(' ', {
+ 'html': [
+ $(' ', {
+ 'class': 'break-day editable',
+ 'text': EALang.sunday
+ }),
+ $(' ', {
+ 'class': 'break-start editable',
+ 'text': '9:00 AM'
+ }),
+ $(' ', {
+ 'class': 'break-end editable',
+ 'text': '10:00 AM'
+ }),
+ $(' ', {
+ 'html': [
+ $(' ', {
+ 'type': 'button',
+ 'class': 'btn btn-default btn-sm edit-break',
+ 'title': EALang.edit,
+ 'html': [
+ $(' ', {
+ 'class': 'glyphicon glyphicon-pencil'
+ })
+ ]
+ })
+ ]
+ }),
+ $(' ', {
+ 'html': [
+ $(' ', {
+ 'type': 'button',
+ 'class': 'btn btn-default btn-sm delete-break',
+ 'title': EALang.delete,
+ 'html': [
+ $(' ', {
+ 'class': 'glyphicon glyphicon-trash'
+ })
+ ]
+ })
+ ]
+ }),
+ $(' ', {
+ 'html': [
+ $(' ', {
+ 'type': 'button',
+ 'class': 'btn btn-default btn-sm save-break hidden',
+ 'title': EALang.save,
+ 'html': [
+ $(' ', {
+ 'class': 'glyphicon glyphicon-ok'
+ })
+ ]
+ })
+ ]
+ }),
+ $(' ', {
+ 'html': [
+ $(' ', {
+ 'type': 'button',
+ 'class': 'btn btn-default btn-sm cancel-break hidden',
+ 'title': EALang.cancel,
+ 'html': [
+ $(' ', {
+ 'class': 'glyphicon glyphicon-ban-circle'
+ })
+ ]
+ })
+ ]
+ })
+ ]
+ })
+ .appendTo('.breaks tbody');
// Bind editable and event handlers.
- tr = $('.breaks tr')[1];
- this.editableBreakDay($(tr).find('.break-day'));
- this.editableBreakTime($(tr).find('.break-start, .break-end'));
- $(tr).find('.edit-break').trigger('click');
+ this.editableBreakDay($newBreak.find('.break-day'));
+ this.editableBreakTime($newBreak.find('.break-start, .break-end'));
+ $newBreak.find('.edit-break').trigger('click');
$('.add-break').prop('disabled', true);
}.bind(this));
@@ -397,33 +600,87 @@
*/
$('.add-extra-periods').click(function () {
var today = GeneralFunctions.formatDate(new Date(), GlobalVariables.dateFormat, false);
- var tr =
- '' +
- '' +
- '' +
- '' +
- '' +
- '' +
- '' +
- '' +
- '' +
- ' ' +
- ' ';
- $('.extra-periods').prepend(tr);
+
+ var timeFormat = GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm';
+
+ var $newExtraPeriod = $(' ', {
+ 'html': [
+ $(' ', {
+ 'class': 'extra-day editable',
+ 'text': today
+ }),
+ $(' ', {
+ 'class': 'extra-start editable',
+ 'text': '9:00 AM'
+ }),
+ $(' ', {
+ 'class': 'extra-end editable',
+ 'text': '10:00 AM'
+ }),
+ $(' ', {
+ 'html': [
+ $(' ', {
+ 'type': 'button',
+ 'class': 'btn btn-default btn-sm edit-extra',
+ 'title': EALang.edit,
+ 'html': [
+ $(' ', {
+ 'class': 'glyphicon glyphicon-pencil'
+ })
+ ]
+ })
+ ]
+ }),
+ $(' ', {
+ 'html': [
+ $(' ', {
+ 'type': 'button',
+ 'class': 'btn btn-default btn-sm delete-extra',
+ 'title': EALang.delete,
+ 'html': [
+ $(' ', {
+ 'class': 'glyphicon glyphicon-trash'
+ })
+ ]
+ })
+ ]
+ }),
+ $(' ', {
+ 'html': [
+ $(' ', {
+ 'type': 'button',
+ 'class': 'btn btn-default btn-sm save-extra hidden',
+ 'title': EALang.save,
+ 'html': [
+ $(' ', {
+ 'class': 'glyphicon glyphicon-ok'
+ })
+ ]
+ })
+ ]
+ }),
+ $(' ', {
+ 'html': [
+ $(' ', {
+ 'type': 'button',
+ 'class': 'btn btn-default btn-sm cancel-extra hidden',
+ 'title': EALang.cancel,
+ 'html': [
+ $(' ', {
+ 'class': 'glyphicon glyphicon-ban-circle'
+ })
+ ]
+ })
+ ]
+ })
+ ]
+ })
+ .appendTo('.extra-periods tbody');
// Bind editable and event handlers.
- tr = $('.extra-periods tr')[1];
- this.editableBreakTime($(tr).find('.extra-day'));
- this.editableBreakTime($(tr).find('.extra-start, .extra-end'));
- $(tr).find('.edit-extra').trigger('click');
+ this.editableBreakTime($newExtraPeriod.find('.extra-day'));
+ this.editableBreakTime($newExtraPeriod.find('.extra-start, .extra-end'));
+ $newExtraPeriod.find('.edit-extra').trigger('click');
$('.add-extra-periods').prop('disabled', true);
}.bind(this));