Lager-Artikel vollstaendig aus der DB anzeigen
This commit is contained in:
1 parent
2bdbec7766
commit
9917462350
3 files changed
+7
-11
No files matched your search
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
function get_lager_bundle_overview(PDO $pdo): array
|
||||
function get_lager_artikel_overview(PDO $pdo): array
|
||||
{
|
||||
$stmt = $pdo->query(
|
||||
"SELECT
|
||||
@@ -9,11 +9,7 @@ function get_lager_bundle_overview(PDO $pdo): array
|
||||
si.item_code,
|
||||
si.display_name
|
||||
FROM sellable_item si
|
||||
INNER JOIN sellable_item_component sic
|
||||
ON sic.sellable_item_id = si.id
|
||||
WHERE si.status = 'active'
|
||||
GROUP BY si.id, si.item_code, si.display_name
|
||||
HAVING SUM(sic.qty_per_item) > 1
|
||||
ORDER BY si.display_name ASC, si.id ASC"
|
||||
);
|
||||
|
||||
|
||||
@@ -237,12 +237,12 @@ function auth_render_lager_table(string $title, array $rows, array $columns, str
|
||||
return implode('', $html);
|
||||
}
|
||||
|
||||
function auth_render_lager_content(array $lagerProducts, array $lagerBundles): string
|
||||
function auth_render_lager_content(array $lagerProducts, array $lagerArtikel): string
|
||||
{
|
||||
return '<div data-lager-content="true">'
|
||||
. '<section class="sg-card-list-page" aria-label="Lager">'
|
||||
. auth_render_lager_table('Produkte', $lagerProducts, ['Produktname', 'Anzahl im Lager'], 'products')
|
||||
. auth_render_lager_table('Artikel', $lagerBundles, ['Artikel-Name'], 'bundles')
|
||||
. auth_render_lager_table('Artikel', $lagerArtikel, ['Artikel-Name'], 'articles')
|
||||
. '</section>'
|
||||
. '<div class="sg-card-list-page-drawer-backdrop" aria-hidden="true" data-lager-drawer-backdrop="true" data-open="false"></div>'
|
||||
. '<aside class="sg-card-list-page-drawer" aria-label="Lager-Details" aria-hidden="true" data-lager-drawer="true" data-open="false">'
|
||||
@@ -252,7 +252,7 @@ function auth_render_lager_content(array $lagerProducts, array $lagerBundles): s
|
||||
. '</div>';
|
||||
}
|
||||
|
||||
function render_auth_home_page(array $user, array $otcProducts = [], array $bestellungenTable = [], array $lagerProducts = [], array $lagerBundles = []): void
|
||||
function render_auth_home_page(array $user, array $otcProducts = [], array $bestellungenTable = [], array $lagerProducts = [], array $lagerArtikel = []): void
|
||||
{
|
||||
$otcProductRows = '';
|
||||
foreach ($otcProducts as $product) {
|
||||
@@ -281,7 +281,7 @@ function render_auth_home_page(array $user, array $otcProducts = [], array $best
|
||||
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
|
||||
);
|
||||
$bestellungenContent = auth_render_bestellungen_content($bestellungenTable);
|
||||
$lagerContent = auth_render_lager_content($lagerProducts, $lagerBundles);
|
||||
$lagerContent = auth_render_lager_content($lagerProducts, $lagerArtikel);
|
||||
$moduleContentCards = json_encode(
|
||||
[
|
||||
'Bestellungen' => $bestellungenContent,
|
||||
|
||||
+2
-2
@@ -48,7 +48,7 @@ $currentUser = auth_current_user($pdo);
|
||||
if ($currentUser !== null) {
|
||||
$otcProducts = get_otc_order_form_products($pdo);
|
||||
$lagerProducts = get_lager_product_overview($pdo);
|
||||
$lagerBundles = get_lager_bundle_overview($pdo);
|
||||
$lagerArtikel = get_lager_artikel_overview($pdo);
|
||||
$bestellungenTable = get_sales_order_overview($pdo, [
|
||||
'search' => (string) ($_GET['bestellungen_search'] ?? ''),
|
||||
'sort_column' => (string) ($_GET['bestellungen_sort'] ?? 'order_date'),
|
||||
@@ -60,7 +60,7 @@ if ($currentUser !== null) {
|
||||
echo auth_render_bestellungen_content($bestellungenTable);
|
||||
exit;
|
||||
}
|
||||
render_auth_home_page($currentUser, $otcProducts, $bestellungenTable, $lagerProducts, $lagerBundles);
|
||||
render_auth_home_page($currentUser, $otcProducts, $bestellungenTable, $lagerProducts, $lagerArtikel);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user