* Fixed Issue #25

* Other minor bug fixes.
This commit is contained in:
alextselegidis@gmail.com 2013-11-21 21:58:51 +00:00
parent 736d301f02
commit 80bb356d16
9 changed files with 64 additions and 53 deletions

View file

@ -409,8 +409,11 @@ class Appointments extends CI_Controller {
$service_duration = $this->services_model->get_value('duration', $_POST['id_services']); $service_duration = $this->services_model->get_value('duration', $_POST['id_services']);
$exclude_appointments = (isset($_POST['exclude_appointment_id']))
? array($_POST['exclude_appointment_id']) : array();
$available_periods = $this->get_provider_available_time_periods( $available_periods = $this->get_provider_available_time_periods(
$_POST['id_users_provider'], $_POST['start_datetime']); $_POST['id_users_provider'], $_POST['start_datetime'], $exclude_appointments);
$is_still_available = FALSE; $is_still_available = FALSE;

View file

@ -342,8 +342,10 @@ class Backend_api extends CI_Controller {
} }
$this->load->model('providers_model'); $this->load->model('providers_model');
$this->load->model('appointments_model');
$this->providers_model->set_setting('google_sync', FALSE, $_POST['provider_id']); $this->providers_model->set_setting('google_sync', FALSE, $_POST['provider_id']);
$this->providers_model->set_setting('google_token', NULL, $_POST['provider_id']); $this->providers_model->set_setting('google_token', NULL, $_POST['provider_id']);
$this->appointments_model->clear_google_sync_ids($_POST['provider_id']);
echo json_encode(AJAX_SUCCESS); echo json_encode(AJAX_SUCCESS);

View file

@ -369,6 +369,21 @@ class Appointments_Model extends CI_Model {
$this->db->where('id', $unavailable_id); $this->db->where('id', $unavailable_id);
return $this->db->delete('ea_appointments'); return $this->db->delete('ea_appointments');
} }
/**
* Clear google sync IDs from appointment record.
*
* @param numeric $provider_id The appointment provider record id.
*/
public function clear_google_sync_ids($provider_id) {
if (!is_numeric($provider_id)) {
throw new Exception('Invalid argument type $provider_id (value: "'
. $provider_id . '")');
}
$this->db->update('ea_appointments', array('id_google_calendar' => NULL),
array('id_users_provider' => $provider_id));
}
} }
/* End of file appointments_model.php */ /* End of file appointments_model.php */

View file

@ -26,14 +26,12 @@
<div id="customers-page" class="row-fluid"> <div id="customers-page" class="row-fluid">
<div id="filter-customers" class="filter-records column span4"> <div id="filter-customers" class="filter-records column span4">
<form class="input-append"> <form class="input-append">
<input class="key span7" type="text" /> <input class="key span12" type="text" />
<button class="filter btn" type="submit"> <button class="filter btn" type="submit" title="Filter">
<i class="icon-filter"></i> <i class="icon-search"></i>
Filter
</button> </button>
<button class="clear btn" type="button"> <button class="clear btn" type="button" title="Clear">
<i class="icon-remove-circle"></i> <i class="icon-repeat"></i>
Clear
</button> </button>
</form> </form>

View file

@ -36,14 +36,12 @@
<?php // FILTER SERVICES ?> <?php // FILTER SERVICES ?>
<div id="filter-services" class="filter-records column span4"> <div id="filter-services" class="filter-records column span4">
<form class="input-append"> <form class="input-append">
<input class="key span7" type="text" /> <input class="key span12" type="text" />
<button class="filter btn" type="submit"> <button class="filter btn" type="submit" title="Filter">
<i class="icon-filter"></i> <i class="icon-search"></i>
Filter
</button> </button>
<button class="clear btn" type="button"> <button class="clear btn" type="button" title="Clear">
<i class="icon-remove-circle"></i> <i class="icon-repeat"></i>
Clear
</button> </button>
</form> </form>
@ -113,14 +111,12 @@
<div id="categories" class="tab-content" style="display:none;"> <div id="categories" class="tab-content" style="display:none;">
<div id="filter-categories" class="filter-records column span4"> <div id="filter-categories" class="filter-records column span4">
<form class="input-append"> <form class="input-append">
<input class="key span7" type="text" class="" /> <input class="key span12" type="text" />
<button class="filter btn" type="submit"> <button class="filter btn" type="submit" title="Filter">
<i class="icon-filter"></i> <i class="icon-search"></i>
Filter
</button> </button>
<button class="clear btn" type="button"> <button class="clear btn" type="button" title="Clear">
<i class="icon-remove-circle"></i> <i class="icon-repeat"></i>
Clear
</button> </button>
</form> </form>

View file

@ -62,14 +62,12 @@
<div id="admins" class="tab-content"> <div id="admins" class="tab-content">
<div id="filter-admins" class="filter-records column span4"> <div id="filter-admins" class="filter-records column span4">
<form class="input-append"> <form class="input-append">
<input class="key span7" type="text" /> <input class="key span12" type="text" />
<button class="filter btn" type="submit"> <button class="filter btn" type="submit" title="Filter">
<i class="icon-filter"></i> <i class="icon-search"></i>
Filter
</button> </button>
<button class="clear btn" type="button"> <button class="clear btn" type="button" title="Clear">
<i class="icon-remove-circle"></i> <i class="icon-repeat"></i>
Clear
</button> </button>
</form> </form>
@ -170,14 +168,12 @@
<div id="providers" class="tab-content" style="display:none;"> <div id="providers" class="tab-content" style="display:none;">
<div id="filter-providers" class="filter-records column span4"> <div id="filter-providers" class="filter-records column span4">
<form class="input-append"> <form class="input-append">
<input class="key span7" type="text" /> <input class="key span12" type="text" />
<button class="filter btn" type="submit"> <button class="filter btn" type="submit" title="Filter">
<i class="icon-filter"></i> <i class="icon-search"></i>
Filter
</button> </button>
<button class="clear btn" type="button"> <button class="clear btn" type="button" title="Clear">
<i class="icon-remove-circle"></i> <i class="icon-repeat"></i>
Clear
</button> </button>
</form> </form>
@ -378,14 +374,12 @@
<div id="secretaries" class="tab-content" style="display:none;"> <div id="secretaries" class="tab-content" style="display:none;">
<div id="filter-secretaries" class="filter-records column span4"> <div id="filter-secretaries" class="filter-records column span4">
<form class="input-append"> <form class="input-append">
<input class="key span7" type="text" /> <input class="key span12" type="text" />
<button class="filter btn" type="submit"> <button class="filter btn" type="submit" title="Filter">
<i class="icon-filter"></i> <i class="icon-search"></i>
Filter
</button> </button>
<button class="clear btn" type="button"> <button class="clear btn" type="button" title="Clear">
<i class="icon-remove-circle"></i> <i class="icon-repeat"></i>
Clear
</button> </button>
</form> </form>

View file

@ -31,6 +31,7 @@ var BackendCalendar = {
'slotMinutes': 30, 'slotMinutes': 30,
'axisFormat': 'HH:mm', 'axisFormat': 'HH:mm',
'timeFormat': 'HH:mm{ - HH:mm}', 'timeFormat': 'HH:mm{ - HH:mm}',
'allDayText': 'All Day',
'columnFormat': { 'columnFormat': {
'month': 'ddd', 'month': 'ddd',
'week': 'ddd d/M', 'week': 'ddd d/M',
@ -55,7 +56,7 @@ var BackendCalendar = {
'eventDrop': BackendCalendar.calendarEventDrop, 'eventDrop': BackendCalendar.calendarEventDrop,
'eventAfterAllRender': function(view) { 'eventAfterAllRender': function(view) {
BackendCalendar.convertTitlesToHtml(); BackendCalendar.convertTitlesToHtml();
} }
}); });
// Temporary fix: make the first letter capital in all the lowercase strings // Temporary fix: make the first letter capital in all the lowercase strings
@ -64,7 +65,6 @@ var BackendCalendar = {
$('#calendar .fc-button-agendaDay').text('Day'); $('#calendar .fc-button-agendaDay').text('Day');
$('#calendar .fc-button-agendaWeek').text('Week'); $('#calendar .fc-button-agendaWeek').text('Week');
$('#calendar .fc-button-month').text('Month'); $('#calendar .fc-button-month').text('Month');
$('#calendar .fc-agenda-allday .fc-agenda-axis').text('All Day');
// Trigger once to set the proper footer position after calendar // Trigger once to set the proper footer position after calendar
// initialization. // initialization.
@ -1318,8 +1318,7 @@ var BackendCalendar = {
*/ */
calendarWindowResize: function(view) { calendarWindowResize: function(view) {
$('#calendar').fullCalendar('option', 'height', $('#calendar').fullCalendar('option', 'height',
BackendCalendar.getCalendarHeight()); BackendCalendar.getCalendarHeight());
//BackendCalendar.convertTitlesToHtml();
}, },
/** /**
@ -1612,10 +1611,7 @@ var BackendCalendar = {
$('#calendar').fullCalendar('getView').visStart, $('#calendar').fullCalendar('getView').visStart,
$('#calendar').fullCalendar('getView').visEnd); $('#calendar').fullCalendar('getView').visEnd);
$(window).trigger('resize'); // Places the footer on the bottom. $(window).trigger('resize'); // Places the footer on the bottom.
// Change string from "all-day" to "All Day".
$('#calendar .fc-agenda-allday .fc-agenda-axis').text('All Day');
// Remove all open popovers. // Remove all open popovers.
$('.close-popover').each(function() { $('.close-popover').each(function() {
$(this).parents().eq(2).remove(); $(this).parents().eq(2).remove();
@ -1787,7 +1783,7 @@ var BackendCalendar = {
* On some calendar events the titles contain html markup that is not * On some calendar events the titles contain html markup that is not
* displayed properly due to the fullcalendar plugin. This plugin sets * displayed properly due to the fullcalendar plugin. This plugin sets
* the .fc-event-title value by using the $.text() method and not the * the .fc-event-title value by using the $.text() method and not the
* $.html() method. So in order for the title to display the html properly * $.html() method. So in order for the title to displya the html properly
* we convert all the .fc-event-titles where needed into html. * we convert all the .fc-event-titles where needed into html.
*/ */
convertTitlesToHtml: function() { convertTitlesToHtml: function() {
@ -1795,6 +1791,8 @@ var BackendCalendar = {
$('.fc-custom').each(function() { $('.fc-custom').each(function() {
var title = $(this).find('.fc-event-title').text(); var title = $(this).find('.fc-event-title').text();
$(this).find('.fc-event-title').html(title); $(this).find('.fc-event-title').html(title);
var time = $(this).find('.fc-event-time').text();
$(this).find('.fc-event-time').html(time);
}); });
} }
}; };

View file

@ -203,6 +203,7 @@ ProvidersHelper.prototype.bindEventHandlers = function() {
*/ */
$('#reset-working-plan').click(function() { $('#reset-working-plan').click(function() {
$('.breaks').empty(); $('.breaks').empty();
$('.work-start, .work-end').val('');
BackendUsers.wp.setup(GlobalVariables.workingPlan); BackendUsers.wp.setup(GlobalVariables.workingPlan);
BackendUsers.wp.timepickers(false); BackendUsers.wp.timepickers(false);
}); });

View file

@ -234,9 +234,13 @@ var FrontendBook = {
var postData = { var postData = {
'id_users_provider': formData['appointment']['id_users_provider'], 'id_users_provider': formData['appointment']['id_users_provider'],
'id_services': formData['appointment']['id_services'], 'id_services': formData['appointment']['id_services'],
'start_datetime': formData['appointment']['start_datetime'] 'start_datetime': formData['appointment']['start_datetime'],
}; };
if (GlobalVariables.manageMode) {
postData.exclude_appointment_id = GlobalVariables.appointmentData.id;
}
var postUrl = GlobalVariables.baseUrl + 'appointments/ajax_check_datetime_availability'; var postUrl = GlobalVariables.baseUrl + 'appointments/ajax_check_datetime_availability';
$.post(postUrl, postData, function(response) { $.post(postUrl, postData, function(response) {