From 9655feca6c4aa1b74bd64f564f2cbc15447c02c1 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Tue, 8 Dec 2020 10:17:24 +0200 Subject: [PATCH] Corrected issue with table view and duplicate appointments --- application/controllers/Backend_api.php | 8 ++++---- assets/js/backend_calendar_table_view.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/application/controllers/Backend_api.php b/application/controllers/Backend_api.php index 9356a55b..74819c3c 100755 --- a/application/controllers/Backend_api.php +++ b/application/controllers/Backend_api.php @@ -83,11 +83,11 @@ class Backend_api extends EA_Controller { ]) ]; - foreach ($response['appointments'] as &$appointment) + foreach ($response['appointments'] as $index => $appointment) { - $appointment['provider'] = $this->providers_model->get_row($appointment['id_users_provider']); - $appointment['service'] = $this->services_model->get_row($appointment['id_services']); - $appointment['customer'] = $this->customers_model->get_row($appointment['id_users_customer']); + $response['appointments'][$index]['provider'] = $this->providers_model->get_row($appointment['id_users_provider']); + $response['appointments'][$index]['service'] = $this->services_model->get_row($appointment['id_services']); + $response['appointments'][$index]['customer'] = $this->customers_model->get_row($appointment['id_users_customer']); } $user_id = $this->session->userdata('user_id'); diff --git a/assets/js/backend_calendar_table_view.js b/assets/js/backend_calendar_table_view.js index f0a4818f..931cec5d 100755 --- a/assets/js/backend_calendar_table_view.js +++ b/assets/js/backend_calendar_table_view.js @@ -71,7 +71,7 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; var endDate = endDateMoment.toDate(); getCalendarEvents(startDate, endDate) - .done(function () { + .done(function (response) { var currentDate = startDate; while (currentDate <= endDate) {