Lint
This commit is contained in:
parent
2920c57e69
commit
ada4715a81
|
@ -5,6 +5,9 @@ namespace App\Course\Resources;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @mixin \App\Course\Models\CourseMember
|
||||||
|
*/
|
||||||
class CourseResource extends JsonResource
|
class CourseResource extends JsonResource
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Handler extends ExceptionHandler
|
||||||
/**
|
/**
|
||||||
* A list of the exception types that are not reported.
|
* A list of the exception types that are not reported.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
protected $dontReport = [
|
protected $dontReport = [
|
||||||
//
|
//
|
||||||
|
@ -20,7 +20,7 @@ class Handler extends ExceptionHandler
|
||||||
/**
|
/**
|
||||||
* A list of the inputs that are never flashed for validation exceptions.
|
* A list of the inputs that are never flashed for validation exceptions.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
protected $dontFlash = [
|
protected $dontFlash = [
|
||||||
'password',
|
'password',
|
||||||
|
|
|
@ -15,7 +15,6 @@ class InertiaShareMiddleware
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @param \Closure $next
|
* @param \Closure $next
|
||||||
* @param GeneralSettings $settings
|
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next)
|
public function handle($request, Closure $next)
|
||||||
|
|
|
@ -30,10 +30,10 @@ class RedirectIfNotInitializedMiddleware
|
||||||
}
|
}
|
||||||
|
|
||||||
public function shouldRedirect() {
|
public function shouldRedirect() {
|
||||||
return !in_array(request()->route()->getName(), $this->dontRedirect) && auth()->check();
|
return !request()->routeIs($this->dontRedirect) && auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initialized() {
|
public function initialized() {
|
||||||
return \App\Fee::get()->count() > 0;
|
return \App\Fee::count() > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,9 @@ namespace App\Http\Resources;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
use Storage;
|
use Storage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @mixin \Zoomyboy\LaravelNami\NamiUser
|
||||||
|
*/
|
||||||
class UserResource extends JsonResource
|
class UserResource extends JsonResource
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -12,7 +12,8 @@ use Illuminate\Http\Request;
|
||||||
|
|
||||||
class HomeView {
|
class HomeView {
|
||||||
public function index(Request $request) {
|
public function index(Request $request) {
|
||||||
$amount = Payment::whereNeedsPayment()->selectRaw('sum(subscriptions.amount) AS a')->join('subscriptions', 'subscriptions.id', 'payments.subscription_id')->first()->a;
|
/** @var object{a: string} */
|
||||||
|
$amount = Payment::whereNeedsPayment()->selectRaw('sum(subscriptions.amount) AS a')->join('subscriptions', 'subscriptions.id', 'payments.subscription_id')->first();
|
||||||
$members = Member::whereHasPendingPayment()->count();
|
$members = Member::whereHasPendingPayment()->count();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@ -20,7 +21,7 @@ class HomeView {
|
||||||
'payments' => [
|
'payments' => [
|
||||||
'users' => $members,
|
'users' => $members,
|
||||||
'all_users' => Member::count(),
|
'all_users' => Member::count(),
|
||||||
'amount' => number_format($amount / 100, 2, ',', '.').' €'
|
'amount' => number_format($amount->a / 100, 2, ',', '.').' €'
|
||||||
],
|
],
|
||||||
'groups' => Member::select('subactivities.slug', 'subactivities.name')->selectRaw('COUNT(members.id) AS count')->join('memberships', 'memberships.member_id', 'members.id')
|
'groups' => Member::select('subactivities.slug', 'subactivities.name')->selectRaw('COUNT(members.id) AS count')->join('memberships', 'memberships.member_id', 'members.id')
|
||||||
->join('activities', 'memberships.activity_id', 'activities.id')
|
->join('activities', 'memberships.activity_id', 'activities.id')
|
||||||
|
|
|
@ -5,6 +5,9 @@ namespace App\Http\Views;
|
||||||
use App\Member\MemberResource;
|
use App\Member\MemberResource;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @mixin \App\Member\Member
|
||||||
|
*/
|
||||||
class MemberTriesResource extends MemberResource
|
class MemberTriesResource extends MemberResource
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -61,8 +61,8 @@ class MemberView {
|
||||||
private function additional($member, $overwrites = []) {
|
private function additional($member, $overwrites = []) {
|
||||||
return (new MemberResource($member->load('payments')))
|
return (new MemberResource($member->load('payments')))
|
||||||
->additional(array_merge([
|
->additional(array_merge([
|
||||||
'subscriptions' => Subscription::get()->pluck('name', 'id'),
|
'subscriptions' => Subscription::pluck('name', 'id'),
|
||||||
'statuses' => Status::get()->pluck('name', 'id'),
|
'statuses' => Status::pluck('name', 'id'),
|
||||||
], $overwrites));
|
], $overwrites));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Initialize;
|
namespace App\Initialize;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class InitializeActivities {
|
||||||
|
|
||||||
|
|
||||||
$groups = [];
|
$groups = [];
|
||||||
$this->api->subactivitiesOf($activity->nami_id)->each(function($group) use ($activity, &$groups) {
|
$this->api->subactivitiesOf($activity->nami_id)->each(function($group) use (&$groups) {
|
||||||
$group = \App\Subactivity::updateOrCreate(['nami_id' => $group->id], [
|
$group = \App\Subactivity::updateOrCreate(['nami_id' => $group->id], [
|
||||||
'nami_id' => $group->id,
|
'nami_id' => $group->id,
|
||||||
'name' => $group->name,
|
'name' => $group->name,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Initialize;
|
namespace App\Initialize;
|
||||||
|
|
||||||
|
@ -9,8 +9,8 @@ use Zoomyboy\LaravelNami\NamiUser;
|
||||||
|
|
||||||
class InitializeCourses {
|
class InitializeCourses {
|
||||||
|
|
||||||
private Progress $bar;
|
|
||||||
private Api $api;
|
private Api $api;
|
||||||
|
private Progress $bar;
|
||||||
|
|
||||||
public function __construct(Progress $bar, Api $api) {
|
public function __construct(Progress $bar, Api $api) {
|
||||||
$this->bar = $bar;
|
$this->bar = $bar;
|
||||||
|
@ -19,8 +19,10 @@ class InitializeCourses {
|
||||||
|
|
||||||
public function handle(NamiUser $user): void
|
public function handle(NamiUser $user): void
|
||||||
{
|
{
|
||||||
$this->api->courses()->each(function($course) {
|
$this->bar->task('Synchronisiere Kurse', function() {
|
||||||
Course::create(['nami_id' => $course->id, 'name' => $course->name]);
|
$this->api->courses()->each(function($course) {
|
||||||
|
Course::create(['nami_id' => $course->id, 'name' => $course->name]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,6 @@ class InitializeMembers {
|
||||||
$m = Member::create([
|
$m = Member::create([
|
||||||
'firstname' => $member->firstname,
|
'firstname' => $member->firstname,
|
||||||
'lastname' => $member->lastname,
|
'lastname' => $member->lastname,
|
||||||
'nickname' => $member->nickname,
|
|
||||||
'joined_at' => $member->joined_at,
|
'joined_at' => $member->joined_at,
|
||||||
'birthday' => $member->birthday,
|
'birthday' => $member->birthday,
|
||||||
'send_newspaper' => $member->send_newspaper,
|
'send_newspaper' => $member->send_newspaper,
|
||||||
|
|
|
@ -37,13 +37,12 @@ class CreateJob implements ShouldQueue
|
||||||
$this->member = Member::find($this->memberId);
|
$this->member = Member::find($this->memberId);
|
||||||
|
|
||||||
if ($this->member->hasNami) {
|
if ($this->member->hasNami) {
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = $this->user->api()->putMember([
|
$response = $this->user->api()->putMember([
|
||||||
'firstname' => $this->member->firstname,
|
'firstname' => $this->member->firstname,
|
||||||
'lastname' => $this->member->lastname,
|
'lastname' => $this->member->lastname,
|
||||||
'nickname' => $this->member->nickname,
|
|
||||||
'joined_at' => $this->member->joined_at,
|
'joined_at' => $this->member->joined_at,
|
||||||
'birthday' => $this->member->birthday,
|
'birthday' => $this->member->birthday,
|
||||||
'send_newspaper' => $this->member->send_newspaper,
|
'send_newspaper' => $this->member->send_newspaper,
|
||||||
|
@ -77,10 +76,10 @@ class CreateJob implements ShouldQueue
|
||||||
$memberships = $this->member->getNamiMemberships($this->user->api());
|
$memberships = $this->member->getNamiMemberships($this->user->api());
|
||||||
foreach ($memberships as $membership) {
|
foreach ($memberships as $membership) {
|
||||||
$this->member->memberships()->create([
|
$this->member->memberships()->create([
|
||||||
'activity_id' => Activity::nami($membership['activity_id'])->id,
|
'activity_id' => Activity::nami($membership['activity_id'])->id,
|
||||||
'subactivity_id' => $membership['subactivity_id']
|
'subactivity_id' => $membership['subactivity_id']
|
||||||
? Subactivity::nami($membership['subactivity_id'])->id
|
? Subactivity::nami($membership['subactivity_id'])->id
|
||||||
: null,
|
: null,
|
||||||
'group_id' => Group::nami($membership['group_id'])->id,
|
'group_id' => Group::nami($membership['group_id'])->id,
|
||||||
'nami_id' => $membership['id'],
|
'nami_id' => $membership['id'],
|
||||||
'created_at' => $membership['starts_at'],
|
'created_at' => $membership['starts_at'],
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
namespace App\Member;
|
namespace App\Member;
|
||||||
|
|
||||||
|
use App\Confession;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Zoomyboy\LaravelNami\Nami;
|
use Zoomyboy\LaravelNami\Nami;
|
||||||
use App\Confession;
|
|
||||||
|
|
||||||
class DeleteJob implements ShouldQueue
|
class DeleteJob implements ShouldQueue
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@ class DeleteJob implements ShouldQueue
|
||||||
$this->member = Member::find($this->memberId);
|
$this->member = Member::find($this->memberId);
|
||||||
|
|
||||||
if (!$this->member->hasNami) {
|
if (!$this->member->hasNami) {
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Nami::login($this->user->mglnr)->deleteMember($this->member->nami_id);
|
Nami::login($this->user->mglnr)->deleteMember($this->member->nami_id);
|
||||||
|
|
|
@ -22,6 +22,13 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property string $subscription_name
|
||||||
|
* @property int $pending_payment
|
||||||
|
* @property bool $is_confirmed
|
||||||
|
* @property string $age_group_icon
|
||||||
|
* @property \Carbon\Carbon $try_created_at
|
||||||
|
*/
|
||||||
class Member extends Model
|
class Member extends Model
|
||||||
{
|
{
|
||||||
use Notifiable;
|
use Notifiable;
|
||||||
|
|
|
@ -31,7 +31,7 @@ class MemberController extends Controller
|
||||||
public function index(Request $request, GeneralSettings $settings): Response {
|
public function index(Request $request, GeneralSettings $settings): Response {
|
||||||
session()->put('menu', 'member');
|
session()->put('menu', 'member');
|
||||||
session()->put('title', 'Mitglieder');
|
session()->put('title', 'Mitglieder');
|
||||||
|
|
||||||
$query = [
|
$query = [
|
||||||
'filter' => array_merge(
|
'filter' => array_merge(
|
||||||
$this->filter,
|
$this->filter,
|
||||||
|
@ -46,7 +46,7 @@ class MemberController extends Controller
|
||||||
['href' => route('sendpayment.create'), 'label' => 'Rechnungen versenden', 'color' => 'info', 'icon' => 'envelope', 'show' => $settings->hasModule('bill')],
|
['href' => route('sendpayment.create'), 'label' => 'Rechnungen versenden', 'color' => 'info', 'icon' => 'envelope', 'show' => $settings->hasModule('bill')],
|
||||||
];
|
];
|
||||||
$payload['query'] = $query;
|
$payload['query'] = $query;
|
||||||
$payload['billKinds'] = BillKind::get()->pluck('name', 'id');
|
$payload['billKinds'] = BillKind::pluck('name', 'id');
|
||||||
|
|
||||||
return \Inertia::render('member/Index', $payload);
|
return \Inertia::render('member/Index', $payload);
|
||||||
}
|
}
|
||||||
|
@ -60,15 +60,15 @@ class MemberController extends Controller
|
||||||
return \Inertia::render('member/Form', [
|
return \Inertia::render('member/Form', [
|
||||||
'activities' => $activities->pluck('name', 'id'),
|
'activities' => $activities->pluck('name', 'id'),
|
||||||
'subactivities' => $activities->map(function(Activity $activity) {
|
'subactivities' => $activities->map(function(Activity $activity) {
|
||||||
return ['subactivities' => $activity->subactivities->pluck('name', 'id'), 'id' => $activity->id];
|
return ['subactivities' => $activity->subactivities()->pluck('name', 'id'), 'id' => $activity->id];
|
||||||
})->pluck('subactivities', 'id'),
|
})->pluck('subactivities', 'id'),
|
||||||
'billKinds' => BillKind::get()->pluck('name', 'id'),
|
'billKinds' => BillKind::pluck('name', 'id'),
|
||||||
'genders' => Gender::get()->pluck('name', 'id'),
|
'genders' => Gender::pluck('name', 'id'),
|
||||||
'countries' => Country::get()->pluck('name', 'id'),
|
'countries' => Country::pluck('name', 'id'),
|
||||||
'regions' => Region::where('is_null', false)->get()->pluck('name', 'id'),
|
'regions' => Region::where('is_null', false)->pluck('name', 'id'),
|
||||||
'nationalities' => Nationality::get()->pluck('name', 'id'),
|
'nationalities' => Nationality::pluck('name', 'id'),
|
||||||
'confessions' => Confession::where('is_null', false)->get()->pluck('name', 'id'),
|
'confessions' => Confession::where('is_null', false)->pluck('name', 'id'),
|
||||||
'subscriptions' => Subscription::get()->pluck('name', 'id'),
|
'subscriptions' => Subscription::pluck('name', 'id'),
|
||||||
'data' => [
|
'data' => [
|
||||||
'country_id' => Country::default()
|
'country_id' => Country::default()
|
||||||
],
|
],
|
||||||
|
@ -93,13 +93,13 @@ class MemberController extends Controller
|
||||||
'subactivities' => $activities->map(function($activity) {
|
'subactivities' => $activities->map(function($activity) {
|
||||||
return ['subactivities' => $activity->subactivities->pluck('name', 'id'), 'id' => $activity->id];
|
return ['subactivities' => $activity->subactivities->pluck('name', 'id'), 'id' => $activity->id];
|
||||||
})->pluck('subactivities', 'id'),
|
})->pluck('subactivities', 'id'),
|
||||||
'billKinds' => BillKind::get()->pluck('name', 'id'),
|
'billKinds' => BillKind::pluck('name', 'id'),
|
||||||
'genders' => Gender::get()->pluck('name', 'id'),
|
'genders' => Gender::pluck('name', 'id'),
|
||||||
'countries' => Country::get()->pluck('name', 'id'),
|
'countries' => Country::pluck('name', 'id'),
|
||||||
'regions' => Region::where('is_null', false)->get()->pluck('name', 'id'),
|
'regions' => Region::where('is_null', false)->pluck('name', 'id'),
|
||||||
'nationalities' => Nationality::get()->pluck('name', 'id'),
|
'nationalities' => Nationality::pluck('name', 'id'),
|
||||||
'confessions' => Confession::where('is_null', false)->get()->pluck('name', 'id'),
|
'confessions' => Confession::where('is_null', false)->pluck('name', 'id'),
|
||||||
'subscriptions' => Subscription::get()->pluck('name', 'id'),
|
'subscriptions' => Subscription::pluck('name', 'id'),
|
||||||
'data' => new MemberResource($member),
|
'data' => new MemberResource($member),
|
||||||
'mode' => 'edit',
|
'mode' => 'edit',
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
namespace App\Member;
|
namespace App\Member;
|
||||||
|
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
|
||||||
use Illuminate\Validation\Rule;
|
|
||||||
use App\Group;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
use App\Activity;
|
use App\Activity;
|
||||||
|
use App\Group;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
class MemberRequest extends FormRequest
|
class MemberRequest extends FormRequest
|
||||||
{
|
{
|
||||||
|
@ -30,15 +30,15 @@ class MemberRequest extends FormRequest
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'first_activity_id' => Rule::requiredIf(fn() => $this->method() == 'POST'),
|
'first_activity_id' => Rule::requiredIf(fn() => $this->method() == 'POST'),
|
||||||
'first_subactivity_id' => Rule::requiredIf(fn() => $this->method() == 'POST'),
|
'first_subactivity_id' => Rule::requiredIf(fn() => $this->method() == 'POST'),
|
||||||
'subscription_id' => Rule::requiredIf(function() {
|
'subscription_id' => Rule::requiredIf(function() {
|
||||||
if ($this->method() != 'POST') {
|
if ($this->method() != 'POST') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->input('first_activity_id')) { return true; }
|
if (!$this->input('first_activity_id')) { return true; }
|
||||||
|
|
||||||
return Str::contains(Activity::findOrFail($this->input('first_activity_id'))->name, '€');
|
return Str::contains(Activity::findOrFail($this->input('first_activity_id'))->name, '€');
|
||||||
}),
|
}),
|
||||||
'firstname' => 'required',
|
'firstname' => 'required',
|
||||||
|
|
|
@ -7,6 +7,9 @@ use App\Membership\MembershipResource;
|
||||||
use App\Payment\PaymentResource;
|
use App\Payment\PaymentResource;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @mixin \App\Member\Member
|
||||||
|
*/
|
||||||
class MemberResource extends JsonResource
|
class MemberResource extends JsonResource
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
namespace App\Member;
|
namespace App\Member;
|
||||||
|
|
||||||
|
use App\Confession;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Zoomyboy\LaravelNami\Nami;
|
use Zoomyboy\LaravelNami\Nami;
|
||||||
use App\Confession;
|
|
||||||
|
|
||||||
class UpdateJob implements ShouldQueue
|
class UpdateJob implements ShouldQueue
|
||||||
{
|
{
|
||||||
|
@ -34,13 +34,12 @@ class UpdateJob implements ShouldQueue
|
||||||
$this->member = Member::find($this->memberId);
|
$this->member = Member::find($this->memberId);
|
||||||
|
|
||||||
if (!$this->member->hasNami) {
|
if (!$this->member->hasNami) {
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = Nami::login($this->user->mglnr)->putMember([
|
$response = Nami::login($this->user->mglnr)->putMember([
|
||||||
'firstname' => $this->member->firstname,
|
'firstname' => $this->member->firstname,
|
||||||
'lastname' => $this->member->lastname,
|
'lastname' => $this->member->lastname,
|
||||||
'nickname' => $this->member->nickname,
|
|
||||||
'joined_at' => $this->member->joined_at,
|
'joined_at' => $this->member->joined_at,
|
||||||
'birthday' => $this->member->birthday,
|
'birthday' => $this->member->birthday,
|
||||||
'send_newspaper' => $this->member->send_newspaper,
|
'send_newspaper' => $this->member->send_newspaper,
|
||||||
|
|
|
@ -4,6 +4,9 @@ namespace App\Membership;
|
||||||
|
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @mixin \App\Member\Membership
|
||||||
|
*/
|
||||||
class MembershipResource extends JsonResource
|
class MembershipResource extends JsonResource
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,7 +14,7 @@ class PaymentController extends Controller
|
||||||
session()->put('menu', 'member');
|
session()->put('menu', 'member');
|
||||||
session()->put('title', "Zahlungen für Mitglied {$member->fullname}");
|
session()->put('title', "Zahlungen für Mitglied {$member->fullname}");
|
||||||
|
|
||||||
$payload = app(MemberView::class)->index($request);
|
$payload = app(MemberView::class)->index($request, []);
|
||||||
$payload['single'] = app(MemberView::class)->paymentIndex($member);
|
$payload['single'] = app(MemberView::class)->paymentIndex($member);
|
||||||
|
|
||||||
return \Inertia::render('member/Index', $payload);
|
return \Inertia::render('member/Index', $payload);
|
||||||
|
@ -34,7 +34,7 @@ class PaymentController extends Controller
|
||||||
session()->put('menu', 'member');
|
session()->put('menu', 'member');
|
||||||
session()->put('title', "Zahlungen für Mitglied {$member->fullname}");
|
session()->put('title', "Zahlungen für Mitglied {$member->fullname}");
|
||||||
|
|
||||||
$payload = app(MemberView::class)->index($request);
|
$payload = app(MemberView::class)->index($request, []);
|
||||||
$payload['single'] = app(MemberView::class)->paymentEdit($member, $payment);
|
$payload['single'] = app(MemberView::class)->paymentEdit($member, $payment);
|
||||||
|
|
||||||
return \Inertia::render('member/Index', $payload);
|
return \Inertia::render('member/Index', $payload);
|
||||||
|
|
|
@ -4,6 +4,9 @@ namespace App\Payment;
|
||||||
|
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @mixin Payment
|
||||||
|
*/
|
||||||
class PaymentResource extends JsonResource
|
class PaymentResource extends JsonResource
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -44,6 +44,8 @@ class PaymentSendCommand extends Command
|
||||||
{
|
{
|
||||||
$this->sendBills();
|
$this->sendBills();
|
||||||
$this->sendRemembers();
|
$this->sendRemembers();
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function sendBills(): void
|
private function sendBills(): void
|
||||||
|
|
|
@ -21,7 +21,8 @@ class Status extends Model
|
||||||
return static::where('is_bill', true)->where('is_remember', true)->first()->id;
|
return static::where('is_bill', true)->where('is_remember', true)->first()->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isAccepted() {
|
public function isAccepted(): bool
|
||||||
|
{
|
||||||
return $this->is_bill === false && $this->is_remember === false;
|
return $this->is_bill === false && $this->is_remember === false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
|
|
||||||
namespace App\Payment;
|
namespace App\Payment;
|
||||||
|
|
||||||
|
use App\Fee;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use App\Fee;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
class Subscription extends Model
|
class Subscription extends Model
|
||||||
{
|
{
|
||||||
|
@ -12,7 +13,7 @@ class Subscription extends Model
|
||||||
|
|
||||||
public $fillable = ['name', 'amount', 'fee_id'];
|
public $fillable = ['name', 'amount', 'fee_id'];
|
||||||
|
|
||||||
public function fee() {
|
public function fee(): BelongsTo {
|
||||||
return $this->belongsTo(Fee::class);
|
return $this->belongsTo(Fee::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
namespace App\Payment;
|
namespace App\Payment;
|
||||||
|
|
||||||
|
use App\Fee;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Fee;
|
|
||||||
|
|
||||||
class SubscriptionController extends Controller
|
class SubscriptionController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,7 @@ class SubscriptionController extends Controller
|
||||||
session()->put('title', 'Beitrag erstellen');
|
session()->put('title', 'Beitrag erstellen');
|
||||||
|
|
||||||
return \Inertia::render('subscription/Form', [
|
return \Inertia::render('subscription/Form', [
|
||||||
'fees' => Fee::get()->pluck('name', 'id'),
|
'fees' => Fee::pluck('name', 'id'),
|
||||||
'mode' => 'create',
|
'mode' => 'create',
|
||||||
'data' => (object) []
|
'data' => (object) []
|
||||||
]);
|
]);
|
||||||
|
@ -44,7 +44,7 @@ class SubscriptionController extends Controller
|
||||||
session()->put('title', "Beitrag {$subscription->name} bearbeiten");
|
session()->put('title', "Beitrag {$subscription->name} bearbeiten");
|
||||||
|
|
||||||
return \Inertia::render('subscription/Form', [
|
return \Inertia::render('subscription/Form', [
|
||||||
'fees' => Fee::get()->pluck('name', 'id'),
|
'fees' => Fee::pluck('name', 'id'),
|
||||||
'mode' => 'edit',
|
'mode' => 'edit',
|
||||||
'data' => new SubscriptionResource($subscription),
|
'data' => new SubscriptionResource($subscription),
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -4,6 +4,9 @@ namespace App\Payment;
|
||||||
|
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @mixin Subscription
|
||||||
|
*/
|
||||||
class SubscriptionResource extends JsonResource
|
class SubscriptionResource extends JsonResource
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,12 +10,6 @@ class BillType extends Repository implements PdfRepository
|
||||||
{
|
{
|
||||||
|
|
||||||
public string $filename;
|
public string $filename;
|
||||||
public Collection $pages;
|
|
||||||
|
|
||||||
public function __construct(Collection $pages)
|
|
||||||
{
|
|
||||||
$this->pages = $pages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPayments(Member $member): Collection
|
public function getPayments(Member $member): Collection
|
||||||
{
|
{
|
||||||
|
@ -97,7 +91,7 @@ class BillType extends Repository implements PdfRepository
|
||||||
return "Mitgliedsbeitrag für {$this->getFamilyName($page)}";
|
return "Mitgliedsbeitrag für {$this->getFamilyName($page)}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function allLabel(): string
|
public function allLabel(): string
|
||||||
{
|
{
|
||||||
return 'Rechnungen versenden';
|
return 'Rechnungen versenden';
|
||||||
}
|
}
|
||||||
|
@ -107,7 +101,7 @@ class BillType extends Repository implements PdfRepository
|
||||||
*
|
*
|
||||||
* @return array<int, string>
|
* @return array<int, string>
|
||||||
*/
|
*/
|
||||||
public function getDescription(): array
|
public function getDescription(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'Diese Funktion erstellt ein PDF mit allen noch nicht versendenden Rechnungen bei den Mitgliedern die Post als Versandweg haben.',
|
'Diese Funktion erstellt ein PDF mit allen noch nicht versendenden Rechnungen bei den Mitgliedern die Post als Versandweg haben.',
|
||||||
|
|
|
@ -5,6 +5,7 @@ namespace App\Pdf;
|
||||||
use App\Member\Member;
|
use App\Member\Member;
|
||||||
use App\Payment\Payment;
|
use App\Payment\Payment;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Generator;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
interface PdfRepository
|
interface PdfRepository
|
||||||
|
@ -50,4 +51,6 @@ interface PdfRepository
|
||||||
|
|
||||||
public function getMailSubject(): string;
|
public function getMailSubject(): string;
|
||||||
|
|
||||||
|
public function allPayments(): Generator;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,6 @@ class RememberType extends Repository implements PdfRepository
|
||||||
{
|
{
|
||||||
|
|
||||||
public string $filename;
|
public string $filename;
|
||||||
public Collection $pages;
|
|
||||||
|
|
||||||
public function __construct(Collection $pages)
|
|
||||||
{
|
|
||||||
$this->pages = $pages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPayments(Member $member): Collection
|
public function getPayments(Member $member): Collection
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,10 +5,20 @@ namespace App\Pdf;
|
||||||
use App\Member\Member;
|
use App\Member\Member;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Generator;
|
use Generator;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
abstract class Repository
|
abstract class Repository
|
||||||
{
|
{
|
||||||
|
|
||||||
|
abstract public function getPayments(Member $member): Collection;
|
||||||
|
|
||||||
|
public Collection $pages;
|
||||||
|
|
||||||
|
public function __construct(Collection $pages)
|
||||||
|
{
|
||||||
|
$this->pages = $pages;
|
||||||
|
}
|
||||||
|
|
||||||
public function number(int $number): string
|
public function number(int $number): string
|
||||||
{
|
{
|
||||||
return number_format($number / 100, 2, '.', '');
|
return number_format($number / 100, 2, '.', '');
|
||||||
|
|
|
@ -10,6 +10,8 @@ parameters:
|
||||||
level: 5
|
level: 5
|
||||||
|
|
||||||
ignoreErrors:
|
ignoreErrors:
|
||||||
- '#Unsafe usage of new static#'
|
- '#Call to an undefined method Illuminate\\Contracts\\Auth\\Authenticatable::api\(\)#'
|
||||||
|
- '#Call to an undefined method Illuminate\\Contracts\\Auth\\Authenticatable::getNamiGroupId\(\)#'
|
||||||
|
- '#Illuminate\\Contracts\\Auth\\Authenticatable\|null given#'
|
||||||
|
|
||||||
checkMissingIterableValueType: false
|
checkMissingIterableValueType: false
|
||||||
|
|
Loading…
Reference in New Issue