add goyum hasaby
This commit is contained in:
@@ -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';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ use App\Modules\SberPaymentOrder\Nova\Resources\Concerns\NovaSberPaymentOrderAut
|
||||
use App\Modules\SberPaymentOrder\Nova\Resources\Concerns\SberPaymentOrderFieldsForDetail;
|
||||
use App\Modules\SberPaymentOrder\Nova\Resources\Concerns\SberPaymentOrderFieldsForIndex;
|
||||
use App\Nova\Actions\MakeSberPaymentAction;
|
||||
use App\Nova\Filters\VisaMasterMonthlyPaidFilter;
|
||||
use App\Nova\Resource;
|
||||
use App\Repos\Order\Card\CardOrderRepo;
|
||||
use App\Repos\Order\OrderRepo;
|
||||
@@ -26,6 +27,7 @@ use Laravel\Nova\Fields\Text;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
use Laravel\Nova\Panel;
|
||||
use Nurmuhammet\NovaInputmask\NovaInputmask;
|
||||
use Outl1ne\NovaDetachedFilters\NovaDetachedFilters;
|
||||
use Outl1ne\NovaSimpleRepeatable\SimpleRepeatable;
|
||||
|
||||
/**
|
||||
@@ -63,7 +65,7 @@ class NovaSberPaymentOrder extends Resource
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $with = ['branch'];
|
||||
public static $with = ['branch', 'paymentItems'];
|
||||
|
||||
/**
|
||||
* Indicates whether the resource should automatically poll for new resources.
|
||||
@@ -265,6 +267,12 @@ class NovaSberPaymentOrder extends Resource
|
||||
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', [
|
||||
@@ -349,4 +357,33 @@ class NovaSberPaymentOrder extends Resource
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cards available for the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function cards(NovaRequest $request)
|
||||
{
|
||||
return [
|
||||
new NovaDetachedFilters($this->myFilters()),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filters available for the resource.
|
||||
*
|
||||
* @return array<int, string>
|
||||
*/
|
||||
public function filters(NovaRequest $request)
|
||||
{
|
||||
return $this->myFilters();
|
||||
}
|
||||
|
||||
public function myFilters()
|
||||
{
|
||||
return [
|
||||
VisaMasterMonthlyPaidFilter::make('sber_payment_orders'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user