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

@@ -59,6 +59,10 @@ class SberPaymentOrderFieldsForDetail
->withIcons()
->icons(OrderRepo::statusIcons()),
Text::make(sprintf('%s (%s)', __('Paid'), __('This month')), function () use ($resource) {
return static::paidField($resource, $resource->filter_month);
}),
Text::make(__('Note'), 'notes')
->fullWidth()
->canSeeWhen('systemUser', $resource),
@@ -118,6 +122,12 @@ class SberPaymentOrderFieldsForDetail
attribute: 'full_name'
)
->rules('required', 'max:255'),
Text::make(
name: __('Goýum hasaby'),
attribute: 'deposit_account'
)
->rules('required', 'max:255'),
])->minRows(1)->rules('required'),
SimpleRepeatable::make(__('Payee information'), 'payment_reciever', [
@@ -175,4 +185,25 @@ class SberPaymentOrderFieldsForDetail
HasMany::make(__('Payment items'), 'paymentItems', NovaSberPaymentOrderItem::class),
];
}
/**
* 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';
}
}