wip
This commit is contained in:
@@ -3,12 +3,9 @@
|
|||||||
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\Models\VisaMasterPaymentOrderItem;
|
|
||||||
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;
|
||||||
use Closure;
|
|
||||||
use Laravel\Nova\Fields\Boolean;
|
|
||||||
use Laravel\Nova\Fields\Badge;
|
use Laravel\Nova\Fields\Badge;
|
||||||
use Laravel\Nova\Fields\BelongsTo;
|
use Laravel\Nova\Fields\BelongsTo;
|
||||||
use Laravel\Nova\Fields\DateTime;
|
use Laravel\Nova\Fields\DateTime;
|
||||||
@@ -21,7 +18,7 @@ class VisaMasterPaymentOrderFieldsForIndex
|
|||||||
/**
|
/**
|
||||||
* Loan Order fields for "create"
|
* Loan Order fields for "create"
|
||||||
*/
|
*/
|
||||||
public static function make($resource): array
|
public static function make($resource, $date = null): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
ID::make()->hide(),
|
ID::make()->hide(),
|
||||||
@@ -65,8 +62,8 @@ class VisaMasterPaymentOrderFieldsForIndex
|
|||||||
->icons(OrderRepo::statusIcons())
|
->icons(OrderRepo::statusIcons())
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
|
||||||
Text::make(sprintf('%s (%s)', __('Paid'), __('This month')), function () use ($resource) {
|
Text::make(sprintf('%s (%s)', __('Paid'), __('This month')), function () use ($resource, $date) {
|
||||||
return static::paidField($resource);
|
return static::paidField($resource, $resource->filter_month);
|
||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -74,14 +71,16 @@ class VisaMasterPaymentOrderFieldsForIndex
|
|||||||
/**
|
/**
|
||||||
* Paid field
|
* Paid field
|
||||||
*/
|
*/
|
||||||
public static function paidField($resource)
|
public static function paidField($resource, $date = null)
|
||||||
{
|
{
|
||||||
$paid = false;
|
$paid = false;
|
||||||
$items = $resource->paymentItems;
|
$items = $resource->paymentItems;
|
||||||
|
|
||||||
|
$month = $date ?: date('m');
|
||||||
|
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
if (boolval($item->paid)) {
|
if (boolval($item->paid)) {
|
||||||
if ($item->created_at->format('m') == date('m')) {
|
if ($item->created_at->format('m') == $month) {
|
||||||
$paid = true;
|
$paid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ use App\Modules\VisaMasterPaymentOrder\Nova\Resources\Concerns\VisaMasterAuth;
|
|||||||
use App\Modules\VisaMasterPaymentOrder\Nova\Resources\Concerns\VisaMasterPaymentOrderFieldsForDetail;
|
use App\Modules\VisaMasterPaymentOrder\Nova\Resources\Concerns\VisaMasterPaymentOrderFieldsForDetail;
|
||||||
use App\Modules\VisaMasterPaymentOrder\Nova\Resources\Concerns\VisaMasterPaymentOrderFieldsForIndex;
|
use App\Modules\VisaMasterPaymentOrder\Nova\Resources\Concerns\VisaMasterPaymentOrderFieldsForIndex;
|
||||||
use App\Nova\Actions\MakePaymentNovaVisaMaster;
|
use App\Nova\Actions\MakePaymentNovaVisaMaster;
|
||||||
|
use App\Nova\Filters\RegionFilter;
|
||||||
|
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;
|
||||||
@@ -18,7 +20,6 @@ use App\Repos\System\Settings\Location\RegionRepo;
|
|||||||
use Ebess\AdvancedNovaMediaLibrary\Fields\Files;
|
use Ebess\AdvancedNovaMediaLibrary\Fields\Files;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Laravel\Nova\Fields\Badge;
|
use Laravel\Nova\Fields\Badge;
|
||||||
use Laravel\Nova\Fields\HasMany;
|
use Laravel\Nova\Fields\HasMany;
|
||||||
@@ -29,6 +30,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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -87,7 +89,7 @@ class NovaVisaMasterPaymentOrder extends Resource
|
|||||||
*
|
*
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
public static $showPollingToggle = true;
|
public static $showPollingToggle = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the displayable label of the resource.
|
* Get the displayable label of the resource.
|
||||||
@@ -374,4 +376,43 @@ 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.
|
||||||
|
*
|
||||||
|
* @return array<int, string>
|
||||||
|
*/
|
||||||
|
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(),
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
69
app/Nova/Filters/VisaMasterMonthlyPaidFilter.php
Normal file
69
app/Nova/Filters/VisaMasterMonthlyPaidFilter.php
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Nova\Filters;
|
||||||
|
|
||||||
|
use Laravel\Nova\Filters\Filter;
|
||||||
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
|
|
||||||
|
class VisaMasterMonthlyPaidFilter extends Filter
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The filter's component.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $component = 'select-filter';
|
||||||
|
|
||||||
|
public function name(): string
|
||||||
|
{
|
||||||
|
return __('Aý tölegi');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply the filter to the given query.
|
||||||
|
*
|
||||||
|
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||||
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
|
* @param mixed $value
|
||||||
|
* @return \Illuminate\Database\Eloquent\Builder
|
||||||
|
*/
|
||||||
|
public function apply(NovaRequest $request, $query, $value)
|
||||||
|
{
|
||||||
|
if (! $value) {
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query->selectRaw(
|
||||||
|
sprintf('
|
||||||
|
visa_master_payment_orders.*,
|
||||||
|
%s as filter_month
|
||||||
|
',
|
||||||
|
$value
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the filter's available options.
|
||||||
|
*
|
||||||
|
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function options(NovaRequest $request): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'01',
|
||||||
|
'02',
|
||||||
|
'03',
|
||||||
|
'04',
|
||||||
|
'05',
|
||||||
|
'06',
|
||||||
|
'07',
|
||||||
|
'08',
|
||||||
|
'09',
|
||||||
|
'10',
|
||||||
|
'11',
|
||||||
|
'12',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
119
app/Nova/Lenses/VisaMasterMonthlyPaid.php
Normal file
119
app/Nova/Lenses/VisaMasterMonthlyPaid.php
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Nova\Lenses;
|
||||||
|
|
||||||
|
use App\Modules\VisaMasterPaymentOrder\Nova\Resources\Concerns\VisaMasterPaymentOrderFieldsForIndex;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Laravel\Nova\Http\Requests\LensRequest;
|
||||||
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
|
use Laravel\Nova\Lenses\Lens;
|
||||||
|
use stdClass;
|
||||||
|
|
||||||
|
class VisaMasterMonthlyPaid extends Lens
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The columns that should be searched.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public static $search = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected string $month = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the displayable name of the lens.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function name(): string
|
||||||
|
{
|
||||||
|
return Carbon::create(date('Y').'-'.$this->month.'-01')->monthName ?? 'Ýanwar';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new lens instance.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Database\Eloquent\Model|null $resource
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct($resource = null, string $month = '01')
|
||||||
|
{
|
||||||
|
$this->resource = $resource ?: new stdClass;
|
||||||
|
$this->month = $month;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the query builder / paginator for the lens.
|
||||||
|
*
|
||||||
|
* @param \Laravel\Nova\Http\Requests\LensRequest $request
|
||||||
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public static function query(LensRequest $request, $query)
|
||||||
|
{
|
||||||
|
$query->with('branch', 'paymentItems');
|
||||||
|
|
||||||
|
return $request->withOrdering($request->withFilters(
|
||||||
|
$query
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the fields available to the lens.
|
||||||
|
*
|
||||||
|
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function fields(NovaRequest $request): array
|
||||||
|
{
|
||||||
|
return VisaMasterPaymentOrderFieldsForIndex::make($this, $this->month);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the cards available on the lens.
|
||||||
|
*
|
||||||
|
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function cards(NovaRequest $request): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the filters available for the lens.
|
||||||
|
*
|
||||||
|
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function filters(NovaRequest $request): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the actions available on the lens.
|
||||||
|
*
|
||||||
|
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function actions(NovaRequest $request): array
|
||||||
|
{
|
||||||
|
return parent::actions($request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the URI key for the lens.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function uriKey(): string
|
||||||
|
{
|
||||||
|
return 'visa-master-monthly-paid-'.$this->month;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
"morrislaptop/laravel-pulse-4xx": "^0.0.2",
|
"morrislaptop/laravel-pulse-4xx": "^0.0.2",
|
||||||
"nurmuhammet/nova-custom-html": "@dev",
|
"nurmuhammet/nova-custom-html": "@dev",
|
||||||
"nurmuhammet/nova-inputmask": "^1.0",
|
"nurmuhammet/nova-inputmask": "^1.0",
|
||||||
|
"outl1ne/nova-detached-filters": "^2.1",
|
||||||
"outl1ne/nova-grid": "@dev",
|
"outl1ne/nova-grid": "@dev",
|
||||||
"outl1ne/nova-simple-repeatable": "^2.2",
|
"outl1ne/nova-simple-repeatable": "^2.2",
|
||||||
"outl1ne/nova-translatable": "^2.2",
|
"outl1ne/nova-translatable": "^2.2",
|
||||||
|
|||||||
1369
composer.lock
generated
1369
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -141,7 +141,7 @@ return [
|
|||||||
'-m 6', // for the slowest compression method in order to get the best compression.
|
'-m 6', // for the slowest compression method in order to get the best compression.
|
||||||
'-pass 10', // for maximizing the amount of analysis pass.
|
'-pass 10', // for maximizing the amount of analysis pass.
|
||||||
'-mt', // multithreading for some speed improvements.
|
'-mt', // multithreading for some speed improvements.
|
||||||
'-q 90', //quality factor that brings the least noticeable changes.
|
'-q 90', // quality factor that brings the least noticeable changes.
|
||||||
],
|
],
|
||||||
Spatie\ImageOptimizer\Optimizers\Avifenc::class => [
|
Spatie\ImageOptimizer\Optimizers\Avifenc::class => [
|
||||||
'-a cq-level=23', // constant quality level, lower values mean better quality and greater file size (0-63).
|
'-a cq-level=23', // constant quality level, lower values mean better quality and greater file size (0-63).
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ return [
|
|||||||
/*
|
/*
|
||||||
* Change this if you want to name the related pivots other than defaults
|
* Change this if you want to name the related pivots other than defaults
|
||||||
*/
|
*/
|
||||||
'role_pivot_key' => null, //default 'role_id',
|
'role_pivot_key' => null, // default 'role_id',
|
||||||
'permission_pivot_key' => null, //default 'permission_id',
|
'permission_pivot_key' => null, // default 'permission_id',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Change this if you want to name the related model primary key other than
|
* Change this if you want to name the related model primary key other than
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
'exclude_files' => [
|
'exclude_files' => [
|
||||||
//'validation.php', // Exclude default validation for example.
|
// 'validation.php', // Exclude default validation for example.
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user