Compare commits

..

No commits in common. "b66f2c6709af0059b8fdfbc8f884bc9076580b53" and "318a40c22238a9c910b016d77249e439905a9193" have entirely different histories.

4 changed files with 28 additions and 58 deletions

View File

@ -139,7 +139,7 @@ abstract class AdminSingleController extends AdminBaseController
case 'image':
$file = $_FILES[$field['model_field']];
if (isset($file)) {
$path = upload_file($file, $this->model_сlass_name::$table_name . '/', 'image');
$path = upload_file($file, $this->model_сlass_name . '/', 'image');
if (!empty($path)) {
$field_value = $path;

View File

@ -1,11 +1,6 @@
<?php
namespace Lycoreco\Apps\Admin\Controllers;
use Lycoreco\Apps\Recipes\Models\IngredientModel;
use Lycoreco\Apps\Recipes\Models\RecipeModel;
use Lycoreco\Apps\Users\Models\BanlistModel;
use Lycoreco\Apps\Users\Models\UserModel;
class AdminHomeController extends Abstract\AdminBaseController
{
protected $template_name = APPS_PATH . '/Admin/Templates/home.php';
@ -18,33 +13,6 @@ class AdminHomeController extends Abstract\AdminBaseController
$datetime_month_ago = new \DateTime();
$datetime_month_ago->modify("-1 month");
$datetime_month_ago_text = $datetime_month_ago->format('Y-m-d H:i:s' . '\'');
$context['user_count'] = UserModel::count(array(
[
'name' => 'obj.register_at',
'type' => '>=',
'value' => $datetime_month_ago_text
]
));
$context['recipes_count'] = RecipeModel::count(array(
[
'name' => 'obj.created_at',
'type' => '>=',
'value' => $datetime_month_ago_text
]
));
$context['ban_count'] = BanlistModel::count(array(
[
'name' => 'obj.created_at',
'type' => '>=',
'value' => $datetime_month_ago_text
]
));
$context['latest_recipes'] = RecipeModel::filter(
array(),
['-obj.created_at']
);
return $context;

View File

@ -7,31 +7,31 @@
<div id="dashboard-stats">
<div class="dashboard-stats__item top-sales">
<div class="icon">
<i class="fa-solid fa-bowl-food"></i>
<i class="fa-solid fa-bag-shopping"></i>
</div>
<div class="info">
<div class="label">New recipes</div>
<div class="value"><?= $context['recipes_count'] ?></div>
<div class="label">Total sales</div>
<div class="value">0$</div>
</div>
</div>
<div class="dashboard-stats__item profit">
<div class="icon">
<i class="fa-solid fa-message"></i>
<i class="fa-solid fa-money-bill-trend-up"></i>
</div>
<div class="info">
<div class="label">New reviews</div>
<div class="value">0</div>
<div class="label">Profit</div>
<div class="value">0$</div>
</div>
</div>
<div class="dashboard-stats__item orders">
<div class="icon">
<i class="fa-solid fa-user-slash"></i>
<i class="fa-solid fa-cart-shopping"></i>
</div>
<div class="info">
<div class="label">Banned users</div>
<div class="value"><?= $context['ban_count'] ?></div>
<div class="label">Orders</div>
<div class="value">0</div>
</div>
</div>
@ -41,7 +41,7 @@
</div>
<div class="info">
<div class="label">New users</div>
<div class="value"><?= $context['user_count'] ?></div>
<div class="value">0</div>
</div>
</div>
</div>
@ -51,12 +51,12 @@
<h2 class="title">Quick tools</h2>
<div id="quicktools">
<a href="<?php the_permalink('admin:recipe-new') ?>" class="btn btn-secondary hover-anim">
<i class="fa-solid fa-plus"></i> New recipe
<a href="<?php the_permalink('admin:product-new') ?>" class="btn btn-secondary hover-anim">
<i class="fa-solid fa-plus"></i> New Product
</a>
<form action="<?php the_permalink('admin:recipe-list') ?>" method="get">
<form action="<?php the_permalink('admin:product-list') ?>" method="get">
<div class="input-admin">
<input type="text" name="s" placeholder="Search for recipes">
<input type="text" name="s" placeholder="Search for products">
<button class="hover-anim" type="submit"><i class="fa-solid fa-magnifying-glass"></i></button>
</div>
</form>
@ -64,24 +64,26 @@
</div>
</section>
<h2 class="title">Latest resipes</h2>
<h2 class="title">Latest orders</h2>
<table class="admin-table">
<thead>
<tr>
<th>Title</th>
<th>Price</th>
<th>Status</th>
<th>Created At</th>
<th>Order number</th>
<th>Method</th>
<th>Total price</th>
<th>Buyer</th>
<th>Created at</th>
</tr>
</thead>
<tbody>
<?php foreach ($context['latest_recipes'] as $recipe): ?>
<?php foreach ($context['last_orders'] as $order): ?>
<tr>
<td><a href="<?php the_permalink('admin:recipe', [$recipe->get_id()]) ?>"><?= $recipe->field_title ?></a></td>
<td><?= $recipe->get_price() ?></td>
<td><?= $recipe->get_status() ?></td>
<td><?= $recipe->field_created_at ?></td>
<td><a href="<?php the_permalink('admin:order', [$order->get_id()]) ?>"><?php echo $order->field_order_number ?></a></td>
<td><?php echo $order->field_method ?></td>
<td><?php echo $order->get_total_price() ?></td>
<td><?php echo $order->get_buyer_username() ?></td>
<td><?php echo $order->field_created_at ?></td>
</tr>
<?php endforeach; ?>
</tbody>

View File

@ -344,7 +344,7 @@ abstract class BaseModel
else
return false;
}
static function count($fields, $search = '', $additional_fields = array())
static function count($fields, $search, $additional_fields = array())
{
$filter_result = static::filter(
$fields,