wip
This commit is contained in:
@@ -3,10 +3,12 @@
|
||||
namespace App\Modules\VisaMasterPaymentOrder\Nova\Resources\Concerns;
|
||||
|
||||
use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder;
|
||||
use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrderItem;
|
||||
use App\Nova\Resources\Branch\Branch;
|
||||
use App\Repos\Order\OrderRepo;
|
||||
use App\Repos\System\Settings\Location\RegionRepo;
|
||||
use Closure;
|
||||
use Laravel\Nova\Fields\Boolean;
|
||||
use Laravel\Nova\Fields\Badge;
|
||||
use Laravel\Nova\Fields\BelongsTo;
|
||||
use Laravel\Nova\Fields\DateTime;
|
||||
@@ -63,17 +65,28 @@ class VisaMasterPaymentOrderFieldsForIndex
|
||||
->icons(OrderRepo::statusIcons())
|
||||
->sortable(),
|
||||
|
||||
Text::make(__('Paid'), static::paidField()),
|
||||
Text::make(sprintf('%s (%s)', __('Paid'), __('This month')), function () use ($resource) {
|
||||
return static::paidField($resource);
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Paid field
|
||||
*/
|
||||
public static function paidField(): Closure
|
||||
public static function paidField($resource)
|
||||
{
|
||||
return function () {
|
||||
return 'OK';
|
||||
};
|
||||
$paid = false;
|
||||
$items = $resource->paymentItems;
|
||||
|
||||
foreach ($items as $item) {
|
||||
if (boolval($item->paid)) {
|
||||
if ($item->created_at->format('m') == date('m')) {
|
||||
$paid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $paid ? 'Tölenen' : 'Tölenmedik';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user