stan errors

This commit is contained in:
2025-03-15 23:58:38 +05:00
parent ed80105dc5
commit 007be865fe
10 changed files with 67 additions and 33 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Modules\VisaMasterPaymentOrder\Nova\Resources\Concerns;
use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder;
use App\Modules\VisaMasterPaymentOrder\Nova\Resources\NovaVisaMasterPaymentOrder;
use App\Nova\Resources\Branch\Branch;
use App\Repos\Order\OrderRepo;
use App\Repos\System\Settings\Location\RegionRepo;
@@ -17,8 +18,10 @@ class VisaMasterPaymentOrderFieldsForIndex
{
/**
* Loan Order fields for "create"
*
* @return array<int, \Laravel\Nova\Fields\Field>
*/
public static function make($resource, $date = null): array
public static function make(NovaVisaMasterPaymentOrder $resource): array
{
return [
ID::make()->hide(),
@@ -63,7 +66,10 @@ class VisaMasterPaymentOrderFieldsForIndex
->sortable(),
Text::make(sprintf('%s (%s)', __('Paid'), __('This month')), function () use ($resource) {
return static::paidField($resource, $resource->filter_month);
return static::paidField(
$resource,
$resource->offsetExists('filter_month') ? $resource->offsetGet('filter_month') : null
);
}),
];
}
@@ -71,13 +77,16 @@ class VisaMasterPaymentOrderFieldsForIndex
/**
* Paid field
*/
public static function paidField($resource, $date = null)
public static function paidField(NovaVisaMasterPaymentOrder $resource, ?string $date = null): string
{
$paid = false;
$items = $resource->paymentItems;
/** @var \App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder */
$model = $resource->model();
$items = $model->paymentItems;
$month = $date ?: date('m');
$paid = false;
foreach ($items as $item) {
if (boolval($item->paid)) {
if ($item->created_at->format('m') == $month) {