diff --git a/src/application/views/appointments/book.php b/src/application/views/appointments/book.php index 57e99d8d..f8aaed25 100644 --- a/src/application/views/appointments/book.php +++ b/src/application/views/appointments/book.php @@ -163,70 +163,74 @@

lang->line('step_one_title'); ?>

- - - + $group) { - $group_label = ($key != 'uncategorized') - ? $group[0]['category_name'] : 'Uncategorized'; - - if (count($group) > 0) { - echo ''; - foreach($group as $service) { - echo ''; + foreach($available_services as $service) { + if ($service['category_id'] != NULL) { + if (!isset($grouped_services[$service['category_name']])) { + $grouped_services[$service['category_name']] = array(); + } + + $grouped_services[$service['category_name']][] = $service; + } + } + + // We need the uncategorized services at the end of the list so + // we will use another iteration only for the uncategorized services. + $grouped_services['uncategorized'] = array(); + foreach($available_services as $service) { + if ($service['category_id'] == NULL) { + $grouped_services['uncategorized'][] = $service; } - echo ''; + } + + foreach($grouped_services as $key => $group) { + $group_label = ($key != 'uncategorized') + ? $group[0]['category_name'] : 'Uncategorized'; + + if (count($group) > 0) { + echo ''; + foreach($group as $service) { + echo ''; + } + echo ''; + } + } + } else { + foreach($available_services as $service) { + echo ''; } } - } else { - foreach($available_services as $service) { - echo ''; - } - } - ?> - - - + ?> + +
- +
+ + + +