add goyum hasaby
This commit is contained in:
@@ -59,6 +59,10 @@ class SberPaymentOrderFieldsForDetail
|
|||||||
->withIcons()
|
->withIcons()
|
||||||
->icons(OrderRepo::statusIcons()),
|
->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')
|
Text::make(__('Note'), 'notes')
|
||||||
->fullWidth()
|
->fullWidth()
|
||||||
->canSeeWhen('systemUser', $resource),
|
->canSeeWhen('systemUser', $resource),
|
||||||
@@ -118,6 +122,12 @@ class SberPaymentOrderFieldsForDetail
|
|||||||
attribute: 'full_name'
|
attribute: 'full_name'
|
||||||
)
|
)
|
||||||
->rules('required', 'max:255'),
|
->rules('required', 'max:255'),
|
||||||
|
|
||||||
|
Text::make(
|
||||||
|
name: __('Goýum hasaby'),
|
||||||
|
attribute: 'deposit_account'
|
||||||
|
)
|
||||||
|
->rules('required', 'max:255'),
|
||||||
])->minRows(1)->rules('required'),
|
])->minRows(1)->rules('required'),
|
||||||
|
|
||||||
SimpleRepeatable::make(__('Payee information'), 'payment_reciever', [
|
SimpleRepeatable::make(__('Payee information'), 'payment_reciever', [
|
||||||
@@ -175,4 +185,25 @@ class SberPaymentOrderFieldsForDetail
|
|||||||
HasMany::make(__('Payment items'), 'paymentItems', NovaSberPaymentOrderItem::class),
|
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()
|
->withIcons()
|
||||||
->icons(OrderRepo::statusIcons())
|
->icons(OrderRepo::statusIcons())
|
||||||
->sortable(),
|
->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\SberPaymentOrderFieldsForDetail;
|
||||||
use App\Modules\SberPaymentOrder\Nova\Resources\Concerns\SberPaymentOrderFieldsForIndex;
|
use App\Modules\SberPaymentOrder\Nova\Resources\Concerns\SberPaymentOrderFieldsForIndex;
|
||||||
use App\Nova\Actions\MakeSberPaymentAction;
|
use App\Nova\Actions\MakeSberPaymentAction;
|
||||||
|
use App\Nova\Filters\VisaMasterMonthlyPaidFilter;
|
||||||
use App\Nova\Resource;
|
use App\Nova\Resource;
|
||||||
use App\Repos\Order\Card\CardOrderRepo;
|
use App\Repos\Order\Card\CardOrderRepo;
|
||||||
use App\Repos\Order\OrderRepo;
|
use App\Repos\Order\OrderRepo;
|
||||||
@@ -26,6 +27,7 @@ use Laravel\Nova\Fields\Text;
|
|||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
use Laravel\Nova\Panel;
|
use Laravel\Nova\Panel;
|
||||||
use Nurmuhammet\NovaInputmask\NovaInputmask;
|
use Nurmuhammet\NovaInputmask\NovaInputmask;
|
||||||
|
use Outl1ne\NovaDetachedFilters\NovaDetachedFilters;
|
||||||
use Outl1ne\NovaSimpleRepeatable\SimpleRepeatable;
|
use Outl1ne\NovaSimpleRepeatable\SimpleRepeatable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -63,7 +65,7 @@ class NovaSberPaymentOrder extends Resource
|
|||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $with = ['branch'];
|
public static $with = ['branch', 'paymentItems'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the resource should automatically poll for new resources.
|
* Indicates whether the resource should automatically poll for new resources.
|
||||||
@@ -265,6 +267,12 @@ class NovaSberPaymentOrder extends Resource
|
|||||||
attribute: 'full_name'
|
attribute: 'full_name'
|
||||||
)
|
)
|
||||||
->rules('required', 'max:255'),
|
->rules('required', 'max:255'),
|
||||||
|
|
||||||
|
Text::make(
|
||||||
|
name: __('Goýum hasaby'),
|
||||||
|
attribute: 'deposit_account'
|
||||||
|
)
|
||||||
|
->rules('required', 'max:255'),
|
||||||
])->minRows(1)->rules('required'),
|
])->minRows(1)->rules('required'),
|
||||||
|
|
||||||
SimpleRepeatable::make(__('Payee information'), 'payment_reciever', [
|
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'),
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,16 @@ class VisaMasterMonthlyPaidFilter extends Filter
|
|||||||
*/
|
*/
|
||||||
public $component = 'select-filter';
|
public $component = 'select-filter';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter payments
|
||||||
|
*
|
||||||
|
* @param string $table
|
||||||
|
*/
|
||||||
|
public function __construct(public string $table = 'visa_master_payment_orders') {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name
|
||||||
|
*/
|
||||||
public function name(): string
|
public function name(): string
|
||||||
{
|
{
|
||||||
return __('Aý tölegi');
|
return __('Aý tölegi');
|
||||||
@@ -35,9 +45,10 @@ class VisaMasterMonthlyPaidFilter extends Filter
|
|||||||
|
|
||||||
return $query->selectRaw(
|
return $query->selectRaw(
|
||||||
sprintf('
|
sprintf('
|
||||||
visa_master_payment_orders.*,
|
%s.*,
|
||||||
%s as filter_month
|
%s as filter_month
|
||||||
',
|
',
|
||||||
|
$this->table,
|
||||||
$value
|
$value
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user