-
Notifications
You must be signed in to change notification settings - Fork 3
/
stock.php
43 lines (28 loc) · 1.29 KB
/
stock.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
include'vendor/autoload.php';
$app = new Warehouse();
$cr = $app->layout->add('CRUD');
//$cr->addColumn(new \atk4\ui\TableColumn\Template('<a href="article.php?article_id={$id}"><i class="stack overflow icon"></i> {$name}: {$stock} in stock</a>'));
$cr->fieldsGrid = ['id', 'name', 'vendor', 'category', 'stock'];
$m = new Article($app->db);
if ($category_id = $app->stickyGET('category_id')) {
$m->addCondition('category_id', $category_id);
$msg = $cr->add(['Message','Filters Active:']);
$msg->add(['Label', $m->refModel('category_id')->load($category_id)['name'], 'detail'=>'category', 'iconRight'=>'close'])
->link(['category_id'=>false]);
}
if ($app->stickyGET('negative')) {
$m->addCondition('stock', '<', 0);
$msg = $cr->add(['Message','Filters Active:']);
$msg->add(['Label', 'Only negative stock', 'detail'=>'category', 'iconRight'=>'close'])
->link(['negative'=>false]);
}
$cr->setModel($m);
$cr->addColumn('name', ['TableColumn/Link', 'article', 'args'=>['article_id'=>'id']]);
$cr->addQuickSearch(['name','category','vendor']);
$cr->menu->addItem(new ui\Manager(['Brands', 'icon'=>'tag']))
->setModel(new Brand($app->db));
/*
$cr->menu->addItem(new ui\Manager(['Categories', 'icon'=>'folder']))
->setModel(new SelectableCategory($app->db));
*/