stan errors
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user