Skip to content

Commit

Permalink
Merge pull request #186 from Oneami/master
Browse files Browse the repository at this point in the history
141. Hide icon if comment is empty
  • Loading branch information
dmitrakovich authored Oct 24, 2023
2 parents 575909a + dfaa691 commit 59f1ba5
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/app/Admin/Controllers/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,15 @@ protected function grid()
$grid->column('user_addr', 'Адрес');
$grid->column('payment.name', 'Способ оплаты');
$grid->column('delivery.name', 'Способ доставки');
$grid->column('adminCommentsCollection', 'Коммент')->display(fn () => '💬')->expand(function ($model) {
$comments = $model->adminComments->map(function ($comment) {
return $comment->only(['created_at', 'comment']);
});
$grid->column('adminCommentsCollection', 'Коммент')
->display(fn () => count($this->adminComments) ? '💬' : null)
->display(fn ($value, $row) => count($this->adminComments) ? $row->expand(function ($model) {
$comments = $model->adminComments->map(function ($comment) {
return $comment->only(['created_at', 'comment']);
});

return new Table(['Дата создания', 'Коммент'], $comments->toArray());
});
return new Table(['Дата создания', 'Коммент'], $comments->toArray());
}) : null);

$grid->column('status_key', 'Статус')->editable('select', $orderStatuses);
$grid->column('admin_id', 'Менеджер')->editable('select', $admins);
Expand Down

0 comments on commit 59f1ba5

Please sign in to comment.