phpstan errors & onlinepayment extended
This commit is contained in:
@@ -95,7 +95,7 @@ class SberPaymentOrder extends Model implements HasMedia
|
|||||||
/**
|
/**
|
||||||
* Required files
|
* Required files
|
||||||
*
|
*
|
||||||
* @return array<array<string, bool|string>>
|
* @return array<int, array<string, bool|string>>
|
||||||
*/
|
*/
|
||||||
public static function reciverFiles(): array
|
public static function reciverFiles(): array
|
||||||
{
|
{
|
||||||
@@ -145,6 +145,8 @@ class SberPaymentOrder extends Model implements HasMedia
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sender files
|
* Sender files
|
||||||
|
*
|
||||||
|
* @return array<int, array<string, bool|string>>
|
||||||
*/
|
*/
|
||||||
public static function senderFiles(): array
|
public static function senderFiles(): array
|
||||||
{
|
{
|
||||||
@@ -213,6 +215,8 @@ class SberPaymentOrder extends Model implements HasMedia
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Payment itmes
|
* Payment itmes
|
||||||
|
*
|
||||||
|
* @return HasMany<SberPaymentOrderItem>
|
||||||
*/
|
*/
|
||||||
public function paymentItems(): HasMany
|
public function paymentItems(): HasMany
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ class SberPaymentOrderItem extends Model implements HasMedia
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Parent order
|
* Parent order
|
||||||
|
*
|
||||||
|
* @return BelongsTo<SberPaymentOrder, SberPaymentOrderItem>
|
||||||
*/
|
*/
|
||||||
public function parent(): BelongsTo
|
public function parent(): BelongsTo
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Modules\SberPaymentOrder\Nova\Resources\Concerns;
|
namespace App\Modules\SberPaymentOrder\Nova\Resources\Concerns;
|
||||||
|
|
||||||
|
use App\Modules\SberPaymentOrder\Nova\Resources\NovaSberPaymentOrder;
|
||||||
use App\Modules\SberPaymentOrder\Nova\Resources\NovaSberPaymentOrderItem;
|
use App\Modules\SberPaymentOrder\Nova\Resources\NovaSberPaymentOrderItem;
|
||||||
use App\Nova\Resources\Branch\Branch;
|
use App\Nova\Resources\Branch\Branch;
|
||||||
use App\Repos\Order\OrderRepo;
|
use App\Repos\Order\OrderRepo;
|
||||||
@@ -11,7 +12,6 @@ use Ebess\AdvancedNovaMediaLibrary\Fields\Files;
|
|||||||
use Laravel\Nova\Fields\Badge;
|
use Laravel\Nova\Fields\Badge;
|
||||||
use Laravel\Nova\Fields\BelongsTo;
|
use Laravel\Nova\Fields\BelongsTo;
|
||||||
use Laravel\Nova\Fields\HasMany;
|
use Laravel\Nova\Fields\HasMany;
|
||||||
use Laravel\Nova\Fields\Hidden;
|
|
||||||
use Laravel\Nova\Fields\ID;
|
use Laravel\Nova\Fields\ID;
|
||||||
use Laravel\Nova\Fields\Select;
|
use Laravel\Nova\Fields\Select;
|
||||||
use Laravel\Nova\Fields\Text;
|
use Laravel\Nova\Fields\Text;
|
||||||
@@ -24,31 +24,16 @@ class SberPaymentOrderFieldsForDetail
|
|||||||
/**
|
/**
|
||||||
* Get fields for detail view
|
* Get fields for detail view
|
||||||
*
|
*
|
||||||
* @return array
|
* @param NovaSberPaymentOrder $resource
|
||||||
|
* @return array<int, Panel|\Laravel\Nova\Fields\Field|array<int, \Laravel\Nova\Fields\Field>>
|
||||||
*/
|
*/
|
||||||
public static function make($resource): array
|
public static function make(NovaSberPaymentOrder $resource): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
new Panel(__('Status'), [
|
new Panel(__('Status'), [
|
||||||
ID::make()
|
ID::make()->hide(),
|
||||||
->hideFromDetail(),
|
|
||||||
|
|
||||||
Hidden::make('user_id')
|
Text::make(__('ID'), 'unique_id'),
|
||||||
->default(auth()->id())
|
|
||||||
->hideWhenUpdating(),
|
|
||||||
|
|
||||||
Text::make(__('ID'), 'unique_id')
|
|
||||||
->exceptOnForms(),
|
|
||||||
|
|
||||||
Select::make(__('Status'), 'status')
|
|
||||||
->displayUsingLabels()
|
|
||||||
->searchable()
|
|
||||||
->options(OrderRepo::statusValues())
|
|
||||||
->default(OrderRepo::defaultStatus())
|
|
||||||
->fullWidth()
|
|
||||||
->hideFromDetail()
|
|
||||||
->rules('required')
|
|
||||||
->canSeeWhen('systemUser', $resource),
|
|
||||||
|
|
||||||
Badge::make(__('Status'), 'status')
|
Badge::make(__('Status'), 'status')
|
||||||
->map(OrderRepo::statusClasses())
|
->map(OrderRepo::statusClasses())
|
||||||
@@ -60,7 +45,7 @@ class SberPaymentOrderFieldsForDetail
|
|||||||
->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);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
Text::make(__('Note'), 'notes')
|
Text::make(__('Note'), 'notes')
|
||||||
@@ -69,53 +54,31 @@ class SberPaymentOrderFieldsForDetail
|
|||||||
]),
|
]),
|
||||||
new Panel(__('Location'), [
|
new Panel(__('Location'), [
|
||||||
Select::make(__('Region'), 'region')
|
Select::make(__('Region'), 'region')
|
||||||
->fullWidth()
|
|
||||||
->displayUsingLabels()
|
->displayUsingLabels()
|
||||||
->searchable()
|
->options(RegionRepo::values()),
|
||||||
->options(RegionRepo::values())
|
|
||||||
->default(RegionRepo::default())
|
|
||||||
->rules('required')
|
|
||||||
->sortable(),
|
|
||||||
|
|
||||||
BelongsTo::make(__('Branch'), 'branch', Branch::class),
|
BelongsTo::make(__('Branch'), 'branch', Branch::class),
|
||||||
]),
|
]),
|
||||||
new Panel(__('Personal data'), [
|
new Panel(__('Personal data'), [
|
||||||
Text::make(__('Passport name'), 'passport_name')
|
Text::make(__('Passport name'), 'passport_name'),
|
||||||
->fullWidth()
|
|
||||||
->rules('required', 'string', 'max:255'),
|
|
||||||
|
|
||||||
Text::make(__('Passport surname'), 'passport_surname')
|
Text::make(__('Passport surname'), 'passport_surname'),
|
||||||
->fullWidth()
|
|
||||||
->rules('required', 'string', 'max:255'),
|
|
||||||
|
|
||||||
NovaInputmask::make(__('Phone'), 'phone')
|
NovaInputmask::make(__('Phone'), 'phone')
|
||||||
->fullWidth()
|
->phonenumber('TM'),
|
||||||
->phonenumber('TM')
|
|
||||||
->rules('required', 'max:255')
|
|
||||||
->hideFromIndex(),
|
|
||||||
|
|
||||||
Text::make(__('Email'), 'email')
|
Text::make(__('Email'), 'email'),
|
||||||
->fullWidth()
|
|
||||||
->rules('nullable', 'max:255', 'email')
|
|
||||||
->hideFromIndex(),
|
|
||||||
|
|
||||||
Text::make(__('Current Residence'), 'address')
|
Text::make(__('Current Residence'), 'address'),
|
||||||
->fullWidth()
|
|
||||||
->rules('required', 'string', 'max:255')
|
|
||||||
->hideFromIndex(),
|
|
||||||
]),
|
]),
|
||||||
new Panel(__('Payment'), [
|
new Panel(__('Payment'), [
|
||||||
SimpleRepeatable::make(__('Payment sender data'), 'sender_datas', [
|
SimpleRepeatable::make(__('Payment sender data'), 'sender_datas', [
|
||||||
Select::make(__('Passport serie'), 'passport_serie')
|
Select::make(__('Passport serie'), 'passport_serie')
|
||||||
->displayUsingLabels()
|
->displayUsingLabels()
|
||||||
->searchable()
|
->options(PassportRepo::values()),
|
||||||
->options(PassportRepo::values())
|
|
||||||
->rules('required')
|
|
||||||
->sortable(),
|
|
||||||
|
|
||||||
NovaInputmask::make(__('Passport number'), 'passport_number')
|
NovaInputmask::make(__('Passport number'), 'passport_number')
|
||||||
->mask('999999')
|
->mask('999999'),
|
||||||
->rules('required', 'max:255'),
|
|
||||||
|
|
||||||
Text::make(
|
Text::make(
|
||||||
name: sprintf('%s %s %s', __('Name'), __('Surname'), __('Patronic name')),
|
name: sprintf('%s %s %s', __('Name'), __('Surname'), __('Patronic name')),
|
||||||
@@ -189,13 +152,16 @@ class SberPaymentOrderFieldsForDetail
|
|||||||
/**
|
/**
|
||||||
* Paid field
|
* Paid field
|
||||||
*/
|
*/
|
||||||
public static function paidField($resource, $date = null)
|
public static function paidField(NovaSberPaymentOrder $resource, ?string $date = null): string
|
||||||
{
|
{
|
||||||
$paid = false;
|
/** @var \App\Modules\SberPaymentOrder\Models\SberPaymentOrder */
|
||||||
$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) {
|
||||||
|
|||||||
@@ -30,9 +30,6 @@ use Nurmuhammet\NovaInputmask\NovaInputmask;
|
|||||||
use Outl1ne\NovaDetachedFilters\NovaDetachedFilters;
|
use Outl1ne\NovaDetachedFilters\NovaDetachedFilters;
|
||||||
use Outl1ne\NovaSimpleRepeatable\SimpleRepeatable;
|
use Outl1ne\NovaSimpleRepeatable\SimpleRepeatable;
|
||||||
|
|
||||||
/**
|
|
||||||
* @template TModel of \App\Modules\SberPaymentOrder\Models\SberPaymentOrder
|
|
||||||
*/
|
|
||||||
class NovaSberPaymentOrder extends Resource
|
class NovaSberPaymentOrder extends Resource
|
||||||
{
|
{
|
||||||
use NovaSberPaymentOrderAuth;
|
use NovaSberPaymentOrderAuth;
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ class VisaMasterPaymentOrderItem extends Model implements HasMedia
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Parent order
|
* Parent order
|
||||||
|
*
|
||||||
|
* @return BelongsTo<VisaMasterPaymentOrder, VisaMasterPaymentOrderItem>
|
||||||
*/
|
*/
|
||||||
public function parent(): BelongsTo
|
public function parent(): BelongsTo
|
||||||
{
|
{
|
||||||
|
|||||||
8
resources/css/vendor/nova/css/additional.css
vendored
8
resources/css/vendor/nova/css/additional.css
vendored
@@ -34,3 +34,11 @@ button[dusk="update-and-continue-editing-button"],
|
|||||||
button[dusk="create-and-add-another-button"] {
|
button[dusk="create-and-add-another-button"] {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.o1-table thead tr {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.o1-table thead tr th:first-child {
|
||||||
|
padding-left: 5px;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user