stan errors
This commit is contained in:
@@ -60,7 +60,10 @@ class VisaMasterPaymentOrderFieldsForDetail
|
|||||||
->icons(OrderRepo::statusIcons()),
|
->icons(OrderRepo::statusIcons()),
|
||||||
|
|
||||||
Text::make(sprintf('%s (%s)', __('Paid'), __('This month')), function () use ($resource) {
|
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
|
||||||
|
);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
Text::make(__('Note'), 'notes')
|
Text::make(__('Note'), 'notes')
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Modules\VisaMasterPaymentOrder\Nova\Resources\Concerns;
|
namespace App\Modules\VisaMasterPaymentOrder\Nova\Resources\Concerns;
|
||||||
|
|
||||||
use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder;
|
use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder;
|
||||||
|
use App\Modules\VisaMasterPaymentOrder\Nova\Resources\NovaVisaMasterPaymentOrder;
|
||||||
use App\Nova\Resources\Branch\Branch;
|
use App\Nova\Resources\Branch\Branch;
|
||||||
use App\Repos\Order\OrderRepo;
|
use App\Repos\Order\OrderRepo;
|
||||||
use App\Repos\System\Settings\Location\RegionRepo;
|
use App\Repos\System\Settings\Location\RegionRepo;
|
||||||
@@ -17,8 +18,10 @@ class VisaMasterPaymentOrderFieldsForIndex
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Loan Order fields for "create"
|
* 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 [
|
return [
|
||||||
ID::make()->hide(),
|
ID::make()->hide(),
|
||||||
@@ -63,7 +66,10 @@ class VisaMasterPaymentOrderFieldsForIndex
|
|||||||
->sortable(),
|
->sortable(),
|
||||||
|
|
||||||
Text::make(sprintf('%s (%s)', __('Paid'), __('This month')), function () use ($resource) {
|
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
|
* Paid field
|
||||||
*/
|
*/
|
||||||
public static function paidField($resource, $date = null)
|
public static function paidField(NovaVisaMasterPaymentOrder $resource, ?string $date = null): string
|
||||||
{
|
{
|
||||||
$paid = false;
|
/** @var \App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder */
|
||||||
$items = $resource->paymentItems;
|
$model = $resource->model();
|
||||||
|
|
||||||
|
$items = $model->paymentItems;
|
||||||
|
|
||||||
$month = $date ?: date('m');
|
$month = $date ?: date('m');
|
||||||
|
|
||||||
|
$paid = false;
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
if (boolval($item->paid)) {
|
if (boolval($item->paid)) {
|
||||||
if ($item->created_at->format('m') == $month) {
|
if ($item->created_at->format('m') == $month) {
|
||||||
|
|||||||
@@ -115,8 +115,8 @@ class NovaVisaMasterPaymentOrder extends Resource
|
|||||||
/**
|
/**
|
||||||
* Build an "index" query for the given resource.
|
* Build an "index" query for the given resource.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
* @param \Illuminate\Database\Eloquent\Builder<\App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder> $query
|
||||||
* @return \Illuminate\Database\Eloquent\Builder
|
* @return \Illuminate\Database\Eloquent\Builder<\App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder>
|
||||||
*/
|
*/
|
||||||
public static function indexQuery(NovaRequest $request, mixed $query): Builder
|
public static function indexQuery(NovaRequest $request, mixed $query): Builder
|
||||||
{
|
{
|
||||||
@@ -146,6 +146,8 @@ class NovaVisaMasterPaymentOrder extends Resource
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the fields for index.
|
* Get the fields for index.
|
||||||
|
*
|
||||||
|
* @return array<int, \Laravel\Nova\Fields\Field>
|
||||||
*/
|
*/
|
||||||
public function fieldsForIndex(): array
|
public function fieldsForIndex(): array
|
||||||
{
|
{
|
||||||
@@ -154,6 +156,8 @@ class NovaVisaMasterPaymentOrder extends Resource
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the fields for detail
|
* Get the fields for detail
|
||||||
|
*
|
||||||
|
* @return array<int, \Laravel\Nova\Panel|\Laravel\Nova\Fields\Field>
|
||||||
*/
|
*/
|
||||||
public function fieldsForDetail(): array
|
public function fieldsForDetail(): array
|
||||||
{
|
{
|
||||||
@@ -358,6 +362,8 @@ class NovaVisaMasterPaymentOrder extends Resource
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Actions
|
* Actions
|
||||||
|
*
|
||||||
|
* @return array<int, \Laravel\Nova\Actions\Action>
|
||||||
*/
|
*/
|
||||||
public function actions(NovaRequest $request): array
|
public function actions(NovaRequest $request): array
|
||||||
{
|
{
|
||||||
@@ -381,22 +387,12 @@ class NovaVisaMasterPaymentOrder extends Resource
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the lenses available for the resource.
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function lenses(NovaRequest $request): array
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the cards available for the request.
|
* Get the cards available for the request.
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array<int, \Laravel\Nova\Card>
|
||||||
*/
|
*/
|
||||||
public function cards(NovaRequest $request)
|
public function cards(NovaRequest $request): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
new NovaDetachedFilters($this->myFilters()),
|
new NovaDetachedFilters($this->myFilters()),
|
||||||
@@ -406,14 +402,19 @@ class NovaVisaMasterPaymentOrder extends Resource
|
|||||||
/**
|
/**
|
||||||
* Get the filters available for the resource.
|
* Get the filters available for the resource.
|
||||||
*
|
*
|
||||||
* @return array<int, string>
|
* @return array<int, \Laravel\Nova\Filters\Filter>
|
||||||
*/
|
*/
|
||||||
public function filters(NovaRequest $request)
|
public function filters(NovaRequest $request): array
|
||||||
{
|
{
|
||||||
return $this->myFilters();
|
return $this->myFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function myFilters()
|
/**
|
||||||
|
* My filters
|
||||||
|
*
|
||||||
|
* @return array<int, \Laravel\Nova\Filters\Filter>
|
||||||
|
*/
|
||||||
|
public function myFilters(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
VisaMasterMonthlyPaidFilter::make(),
|
VisaMasterMonthlyPaidFilter::make(),
|
||||||
|
|||||||
@@ -123,6 +123,12 @@ class NovaVisaMasterPaymentOrderItem extends Resource
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actions
|
||||||
|
*
|
||||||
|
* @param NovaRequest $request
|
||||||
|
* @return array<int, \Laravel\Nova\Actions\Action>
|
||||||
|
*/
|
||||||
public function actions(NovaRequest $request): array
|
public function actions(NovaRequest $request): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ class VisaMasterPaymentOrderFileFields
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Reciver files
|
* Reciver files
|
||||||
|
*
|
||||||
|
* @return array<int, \Laravel\Nova\Fields\Field>
|
||||||
*/
|
*/
|
||||||
public static function reciverFiles(): array
|
public static function reciverFiles(): array
|
||||||
{
|
{
|
||||||
@@ -24,6 +26,8 @@ class VisaMasterPaymentOrderFileFields
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sender files
|
* Sender files
|
||||||
|
*
|
||||||
|
* @return array<int, \Laravel\Nova\Fields\Field>
|
||||||
*/
|
*/
|
||||||
public static function senderFiles(): array
|
public static function senderFiles(): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class CheckOnlinePayment extends Action
|
|||||||
* Perform the action on the given models.
|
* Perform the action on the given models.
|
||||||
*
|
*
|
||||||
* @param \Laravel\Nova\Fields\ActionFields $fields
|
* @param \Laravel\Nova\Fields\ActionFields $fields
|
||||||
* @param \Illuminate\Support\Collection $models
|
* @param \Illuminate\Support\Collection<array-key, \App\Models\Payment\OnlinePaymentHistory> $models
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle(ActionFields $fields, Collection $models)
|
public function handle(ActionFields $fields, Collection $models)
|
||||||
@@ -81,7 +81,7 @@ class CheckOnlinePayment extends Action
|
|||||||
* Get the fields available on the action.
|
* Get the fields available on the action.
|
||||||
*
|
*
|
||||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||||
* @return array
|
* @return array<int, \Laravel\Nova\Fields\Field>
|
||||||
*/
|
*/
|
||||||
public function fields(NovaRequest $request)
|
public function fields(NovaRequest $request)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ class ExportTranslations extends Action
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform the action on the given models.
|
* Perform the action on the given models.
|
||||||
|
*
|
||||||
|
* @param ActionFields $fields
|
||||||
|
* @param Collection<array-key, \Illuminate\Database\Eloquent\Model> $models
|
||||||
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle(ActionFields $fields, Collection $models): mixed
|
public function handle(ActionFields $fields, Collection $models): mixed
|
||||||
{
|
{
|
||||||
@@ -27,6 +31,8 @@ class ExportTranslations extends Action
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the fields available on the action.
|
* Get the fields available on the action.
|
||||||
|
*
|
||||||
|
* @return array<int, \Laravel\Nova\Fields\Field>
|
||||||
*/
|
*/
|
||||||
public function fields(NovaRequest $request): array
|
public function fields(NovaRequest $request): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,10 +39,10 @@ class MakePaymentNovaVisaMaster extends Action
|
|||||||
* Perform the action on the given models.
|
* Perform the action on the given models.
|
||||||
*
|
*
|
||||||
* @param \Laravel\Nova\Fields\ActionFields $fields
|
* @param \Laravel\Nova\Fields\ActionFields $fields
|
||||||
* @param \Illuminate\Support\Collection $models
|
* @param \Illuminate\Support\Collection<array-key, \App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder> $models
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle(ActionFields $fields, Collection $models)
|
public function handle(ActionFields $fields, Collection $models): mixed
|
||||||
{
|
{
|
||||||
$payment_amount = $fields->get('payment_amount');
|
$payment_amount = $fields->get('payment_amount');
|
||||||
$usd_payment = $fields->get('usd_payment');
|
$usd_payment = $fields->get('usd_payment');
|
||||||
@@ -108,7 +108,7 @@ class MakePaymentNovaVisaMaster extends Action
|
|||||||
* Get the fields available on the action.
|
* Get the fields available on the action.
|
||||||
*
|
*
|
||||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||||
* @return array
|
* @return array<int, \Laravel\Nova\Fields\Field>
|
||||||
*/
|
*/
|
||||||
public function fields(NovaRequest $request): array
|
public function fields(NovaRequest $request): array
|
||||||
{
|
{
|
||||||
@@ -192,9 +192,13 @@ class MakePaymentNovaVisaMaster extends Action
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Order a payment page
|
* Order a payment page
|
||||||
|
*
|
||||||
|
* @return array<string, string>
|
||||||
*/
|
*/
|
||||||
public function order($resource, $amount)
|
public function order(
|
||||||
{
|
\App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder $resource,
|
||||||
|
int|float|string $amount
|
||||||
|
): array {
|
||||||
$onlinePaymentRepo = OnlinePaymentRepo::make();
|
$onlinePaymentRepo = OnlinePaymentRepo::make();
|
||||||
|
|
||||||
$orderNumber = $onlinePaymentRepo->generateOrderNumber($resource);
|
$orderNumber = $onlinePaymentRepo->generateOrderNumber($resource);
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ class Main extends Dashboard
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the cards for the dashboard.
|
* Get the cards for the dashboard.
|
||||||
|
*
|
||||||
|
* @return array<int, \Laravel\Nova\Card>
|
||||||
*/
|
*/
|
||||||
public function cards(): array
|
public function cards(): array
|
||||||
{
|
{
|
||||||
@@ -32,7 +34,6 @@ class Main extends Dashboard
|
|||||||
|
|
||||||
LoanOrderPerStatus::make()
|
LoanOrderPerStatus::make()
|
||||||
->canSee(fn () => Gate::allows('isAdmin', auth()->user()->isAdmin())),
|
->canSee(fn () => Gate::allows('isAdmin', auth()->user()->isAdmin())),
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ class ProductType extends Filter
|
|||||||
/**
|
/**
|
||||||
* Get the filter's available options.
|
* Get the filter's available options.
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array<int|string, int|string>
|
||||||
*/
|
*/
|
||||||
public function options(NovaRequest $request)
|
public function options(NovaRequest $request): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user