added new end of life
This commit is contained in:
@@ -19,6 +19,9 @@ class WarehouseArticleController extends TTCrud {
|
|||||||
['key' => 'warningAmount', 'text' => 'Warnmenge', 'required' => true,'modal' => ['type' => 'number'], 'table' => false],
|
['key' => 'warningAmount', 'text' => 'Warnmenge', 'required' => true,'modal' => ['type' => 'number'], 'table' => false],
|
||||||
['key' => 'criticalAmount', 'text' => 'Kritische Menge', 'required' => true,'modal' => ['type' => 'number'], 'table' => false],
|
['key' => 'criticalAmount', 'text' => 'Kritische Menge', 'required' => true,'modal' => ['type' => 'number'], 'table' => false],
|
||||||
['key' => 'isSerialDocumentation', 'text' => 'Seriennummern', 'required' => false,'modal' => ['type' => 'checkbox'], 'table' => false],
|
['key' => 'isSerialDocumentation', 'text' => 'Seriennummern', 'required' => false,'modal' => ['type' => 'checkbox'], 'table' => false],
|
||||||
|
['key' => 'isEndOfLife', 'text' => 'End of Life', 'required' => false,'modal' => ['type' => 'checkbox', 'items' => [
|
||||||
|
['value' => 0, 'text' => 'Nicht End of Life', 'icon' => 'fa-regular fa-circle-check text-success'],
|
||||||
|
['value' => 1, 'text' => 'End of Life', 'icon' => 'fa-regular fa-circle-xmark text-danger']]], 'table' => ['filter' => 'iconSelect']],
|
||||||
['key' => 'isEShop', 'text' => 'Ist E-Shop', 'required' => false,'modal' => ['type' => 'checkbox'], 'table' => false],
|
['key' => 'isEShop', 'text' => 'Ist E-Shop', 'required' => false,'modal' => ['type' => 'checkbox'], 'table' => false],
|
||||||
['key' => 'isEShopHide', 'text' => 'E-Shop Versteckt', 'required' => false,'modal' => ['type' => 'checkbox'], 'table' => false],
|
['key' => 'isEShopHide', 'text' => 'E-Shop Versteckt', 'required' => false,'modal' => ['type' => 'checkbox'], 'table' => false],
|
||||||
['key' => 'isSbidiShop', 'text' => 'Ist SBIDI-Shop', 'required' => false,'modal' => ['type' => 'checkbox'], 'table' => false],
|
['key' => 'isSbidiShop', 'text' => 'Ist SBIDI-Shop', 'required' => false,'modal' => ['type' => 'checkbox'], 'table' => false],
|
||||||
@@ -127,4 +130,37 @@ class WarehouseArticleController extends TTCrud {
|
|||||||
protected function getHistoryAction() {
|
protected function getHistoryAction() {
|
||||||
self::returnJson((new WarehouseHistoryController)->getHistory($this->request->id, $this->mod, $this->columns));
|
self::returnJson((new WarehouseHistoryController)->getHistory($this->request->id, $this->mod, $this->columns));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function autocompleteAction() {
|
||||||
|
$textKey = property_exists($this->model, 'name') ? 'name' : 'title';
|
||||||
|
if (strlen($this->request->searchedID) > 0) {
|
||||||
|
$filter = ['id' => $this->request->searchedID];
|
||||||
|
$data = $this->model::getAll($filter, 10);
|
||||||
|
} else {
|
||||||
|
if (isset($this->autocompleteColumns) && is_array($this->autocompleteColumns)) {
|
||||||
|
$filterKey = join('|', $this->autocompleteColumns);
|
||||||
|
} else {
|
||||||
|
$filterKey = $textKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
if (count($data) < 11) {
|
||||||
|
if (isset($_GET['hideEndOfLife'])) {
|
||||||
|
$data = $this->model::getAll([$textKey => $this->request->q . '%', 'isEndOfLife' => 0], 10);
|
||||||
|
$lazyData = $this->model::getAll([$filterKey => $this->request->q, 'isEndOfLife' => 0], 10);
|
||||||
|
} else {
|
||||||
|
$data = $this->model::getAll([$textKey => $this->request->q . '%'], 10);
|
||||||
|
$lazyData = $this->model::getAll([$filterKey => $this->request->q], 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = array_merge($data, $lazyData);
|
||||||
|
$data = array_unique($data, SORT_REGULAR);
|
||||||
|
$data = array_slice($data, 0, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self::returnJson(array_map(function ($item) use ($textKey) {
|
||||||
|
return ['value' => $item->id, 'text' => $item->$textKey];
|
||||||
|
}, $data));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ class WarehouseArticleModel extends TTCrudBaseModel {
|
|||||||
public ?int $isEShopHide;
|
public ?int $isEShopHide;
|
||||||
public ?int $isSbidiShop;
|
public ?int $isSbidiShop;
|
||||||
public ?int $isSbidiShopHide;
|
public ?int $isSbidiShopHide;
|
||||||
|
public ?int $isEndOfLife;
|
||||||
public string $unit;
|
public string $unit;
|
||||||
public ?int $isSerialDocumentation;
|
public ?int $isSerialDocumentation;
|
||||||
public int $revenueAccount;
|
public int $revenueAccount;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class WarehouseOrderRequestController extends TTCrud {
|
|||||||
'header' => 'Positionen',
|
'header' => 'Positionen',
|
||||||
'fields' => [
|
'fields' => [
|
||||||
'articleId' => [
|
'articleId' => [
|
||||||
'apiUrl' => '/WarehouseArticle/autoComplete',
|
'apiUrl' => '/WarehouseArticle/autoComplete?hideEndOfLife=1',
|
||||||
'type' => 'input-article',
|
'type' => 'input-article',
|
||||||
'emitDisplayValue' => true,
|
'emitDisplayValue' => true,
|
||||||
'customFieldReference' => 'WarehouseArticle',
|
'customFieldReference' => 'WarehouseArticle',
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Phinx\Migration\AbstractMigration;
|
||||||
|
|
||||||
|
final class WarehouseArticleAddIsEndOfLife extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
if ($this->getEnvironment() == "thetool") {
|
||||||
|
$this->table("WarehouseArticle")
|
||||||
|
->addColumn("isEndOfLife", "integer", ["null" => false, "default" => 0, "after" => "criticalAmount"])
|
||||||
|
->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
if ($this->getEnvironment() == "thetool") {
|
||||||
|
$this->table("WarehouseArticle")
|
||||||
|
->removeColumn("isEndOfLife")
|
||||||
|
->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -271,10 +271,10 @@ class TTCrud extends mfBaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function updateAction() {
|
protected function updateAction() {
|
||||||
if (property_exists($this->model, 'create') && isset($this->postData['create'])) {
|
if (property_exists($this->model, 'create')) {
|
||||||
$this->postData['create'] = $this->model::get($this->postData['id'])->create;
|
$this->postData['create'] = $this->model::get($this->postData['id'])->create;
|
||||||
}
|
}
|
||||||
if (property_exists($this->model, 'createBy') && isset($this->postData['createBy'])) {
|
if (property_exists($this->model, 'createBy')) {
|
||||||
$this->postData['createBy'] = $this->model::get($this->postData['id'])->createBy;
|
$this->postData['createBy'] = $this->model::get($this->postData['id'])->createBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,38 +1,43 @@
|
|||||||
/* style.css */
|
.end-of-life {
|
||||||
|
background-color: #f8d7da !important;
|
||||||
|
}
|
||||||
|
|
||||||
.warehouse-article-prices > div,
|
.warehouse-article-prices > div,
|
||||||
.warehouse-article-distributor > div {
|
.warehouse-article-distributor > div {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, minmax(150px, 1fr)) 120px; /* Defines 4 columns */
|
grid-template-columns: repeat(3, minmax(150px, 1fr)) 120px;
|
||||||
gap: 12px; /* Use gap for spacing */
|
gap: 12px;
|
||||||
margin-bottom: 8px; /* Add small gap between rows */
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.warehouse-article-prices .form-group,
|
.warehouse-article-prices .form-group,
|
||||||
.warehouse-article-distributor .form-group {
|
.warehouse-article-distributor .form-group {
|
||||||
margin-bottom: 0; /* Keep inputs tight in grid cells */
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 992px) {
|
@media (max-width: 992px) {
|
||||||
.warehouse-article-prices > div,
|
.warehouse-article-prices > div,
|
||||||
.warehouse-article-distributor > div {
|
.warehouse-article-distributor > div {
|
||||||
display: block; /* Stack items vertically */
|
display: block;
|
||||||
border: 1px solid #eee; /* Lighter border */
|
border: 1px solid #eee;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.warehouse-article-prices > div > *,
|
.warehouse-article-prices > div > *,
|
||||||
.warehouse-article-distributor > div > * {
|
.warehouse-article-distributor > div > * {
|
||||||
display: block; /* Ensure children are block */
|
display: block;
|
||||||
margin-bottom: 10px !important; /* Add space between stacked items */
|
margin-bottom: 10px !important;
|
||||||
}
|
}
|
||||||
.warehouse-article-prices > div > div:last-child, /* Target button container */
|
|
||||||
|
.warehouse-article-prices > div > div:last-child,
|
||||||
.warehouse-article-distributor > div > div:last-child {
|
.warehouse-article-distributor > div > div:last-child {
|
||||||
text-align: right; /* Keep buttons aligned right */
|
text-align: right;
|
||||||
margin-bottom: 0 !important; /* Remove extra margin below buttons */
|
margin-bottom: 0 !important;
|
||||||
}
|
}
|
||||||
.warehouse-article-prices > div > div:last-child > *, /* Target buttons inside */
|
|
||||||
|
.warehouse-article-prices > div > div:last-child > *,
|
||||||
.warehouse-article-distributor > div > div:last-child > * {
|
.warehouse-article-distributor > div > div:last-child > * {
|
||||||
margin-left: 5px; /* Add small space between buttons */
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
window.TT_CONFIG.CRUD_CONFIG.customRowClass = (row) => {
|
||||||
|
if (row.isEndOfLife) return 'end-of-life';
|
||||||
|
}
|
||||||
|
|
||||||
async function handleApiResponse(responsePromise) {
|
async function handleApiResponse(responsePromise) {
|
||||||
const res = await responsePromise;
|
const res = await responsePromise;
|
||||||
if (!res.data.success) {
|
if (!res.data.success) {
|
||||||
|
|||||||
Reference in New Issue
Block a user