Feature/warehouse improve 2
This commit is contained in:
@@ -9,6 +9,7 @@ class WarehouseEShopOrderController extends TTCrud {
|
||||
['key' => 'id', 'text' => 'ID', 'modal' => false],
|
||||
['key' => 'extRef', 'text' => 'Externe Referenz', 'required' => true],
|
||||
['key' => 'status', 'text' => 'Status', 'required' => true, 'modal' => ['type' => 'select', 'items' => [['value' => 'new', 'text' => 'Neu'], ['value' => 'accepted', 'text' => 'An Lieferant übergeben'], ['value' => 'acceptedInternally', 'text' => 'Interne verarbeitung'], ['value' => 'sent', 'text' => 'Gesendet'], ['value' => 'done', 'text' => 'Erledigt'],]], 'table' => ['filter' => 'select']],
|
||||
['key' => 'shippingNoteStatus', 'text' => 'LS-Status', 'required' => false, 'modal' => false, 'table' => ['filter' => false, 'order' => false]],
|
||||
['key' => 'deliveryMode', 'text' => 'Liefermodus', 'required' => true, 'modal' => ['type' => 'select', 'items' => [['value' => 'singleAddress', 'text' => 'Einzelne Adresse']]]],
|
||||
['key' => 'deliveryAddressName', 'text' => 'Name', 'required' => true],
|
||||
['key' => 'deliveryAddressLine', 'text' => 'Adresse', 'required' => true, 'required_length' => 4],
|
||||
@@ -39,12 +40,32 @@ class WarehouseEShopOrderController extends TTCrud {
|
||||
return $this->user->can(["WarehouseEShop"]);
|
||||
}
|
||||
|
||||
protected function customRowsHandler($rows): array {
|
||||
$statusToText = [
|
||||
'new' => 'Neu',
|
||||
'accepted' => 'Akzeptiert',
|
||||
'invoiced' => 'Verrechnet',
|
||||
'in_progress' => 'In Bearbeitung',
|
||||
];
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$shippingNote = WarehouseShippingNoteModel::getAll(['eShopOrderId' => $row->id]);
|
||||
if (empty($shippingNote)) {
|
||||
$row->shippingNoteStatus = 'Kein LS';
|
||||
} else {
|
||||
$row->shippingNoteStatus = $statusToText[$shippingNote[0]->status];
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
protected function prepareCrudConfig() {
|
||||
$users = array_map(function ($user) {
|
||||
return ['value' => intval($user->id), 'text' => $user->name];
|
||||
}, UserModel::search());
|
||||
|
||||
$this->columns[10]['modal']['items'] = $users;
|
||||
$this->columns[11]['modal']['items'] = $users;
|
||||
}
|
||||
|
||||
protected function createShippingNote() {
|
||||
|
||||
@@ -223,6 +223,11 @@ class WarehouseShippingNoteController extends TTCrud {
|
||||
} else {
|
||||
$position['articleTitle'] = $article->title;
|
||||
}
|
||||
|
||||
if (isset($position['isEnergieMaterial']) && $position['isEnergieMaterial'] == 1) {
|
||||
$position['articleTitle'] .= " (ESTMK)";
|
||||
}
|
||||
|
||||
$position['articleDescription'] = $article->description === $article->title ? "" : $article->description;
|
||||
$position['articleUnit'] = $article->unit;
|
||||
$positions[] = $position;
|
||||
|
||||
@@ -165,6 +165,10 @@ class TTCrud extends mfBaseController {
|
||||
}
|
||||
}
|
||||
|
||||
if (method_exists($this, 'customRowsHandler')) {
|
||||
$rows = $this->customRowsHandler($rows);
|
||||
}
|
||||
|
||||
self::returnJson(["rows" => $rows,
|
||||
"autoCompleteData" => $autocompleteData,
|
||||
"pagination" => ["page" => $page,
|
||||
@@ -201,12 +205,12 @@ class TTCrud extends mfBaseController {
|
||||
}
|
||||
|
||||
protected function updateAction() {
|
||||
if (property_exists($this->model, 'createBy') && !isset($this->postData['createBy'])) {
|
||||
$this->postData['createBy'] = $this->user->id;
|
||||
}
|
||||
if (property_exists($this->model, 'create') && !isset($this->postData['create'])) {
|
||||
$this->postData['create'] = time();
|
||||
}
|
||||
// if (property_exists($this->model, 'createBy') && !isset($this->postData['createBy'])) {
|
||||
// $this->postData['createBy'] = $this->user->id;
|
||||
// }
|
||||
// if (property_exists($this->model, 'create') && !isset($this->postData['create'])) {
|
||||
// $this->postData['create'] = time();
|
||||
// }
|
||||
|
||||
Helper::validateArray($this->postData, array_merge($this->checkArray, ['id' => ['required' => true]]));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user