Initial Commit

This commit is contained in:
David Stone
2024-11-30 18:24:12 -07:00
commit e8f7955c1c
5432 changed files with 1397750 additions and 0 deletions

View File

@ -0,0 +1,64 @@
<?php
/**
* Filter view.
*
* @since 2.0.0
*/
?>
<div id="dashboard-filters" class="wp-filter wu-filter">
<ul class="filter-links">
<?php foreach ($views as $tab => $view) : ?>
<li class="<?php echo $tab === $active_tab ? 'current' : ''; ?>">
<a href="<?php echo esc_attr($view['url']); ?>"
class="<?php echo $tab === $active_tab ? 'current wu-font-medium' : ''; ?> wu-loader">
<?php echo $view['label']; ?>
</a>
</li>
<?php endforeach; ?>
</ul>
<ul class="filter-links sm:wu-float-right sm:wu-w-1/2 lg:wu-w-1/4 wu--mx-2 wu-block sm:wu-inline-block">
<li class="wu-w-full wu-relative">
<span class="dashicons-wu-calendar wu-absolute wu-text-base wu-text-gray-600" style="top: 18px; left: 12px;"></span>
<input
id="wu-date-range"
style="min-height: 28px;"
class="wu-border-0 wu-border-l wu-border-gray-300 wu-bg-gray-100 wu-w-full wu-text-right wu-py-3 wu-outline-none wu-rounded-none"
placeholder="Loading..."
>
</li>
</ul>
<ul class="wu-hidden md:wu-inline-block filter-links sm:wu-float-right md:wu-mr-6">
<?php foreach ($preset_options as $slug => $preset) : ?>
<?php
$link = add_query_arg(array(
'start_date' => $preset['start_date'],
'end_date' => $preset['end_date'],
'preset' => $slug,
));
$request_slug = wu_request('preset', 'none');
?>
<li class="<?php echo $slug === $request_slug ? 'current' : ''; ?>">
<a href="<?php echo esc_attr($link); ?>"
class="<?php echo $slug === $request_slug ? 'current wu-font-medium' : ''; ?> wu-loader">
<?php echo $preset['label']; ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>

View File

@ -0,0 +1,117 @@
<?php
/**
* Graph countries view.
*
* @since 2.0.0
*/
?>
<div class="wu-styling">
<div class="wu-widget-inset">
<?php
$data = array();
$slug = 'signup_countries';
$headers = array(
__('Country', 'wp-ultimo'),
__('Customer Count', 'wp-ultimo'),
);
foreach ($countries as $country_code => $count) {
$line = array(
wu_get_country_name($country_code),
$count,
);
$data[] = $line;
} // end foreach;
$page->render_csv_button(array(
'headers' => $headers,
'data' => $data,
'slug' => $slug,
));
?>
</div>
</div>
<?php if (!empty($countries)) : ?>
<div class="wu-advanced-filters wu--mx-3 wu--mb-3 wu-mt-3">
<table class="wp-list-table widefat fixed striped wu-border-t-0 wu-border-l-0 wu-border-r-0">
<thead>
<tr>
<th><?php _e('Country', 'wp-ultimo'); ?></th>
<th class="wu-text-right"><?php _e('Customer Count', 'wp-ultimo'); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($countries as $country_code => $count) : ?>
<tr>
<td>
<?php
printf('<span class="wu-flag-icon wu-flag-icon-%s wu-w-5 wu-mr-1" %s></span>',
strtolower($country_code),
wu_tooltip_text(wu_get_country_name($country_code))
);
?>
<?php echo wu_get_country_name($country_code); ?>
</td>
<td class="wu-text-right"><?php echo $count; ?></td>
</tr>
<?php
$state_list = wu_get_states_of_customers($country_code);
$_state_count = 0;
?>
<?php foreach ($state_list as $state => $state_count) : $_state_count = $_state_count + $state_count; ?>
<tr>
<td class="wu-text-xs">|&longrightarrow; <?php echo $state; ?></td>
<td class="wu-text-right"><?php echo $state_count; ?></td>
</tr>
<?php endforeach; ?>
<?php if ($state_list && $count - $_state_count >= 0) : ?>
<tr>
<td class="wu-text-xs">|&longrightarrow; <?php _e('Other', 'wp-ultimo') ?></td>
<td class="wu-text-right"><?php echo $count - $_state_count; ?></td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else : ?>
<div class="wu-bg-gray-100 wu-p-4 wu-rounded wu-mt-6">
<?php _e('No countries registered yet.', 'wp-ultimo'); ?>
</div>
<?php endif; ?>

View File

@ -0,0 +1,88 @@
<?php
/**
* Graph countries view.
*
* @since 2.0.0
*/
?>
<div class="wu-styling">
<div class="wu-widget-inset">
<?php
$data = array();
$slug = 'signup_forms';
$headers = array(
__('Checkout Form', 'wp-ultimo'),
__('Signups', 'wp-ultimo'),
);
foreach ($forms as $form) {
$line = array(
$form->signup_form,
$form->count,
);
$data[] = $line;
} // end foreach;
$page->render_csv_button(array(
'headers' => $headers,
'data' => $data,
'slug' => $slug,
));
?>
</div>
</div>
<?php if (!empty($forms)) : ?>
<div class="wu-advanced-filters wu--mx-3 wu--mb-3 wu-mt-3">
<table class="wp-list-table widefat fixed striped wu-border-t-0 wu-border-l-0 wu-border-r-0">
<thead>
<tr>
<th><?php _e('Checkout Form', 'wp-ultimo'); ?></th>
<th class="wu-text-right"><?php _e('Signups', 'wp-ultimo'); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($forms as $form) : ?>
<tr>
<td>
<?php echo $form->signup_form; ?>
<?php if ($form->signup_form === 'by-admin') : ?>
<?php echo wu_tooltip(__('Customers created via the admin panel, by super admins.', 'wp-ultimo')); ?>
<?php endif;?>
</td>
<td class="wu-text-right"><?php echo $form->count; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else : ?>
<div class="wu-bg-gray-100 wu-p-4 wu-rounded wu-mt-6">
<?php _e('No data yet.', 'wp-ultimo'); ?>
</div>
<?php endif; ?>

View File

@ -0,0 +1,109 @@
<?php
/**
* Graph countries view.
*
* @since 2.0.0
*/
?>
<div class="wu-styling">
<div class="wu-widget-inset">
<?php
$data = array();
$slug = 'most_visited_sites';
$headers = array(
__('Site', 'wp-ultimo'),
__('Visits', 'wp-ultimo'),
);
foreach ($sites as $site_visits) {
$site_line = $site_visits->site->get_title().' '.get_admin_url($site_visits->site->get_id());
$line = array(
$site_line,
$site_visits->count,
);
$data[] = $line;
} // end foreach;
$page->render_csv_button(array(
'headers' => $headers,
'data' => $data,
'slug' => $slug,
));
?>
</div>
</div>
<?php if (!empty($sites)) : ?>
<div class="wu-advanced-filters wu--mx-3 wu--mb-3 wu-mt-3">
<table class="wp-list-table widefat fixed striped wu-border-t-0 wu-border-l-0 wu-border-r-0">
<thead>
<tr>
<th class="wu-w-8/12"><?php _e('Site', 'wp-ultimo'); ?></th>
<th class="wu-text-right"><?php _e('Visits', 'wp-ultimo'); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($sites as $site_visits) : ?>
<tr>
<td class="wu-align-middle">
<span class="wu-uppercase wu-text-xs wu-text-gray-700 wu-font-bold">
<?php echo $site_visits->site->get_title(); ?>
</span>
<div class="sm:wu-flex">
<a title="<?php _e('Homepage', 'wp-ultimo'); ?>" href="<?php echo esc_attr(get_home_url($site_visits->site->get_id())); ?>" class="wu-no-underline wu-flex wu-items-center wu-text-xs wp-ui-text-highlight">
<span class="dashicons-wu-link1 wu-align-middle wu-mr-1"></span>
<?php _e('Homepage', 'wp-ultimo'); ?>
</a>
<a title="<?php _e('Dashboard', 'wp-ultimo'); ?>" href="<?php echo esc_attr(get_admin_url($site_visits->site->get_id())); ?>" class="wu-no-underline wu-flex wu-items-center wu-text-xs wp-ui-text-highlight sm:wu-mt-0 sm:wu-ml-6">
<span class="dashicons-wu-browser wu-align-middle wu-mr-1"></span>
<?php _e('Dashboard', 'wp-ultimo'); ?>
</a>
</div>
</td>
<td class="wu-align-middle wu-text-right">
<?php echo sprintf(_n('%d visit', '%d visits', $site_visits->count, 'wp-ultimo'), $site_visits->count); ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else : ?>
<div class="wu-bg-gray-100 wu-p-4 wu-rounded wu-mt-6">
<?php _e('No visits registered in this period.', 'wp-ultimo'); ?>
</div>
<?php endif; ?>

View File

@ -0,0 +1,32 @@
<?php
/**
* Graph base view.
*
* @since 2.0.0
*/
?>
<div class="wu-mt-6 wu-mb-0">
<div v-show="false" class="wu-text-center wu-rounded wu-flex wu-items-center wu-justify-center wu-uppercase wu-font-semibold wu-text-xs wu-h-full wu-text-gray-700" style="height: 300px;">
<span class="wu-blinking-animation">
<?php _e('Loading...', 'wp-ultimo'); ?>
</span>
</div>
<div id="chart_mrr_growth">
<apexchart
v-cloak
height="300"
:type="chart_options.mrr_growth.chartOptions.chart.type"
:options="chart_options.mrr_growth.chartOptions"
:series="chart_options.mrr_growth.series"
>
</apexchart>
</div>
</div>

View File

@ -0,0 +1,75 @@
<?php
/**
* Total widget view.
*
* @since 2.0.0
*/
?>
<div class="wu-styling">
<ul class="md:wu-flex wu-my-0 wu-mx-0">
<li class="wu-p-2 wu-w-full md:wu-w-full wu-relative">
<div>
<strong class="wu-text-gray-800 wu-text-2xl md:wu-text-xl">
<?php echo $new_accounts; ?>
</strong>
</div>
<div class="wu-text-sm wu-text-gray-600">
<span class="wu-block"><?php _e('New Memberships', 'wp-ultimo'); ?></span>
</div>
</li>
</ul>
<div class="wu--mx-3 wu--mb-3 wu-mt-2">
<table class="wp-list-table widefat fixed striped wu-border-t-1 wu-border-l-0 wu-border-r-0">
<thead>
<tr>
<th><?php _e('Product Name', 'wp-ultimo'); ?></th>
<th class="wu-text-right"><?php _e('New Memberships', 'wp-ultimo'); ?></th>
</tr>
</thead>
<tbody>
<?php if ($products) : ?>
<?php foreach ($products as $product) : ?>
<tr>
<td>
<?php echo $product->name; ?>
</td>
<td class="wu-text-right">
<?php echo $product->count; ?>
</td>
</tr>
<?php endforeach; ?>
<?php else : ?>
<tr>
<td colspan="2">
<?php _e('No Products found.', 'wp-ultimo'); ?>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>

View File

@ -0,0 +1,106 @@
<?php
/**
* Total widget view.
*
* @since 2.0.0
*/
?>
<div class="wu-styling">
<ul class="lg:wu-flex wu-my-0 wu-mx-0">
<li class="wu-p-2 wu-w-full md:wu-w-4/12 wu-relative" <?php echo wu_tooltip_text(__('MRR stands for Monthly Recurring Revenue', 'wp-ultimo')); ?>>
<div>
<strong class="wu-text-gray-800 wu-text-2xl md:wu-text-xl">
<?php echo wu_format_currency($mrr); ?>
</strong>
</div>
<div class="wu-text-md wu-text-gray-600">
<span class="wu-block"><?php _e('MRR', 'wp-ultimo'); ?></span>
</div>
</li>
<li class="wu-p-2 wu-w-full md:wu-w-4/12 wu-relative">
<div>
<strong class="wu-text-gray-800 wu-text-2xl md:wu-text-xl">
<?php echo wu_format_currency($gross_revenue); ?>
</strong>
</div>
<div class="wu-text-md wu-text-gray-600">
<span class="wu-block"><?php _e('Gross Revenue', 'wp-ultimo'); ?></span>
</div>
</li>
<li class="wu-p-2 wu-w-full md:wu-w-4/12 wu-relative">
<div>
<strong class="wu-text-gray-800 wu-text-2xl md:wu-text-xl">
<?php echo wu_format_currency($refunds); ?>
</strong>
</div>
<div class="wu-text-md wu-text-gray-600">
<span class="wu-block"><?php _e('Refunded', 'wp-ultimo'); ?></span>
</div>
</li>
</ul>
<div class="wu--mx-3 wu--mb-3 wu-mt-2">
<table class="wp-list-table widefat fixed striped wu-border-t-1 wu-border-l-0 wu-border-r-0">
<thead>
<tr>
<th><?php _e('Product', 'wp-ultimo'); ?></th>
<th class="wu-text-right"><?php _e('Revenue', 'wp-ultimo'); ?></th>
</tr>
</thead>
<tbody>
<?php if (wu_get_products()) : ?>
<?php foreach ($product_stats as $stats) : ?>
<tr>
<td>
<?php echo $stats['label']; ?>
</td>
<td class="wu-text-right">
<?php echo wu_format_currency($stats['revenue']); ?>
</td>
</tr>
<?php endforeach; ?>
<?php else : ?>
<tr>
<td colspan="2">
<?php _e('No Products found.', 'wp-ultimo'); ?>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>

View File

@ -0,0 +1,94 @@
<?php
/**
* Total widget view.
*
* @since 2.0.0
*/
?>
<div class="wu-styling">
<div class="wu-widget-inset">
<?php
$data = array();
$slug = 'taxes_by_code';
$headers = array(
__('Tax', 'wp-ultimo'),
__('Rate', 'wp-ultimo'),
__('Orders', 'wp-ultimo'),
__('Tax Total', 'wp-ultimo'),
);
foreach ($taxes_by_rate as $tax_line) {
$line = array(
wu_get_isset($tax_line, 'title', 'No Name'),
$tax_line['tax_rate'],
$tax_line['order_count'],
wu_format_currency($tax_line['tax_total']),
);
$data[] = $line;
} // end foreach;
$page->render_csv_button(array(
'headers' => $headers,
'data' => $data,
'slug' => $slug
));
?>
<table class="wp-list-table widefat fixed striped wu-border-none">
<thead>
<tr>
<th><?php _e('Tax', 'wp-ultimo'); ?></th>
<th><?php _e('Rate', 'wp-ultimo'); ?></th>
<th><?php _e('Orders', 'wp-ultimo'); ?></th>
<th><?php _e('Tax Total', 'wp-ultimo'); ?></th>
</tr>
</thead>
<tbody>
<?php if ($taxes_by_rate) : ?>
<?php foreach ($taxes_by_rate as $tax_line) : ?>
<tr>
<td>
<?php echo wu_get_isset($tax_line, 'title', 'No Name'); ?>
</td>
<td>
<?php echo $tax_line['tax_rate']; ?>%
</td>
<td>
<?php echo $tax_line['order_count']; ?>
</td>
<td>
<?php echo wu_format_currency($tax_line['tax_total']); ?>
</td>
</tr>
<?php endforeach; ?>
<?php else : ?>
<tr>
<td colspan="4">
<?php _e('No Taxes found.', 'wp-ultimo'); ?>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>

View File

@ -0,0 +1,100 @@
<?php
/**
* Total widget view.
*
* @since 2.0.0
*/
?>
<div class="wu-styling">
<div class="wu-widget-inset">
<?php
$data = array();
$slug = 'taxes_by_day';
$headers = array(
__('Day', 'wp-ultimo'),
__('Orders', 'wp-ultimo'),
__('Total Sales', 'wp-ultimo'),
__('Tax Total', 'wp-ultimo'),
__('Net Profit', 'wp-ultimo'),
);
foreach ($taxes_by_day as $day => $tax_line) {
$line = array(
date_i18n(get_option('date_format'), strtotime($day)),
$tax_line['order_count'],
wu_format_currency($tax_line['total']),
wu_format_currency($tax_line['tax_total']),
wu_format_currency($tax_line['net_profit'])
);
$data[] = $line;
} // end foreach;
$page->render_csv_button(array(
'headers' => $headers,
'data' => $data,
'slug' => $slug
));
?>
<table class="wp-list-table widefat fixed striped wu-border-none">
<thead>
<tr>
<th class="wu-w-1/3"><?php _e('Day', 'wp-ultimo'); ?></th>
<th><?php _e('Orders', 'wp-ultimo'); ?></th>
<th><?php _e('Total Sales', 'wp-ultimo'); ?></th>
<th><?php _e('Tax Total', 'wp-ultimo'); ?></th>
<th><?php _e('Net Profit', 'wp-ultimo'); ?></th>
</tr>
</thead>
<tbody>
<?php if ($taxes_by_day) : ?>
<?php foreach ($taxes_by_day as $day => $tax_line) : ?>
<tr>
<td>
<?php echo date_i18n(get_option('date_format'), strtotime($day)); ?>
</td>
<td>
<?php echo $tax_line['order_count']; ?>
</td>
<td>
<?php echo wu_format_currency($tax_line['total']); ?>
</td>
<td>
<?php echo wu_format_currency($tax_line['tax_total']); ?>
</td>
<td>
<?php echo wu_format_currency($tax_line['net_profit']); ?>
</td>
</tr>
<?php endforeach; ?>
<?php else : ?>
<tr>
<td colspan="4">
<?php _e('No Taxes found.', 'wp-ultimo'); ?>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>

View File

@ -0,0 +1,32 @@
<?php
/**
* Graph base view.
*
* @since 2.0.0
*/
?>
<div class="wu-mt-6 wu-mb-0">
<div v-show="false" class="wu-text-center wu-rounded wu-flex wu-items-center wu-justify-center wu-uppercase wu-font-semibold wu-text-xs wu-h-full wu-text-gray-700" style="height: 300px;">
<span class="wu-blinking-animation">
<?php _e('Loading...', 'wp-ultimo'); ?>
</span>
</div>
<div id="chart_mrr_growth">
<apexchart
v-cloak
height="300"
:type="chart_options.mrr_growth.chartOptions.chart.type"
:options="chart_options.mrr_growth.chartOptions"
:series="chart_options.mrr_growth.series"
>
</apexchart>
</div>
</div>

View File

@ -0,0 +1,32 @@
<?php
/**
* Graph base view.
*
* @since 2.0.0
*/
?>
<div class="wu-mt-6 wu-mb-0">
<div v-show="false" class="wu-text-center wu-rounded wu-flex wu-items-center wu-justify-center wu-uppercase wu-font-semibold wu-text-xs wu-h-full wu-text-gray-700" style="height: 300px;">
<span class="wu-blinking-animation">
<?php _e('Loading...', 'wp-ultimo'); ?>
</span>
</div>
<div id="chart_mrr_growth">
<apexchart
v-cloak
height="300"
:type="chart_options.mrr_growth.chartOptions.chart.type"
:options="chart_options.mrr_growth.chartOptions"
:series="chart_options.mrr_growth.series"
>
</apexchart>
</div>
</div>