public static function mergeTime($hour, $min, $ampm) { return Helper::doubleZero($hour) . ':' . Helper::doubleZero($min) . ' ' . $ampm; }
/** * ARA merges active businesses and other businesses * @return array */ public static function getDashboardBusinesses() { $businesses = array(); $active_businesses = Business::getProcessingBusinesses(); $all_businesses = Business::where('status', '=', 1)->get()->toArray(); foreach ($all_businesses as $index => $business) { $open_time_string = $business['open_hour'] . ':' . Helper::doubleZero($business['open_minute']) . ' ' . $business['open_ampm']; $closing_time_string = $business['close_hour'] . ':' . Helper::doubleZero($business['close_minute']) . ' ' . $business['close_ampm']; $waiting_time = Analytics::getWaitingTimeString($business['business_id']); //get time before the next available number is called. should be in minutes //ARA more info for business cards $first_service = Service::getFirstServiceOfBusiness($business['business_id']); $all_numbers = ProcessQueue::allNumbers($first_service->service_id); $last_number_called = count($all_numbers->called_numbers) > 0 ? $all_numbers->called_numbers[0]['priority_number'] : 'none'; $next_number = $all_numbers->next_number; $is_calling = count($all_numbers->called_numbers) > 0 ? true : false; $is_issuing = count($all_numbers->uncalled_numbers) + count($all_numbers->timebound_numbers) > 0 ? true : false; $last_active = Analytics::getLastActive($business['business_id']); $business_details = array('business_id' => $business['business_id'], 'name' => $business['name'], 'local_address' => $business['local_address'], 'open_time' => $open_time_string, 'close_time' => $closing_time_string, 'waiting_time' => $waiting_time, 'last_number_called' => $last_number_called, 'next_available_number' => $next_number, 'is_calling' => $is_calling, 'is_issuing' => $is_issuing, 'last_active' => $last_active); //Add active business to top of list if (isset($active_businesses[$business['business_id']])) { array_unshift($businesses, $business_details); } else { array_push($businesses, $business_details); } } return $businesses; }