ver. 0.274 - ShopClients Domain+DI migration
This commit is contained in:
@@ -1,48 +1,9 @@
|
||||
<div class="site-title"><?php echo $this->name . ' ' . $this->surname; ?></div>
|
||||
<div class="site-subtitle">Łączne zakupy w wysokości: <?php echo $this->total_spent; ?> zł</div>
|
||||
<div class="site-title"><?= htmlspecialchars($this->name . ' ' . $this->surname, ENT_QUOTES, 'UTF-8'); ?></div>
|
||||
<div class="site-subtitle">
|
||||
Łączne zakupy: <?= number_format((float)$this->total_spent, 2, '.', ' '); ?> zl,
|
||||
liczba zamówień: <?= (int)$this->total_orders; ?>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<br />
|
||||
|
||||
<?
|
||||
global $gdb;
|
||||
$grid = new \grid( 'pp_shop_orders' );
|
||||
$grid -> gdb_opt = $gdb;
|
||||
|
||||
$grid->src = $this->orders_info;
|
||||
|
||||
$grid -> debug = true;
|
||||
$grid -> order = [ 'column' => 'date_order', 'type' => 'DESC' ];
|
||||
$grid -> search = [];
|
||||
$grid -> columns_view = [
|
||||
[
|
||||
'name' => 'Lp.',
|
||||
'th' => [ 'class' => 'g-lp' ],
|
||||
'td' => [ 'class' => 'g-center' ],
|
||||
'autoincrement' => true
|
||||
], [
|
||||
'name' => 'Data zamówienia',
|
||||
'db' => 'date_order',
|
||||
'td' => [ 'class' => 'g-center' ],
|
||||
'th' => [ 'class' => 'g-center', 'style' => 'width: 175px;' ],
|
||||
], [
|
||||
'name' => 'Wartość',
|
||||
'db' => 'summary',
|
||||
'td' => [ 'class' => 'g-right' ],
|
||||
'th' => [ 'class' => 'g-right', 'style' => 'width: 150px;' ],
|
||||
'php' => 'echo number_format( "[summary]", 2, ".", " " ) . " zł";',
|
||||
], [
|
||||
'name' => 'Typ płatności',
|
||||
'db' => 'payment_method',
|
||||
'th' => [ 'style' => 'width: 350px;' ],
|
||||
], [
|
||||
'name' => 'Rodzaj transportu',
|
||||
'db' => 'transport',
|
||||
'th' => [ 'style' => 'width: 350px;' ],
|
||||
], [
|
||||
'name' => 'Wiadomość',
|
||||
'db' => 'message',
|
||||
],
|
||||
];
|
||||
|
||||
echo $grid -> draw();
|
||||
?>
|
||||
<?= \Tpl::view('components/table-list', ['list' => $this->ordersTable]); ?>
|
||||
@@ -1,84 +1,2 @@
|
||||
<div class="site-title">Lista klientów</div>
|
||||
<?php
|
||||
global $gdb;
|
||||
|
||||
$grid = new \grid( '__shop_clients' );
|
||||
$grid -> gdb_opt = $gdb;
|
||||
|
||||
$grid->sql = "
|
||||
SELECT
|
||||
MAX( client_id ) AS client_id, client_name, client_surname, client_email, MAX( client_phone ) AS client_phone, MAX( client_city ) AS client_city, COUNT(*) AS total_orders, SUM(summary) AS total_spent,
|
||||
CASE
|
||||
WHEN MAX(client_id) IS NOT NULL
|
||||
THEN 'Zarejestrowany'
|
||||
ELSE
|
||||
'Gość'
|
||||
END AS client_type
|
||||
FROM pp_shop_orders
|
||||
WHERE client_name IS NOT NULL AND client_surname IS NOT NULL AND client_email IS NOT NULL
|
||||
GROUP BY client_name, client_surname, client_email
|
||||
ORDER BY
|
||||
CASE
|
||||
WHEN MAX(client_id) IS NOT NULL THEN 1
|
||||
ELSE 2
|
||||
END,
|
||||
client_name ASC";
|
||||
$grid -> sql_count = "
|
||||
SELECT COUNT(*)
|
||||
FROM ( SELECT client_name, client_surname, client_email
|
||||
FROM pp_shop_orders
|
||||
WHERE client_name IS NOT NULL AND client_surname IS NOT NULL AND client_email IS NOT NULL
|
||||
GROUP BY client_name, client_surname, client_email
|
||||
) AS unique_clients";
|
||||
|
||||
$grid -> order = [ 'column' => 'date_order', 'type' => 'DESC' ];
|
||||
$grid -> search = [];
|
||||
$grid -> columns_view = [
|
||||
[
|
||||
'name' => 'Lp.',
|
||||
'th' => [ 'class' => 'g-lp' ],
|
||||
'td' => [ 'class' => 'g-center' ],
|
||||
'autoincrement' => true
|
||||
], [
|
||||
'name' => 'Typ klienta',
|
||||
'db' => 'client_type',
|
||||
'td' => [ 'class' => 'g-center' ],
|
||||
'th' => [ 'class' => 'g-center', 'style' => 'width: 100px;' ],
|
||||
], [
|
||||
'name' => 'Nazwisko, imię',
|
||||
'th' => [ 'style' => 'width: 225px;' ],
|
||||
'php' => 'echo "[client_surname]" . " " . "[client_name]";',
|
||||
], [
|
||||
'name' => 'Email',
|
||||
'db' => 'client_email',
|
||||
'th' => [ 'style' => 'width: 150px;' ],
|
||||
],
|
||||
[
|
||||
'name' => 'Telefon',
|
||||
'db' => 'client_phone',
|
||||
'th' => [ 'style' => 'width: 150px;' ],
|
||||
], [
|
||||
'name' => 'Miasto',
|
||||
'db' => 'client_city',
|
||||
'th' => [ 'style' => 'width: 150px;' ],
|
||||
], [
|
||||
'name' => 'Wartość zamówień',
|
||||
'db' => 'total_spent',
|
||||
'td' => [ 'class' => 'g-right' ],
|
||||
'th' => [ 'class' => 'g-right', 'style' => 'width: 150px;' ],
|
||||
'php' => 'echo number_format( "[total_spent]", 2, ".", " " ) . " zł";',
|
||||
], [
|
||||
'name' => 'Ilosc zamówień',
|
||||
'db' => 'total_orders',
|
||||
'td' => [ 'class' => 'g-center' ],
|
||||
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
|
||||
'php' => 'echo "<a href=\'/admin/shop_clients/clients_details/?name=[client_name]&surname=[client_surname]&email=[client_email]&total_spent=[total_spent]\'>[total_orders]</a>";'
|
||||
], [
|
||||
'name' => 'Akcje',
|
||||
'th' => [ 'class' => 'g-center', 'style' => 'width: 100px;' ],
|
||||
'td' => [ 'class' => 'g-center' ],
|
||||
'php' => 'echo "<a href=\'/admin/shop_clients/clients_details/?name=[client_name]&surname=[client_surname]&email=[client_email]&total_spent=[total_spent]\'>zobacz zamówienia</a>";',
|
||||
]
|
||||
];
|
||||
|
||||
echo $grid -> draw();
|
||||
<?= \Tpl::view('components/table-list', ['list' => $this->viewModel]); ?>
|
||||
@@ -55,7 +55,7 @@
|
||||
</div>
|
||||
<ul>
|
||||
<li> <a href="/admin/shop_order/view_list/"><img src="/admin/layout/icon/icon-menu/shopping-cart.svg">Zamówienia</a></li>
|
||||
<li> <a href="/admin/shop_clients/view_list/"><img src="/admin/layout/icon/icon-menu/people-fill.svg">Klienci</a></li>
|
||||
<li> <a href="/admin/shop_clients/list/"><img src="/admin/layout/icon/icon-menu/people-fill.svg">Klienci</a></li>
|
||||
<li><a href="/admin/shop_category/view_list/"><img src="/admin/layout/icon/icon-menu/bxs-category-alt.svg">Kategorie</a></li>
|
||||
<li><a href="/admin/shop_product/view_list/"><img src="/admin/layout/icon/icon-menu/shopping-basket.svg">Produkty</a></li>
|
||||
<li><a href="/admin/shop_product/mass_edit/"><i class="fa fa-bars"></i>Masowa edycja</a></li>
|
||||
|
||||
Reference in New Issue
Block a user