title = "Country" url = "/country" layout = "Dashboard" is_hidden = 0 [session] security = "user" allowedUserGroups[] = "admin" allowedUserGroups[] = "supplier" redirect = "dashboard/login" == vendor; $country = Country::selectRaw('country, COUNT(*) as total')->where('vendor', $user->vendor)->groupBy('country')->orderBy('total', 'desc'); if ($from != null) { $country->where('created_at', '>=', $from); } if ($to != null) { $country->where('created_at', '<=', $to); } $this['country'] = $country->get(); $bookings = Bookings::selectRaw('country, SUM(total_price) as revenue')->where('vendor_id', $user->vendor)->where('status_payment', 'paid')->groupBy('country'); if ($from != null) { $bookings->where('invoice_date', '>=', $from); } if ($to != null) { $bookings->where('invoice_date', '<=', $to); } $this['bookings'] = $bookings->get(); $this['all_browser'] = Country::where('vendor', $user->vendor)->count(); $country_by_date = Country::selectRaw('DATE(created_at) as date, COUNT(*) as total')->where('vendor', $user->vendor)->groupBy('date')->orderBy('date', 'asc'); if ($from != null) { $country_by_date->where('created_at', '>=', $from); } if ($to != null) { $country_by_date->where('created_at', '<=', $to); } $this['country_by_date'] = $country_by_date->get(); } $this['booking'] = Bookings::make(); } ?> ==
Reset
Perfomance
{{ (from != null) ? from|date('d F Y') : '' }} {{ (to != null) ? '-' : '' }} {{ (to != null) ? to|date('d F Y') : '' }}
Country
{% for key, country in country %} {% endfor %}
Country Total Visitor Total Revenue
{{ country.country }} {{ country.total }} {% for booking in bookings %} {% if booking.country == country.country %} IDR {{ booking.priceFormat(booking.revenue) }} {% endif %} {% endfor %}
{% put scripts %} {% endput %}