add goyum hasaby

This commit is contained in:
2025-03-13 07:25:55 +05:00
parent 8bde60fc8d
commit b5a9cfe7f5
4 changed files with 106 additions and 2 deletions

View File

@@ -53,6 +53,31 @@ class SberPaymentOrderFieldsForIndex
->withIcons()
->icons(OrderRepo::statusIcons())
->sortable(),
Text::make(sprintf('%s (%s)', __('Paid'), __('This month')), function () use ($resource) {
return static::paidField($resource, $resource->filter_month);
}),
];
}
/**
* Paid field
*/
public static function paidField($resource, $date = null)
{
$paid = false;
$items = $resource->paymentItems;
$month = $date ?: date('m');
foreach ($items as $item) {
if (boolval($item->paid)) {
if ($item->created_at->format('m') == $month) {
$paid = true;
}
}
}
return $paid ? 'Tölenen' : 'Tölenmedik';
}
}